-
Notifications
You must be signed in to change notification settings - Fork 9
/
RRHX4.ASM
executable file
·740 lines (649 loc) · 15.8 KB
/
RRHX4.ASM
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
STTL HORIZ EXPLODES
*
*INIT DMASIZ EXPLOSION DATA STRUCTURE
*
HXINV PSHS X,D
LDX #EX FIRST
STX EXFREE
EXIN0 LEAX EXSIZE,X FIND NEXT
STX -EXSIZE,X STORE
CMPX #EXEND-EXSIZE BLO EXIN0
EXIN1 LDD #0
STD ,X
STD EXPTR
STD APPTR
PULS X,D,PC
*
*GET A DATA BLOCK IN U FOR EXPLOSIONS
*
GETBLK PSHS X
LDU EXFREE
BEQ NOBLK NONE
LDX ,U GET NEXT
STX EXFREE
LDX EXPTR GET LIST
STX ,U APPEND US
STU EXPTR
CLC
PULS X,PC RETURN IN U
NOBLK SEC
PULS X,PC
*
*GET AN APPEAR BLOCK
*
GETAP PSHS X
LDU EXFREE
BEQ NOBLK
LDX ,U
STX EXFREE
LDX APPTR
STX ,U
STU APPTR
CLC
PULS X,PC
*
*START A DMASIZ APPEAR X=OBJECT
*
HAPSTV PSHS X,U,D,Y
JSR GETAP GET A BLOCK TO USE
BCS APBYE
LDD OBJX,X
LDX OPICT,X
STD UL,U STORE UPPER LEFT (FIRST FRAME)
LDB CENTMP
STB XCENT,U
SUBB UL,U SUBTRACT X UPPER LEFT
BCS NWCEAP NO GOOD
CMPB 0,X COMPARE
BLO APNTOK
NWCEAP LDB ,X GET WIDTH
STB XOF,U SAVE OFFSET
ADDB UL,U ADD TOP
STB XCENT,U THIS IS
BRA CCONTA
APNTOK ASLB DOUBLE CENTER FOR BYTE ADJUSTMENT
STB XOF,U
CCONTA LDD #$4646 SUPRESS LOW GUYS, SLOW, ZERO SUPRESS, SER-BLK
STD DMACNT,U
LDD ,X FETCH H,W
STD WH,U SAVE
LDA #1 ONLY ERASE 1 ROW FIRST TIME THROUGH
STA XHITE,U HITE FOR FIRST ERASE
EORA #$4
EORB #$4
STD DMAWH,U FORMED
LDX 2,X GET DATA POINTER
STX PICPTR,U SAVE OBJECT DESC
LDD #$1000 1ST FRAME SIZE
STD XSIZER,U
DMOVE LEAX DATA-1,U LET X POINT AT DATA STORAGE AREA
STX TEMP1 SAVE POINTER
LDY PICPTR,U U POINTS AT DATA
LDB WH+1,U ITERATE OVER THE HEIGHT
STB TEMP2+1
HSET2 LDX TEMP1 GET SAVED POINTER
LEAX 1,X MOVE TO NEXT LOCATION
STX TEMP1 AND SAVE
LDA WH,U GET WIDTH
STA TEMP2 SAVE AS COUNTER
HSET1 LDA ,Y+ GET A BYTE 6
STA ,X STORE 5
ABX ADD HEIGHT TO GET TO NEXT 4
ASLA 2
ASLA 2
ASLA 2
ASLA 2
STA ,X 5
ABX 4
DEC TEMP2 6
BNE HSET1 3
DEC TEMP2+1 1 LESS ROW
BNE HSET2
APBYE CLC
PULS X,D,U,PC,Y
*
*START A DMASIZ EXPLOSION
*X=OBJ
HEXSTV PSHS X,U,D,Y
JSR DMAOFF
JSR GETBLK GET A BLOCK TO USE
BCS APBYE DONE...NO BLOCKS
LDD OBJX,X
LDX OPICT,X
STD UL,U STORE UPPER LEFT (FIRST FRAME)
LDB CENTMP
STB XCENT,U
SUBB UL,U SUBTRACT X UPPER LEFT
BCS NWCENT NO GOOD
CMPB 0,X COMPARE
BLO CENTOK
NWCENT LDB ,X GET WIDTH
STB XOF,U SAVE OFFSET
ADDB UL,U ADD TOP
STB XCENT,U THIS IS
BRA CCONT
CENTOK ASLB DOUBLE CENTER FOR BYTE ADJUSTMENT
STB XOF,U
CCONT LDD #$4646 SUPRESS UPPER, SLOW, SUPRESS, SER TO BLOCK
STD DMACNT,U THIS IS DMA CONTROL BYTE
LDD ,X FETCH H,W
STD WH,U SAVE
ASLA DOUBLE WIDTH FOR HEIGHT TO USE
STA XHITE,U HITE FOR FIRST ERASE
LDA #1 HEIGHT IS 1 FOR DMA
EORA #$4
EORB #$4
STD DMAWH,U FORMED
LDX 2,X GET DATA POINTER
STX PICPTR,U SAVE OBJECT DESC
LDD #$0 1ST FRAME MIN
STD XSIZER,U
LDA #$10 NUMBER OF FRAMES LEFT
STA FRAMES,U
BRA DMOVE
* THIS CODE DMA'S THE DMASIZONTAL LINES
* A JUMP INTO HERE IS MADE BASED ON NUMBER OF
* VERTICAL LINES IN OBJECT
BSLOOP STA ,Y Y FOR CURRENT TRANSFER
STX DMAORG DATA POINTER
STU DMACTL DO THE LINE
ABX NEXT DMAORG
ADDA XSIZE ADD SPACING
BSSIZE EQU *-BSLOOP
STA ,Y
STX DMAORG
STU DMACTL
ABX
ADDA XSIZE
STA ,Y
STX DMAORG
STU DMACTL
ABX
ADDA XSIZE
STA ,Y
STX DMAORG
STU DMACTL
ABX
ADDA XSIZE
STA ,Y
STX DMAORG
STU DMACTL
ABX
ADDA XSIZE
STA ,Y
STX DMAORG
STU DMACTL
ABX
ADDA XSIZE
STA ,Y
STX DMAORG
STU DMACTL
ABX
ADDA XSIZE
STA ,Y
STX DMAORG
STU DMACTL
ABX
ADDA XSIZE
STA ,Y
STX DMAORG
STU DMACTL
ABX
ADDA XSIZE
STA ,Y
STX DMAORG
STU DMACTL
ABX
ADDA XSIZE
STA ,Y
STX DMAORG
STU DMACTL
ABX
ADDA XSIZE
STA ,Y
STX DMAORG
STU DMACTL
ABX
ADDA XSIZE
STA ,Y
STX DMAORG
STU DMACTL
ABX
ADDA XSIZE
STA ,Y
STX DMAORG
STU DMACTL
ABX
ADDA XSIZE
STA ,Y
STX DMAORG
STU DMACTL
ABX
ADDA XSIZE
STA ,Y
STX DMAORG
STU DMACTL
CLI
PULS Y,PC
ERLOOP STA ,U PUT HEIGHT TO ERASE DOWN
STB ,X ERASE PLEASE
ADDA XSIZE
ERSIZ EQU *-ERLOOP
STA ,U
STB ,X
ADDA XSIZE
STA ,U
STB ,X
ADDA XSIZE
STA ,U
STB ,X
ADDA XSIZE
STA ,U
STB ,X
ADDA XSIZE
STA ,U
STB ,X
ADDA XSIZE
STA ,U
STB ,X
ADDA XSIZE
STA ,U
STB ,X
ADDA XSIZE
STA ,U
STB ,X
ADDA XSIZE
STA ,U
STB ,X
ADDA XSIZE
STA ,U
STB ,X
ADDA XSIZE
STA ,U
STB ,X
ADDA XSIZE
STA ,U
STB ,X
ADDA XSIZE
STA ,U
STB ,X
ADDA XSIZE
STA ,U
STB ,X
ADDA XSIZE
STA ,U
STB ,X
CLI
RTS
*
*ERASE AN EXPLOSION
*Y=DATA BLOCK
*
ERASE LDB XHITE,Y ACTUALLY PLOTTED
SUBB #16 MAX OF 16
NEGB
LDA #ERSIZ
MUL
LDX #ERLOOP START OF LOOP
ABX
PSHS X PLACE TO JUMP
LDA XSIZER,Y
STA XSIZE
LDD UL,Y GET UPPER LEFT
SEI
STB DMADES+1 HIGH HALF OF SCREEN STUFF
LDB DMACNT,Y SUPRESS HIGH, DMACONANT, SLOW, BLOCK DMADES
ORAB #$10 ERASE
ANDB #$F7 NO SUPRESS
LDU #0
STU DMACON CONSTANT, AND HIGH HALF OF DMAORG
STB DMAORG+1 LOW HALF OF ORIG
LDU DMAWH,Y
STU DMASIZ
LDU #DMADES
LDX #DMACTL
RTS
*
*KILL AN EXPLOSION,APPEAR
*Y=DATA BLOCK
*
KILEXP LDU #EXPTR LETS WALK LIST TO FIND HIM
KILEX2 CMPY ,U ARE WE SET
BEQ KILEX1 YEP
LDU ,U KEEP WALKING
BNE KILEX2 STILL STUFF THERE
SEI
BRA * ERROR TRAP
KILEX1 LDD ,Y GET GUY WE POINT AT
STD ,U POINT AROUND US
LDD EXFREE
STD ,Y APPEND FREE LIST
STY EXFREE
LEAY ,U RETURN GUY BEFORE US TO WALK FROM
RTS
*
*WRITE APPEARS
*Y=BLOCK
AWRITE LDD XSIZER,Y
SUBD #$80
CMPA XSIZER,Y ANY CHANGE?
BNE AWRIT0 YIP.
STB XSIZER+1,Y
RTS
AWRIT0 JSR ERASE ERASE THE COCK-SUCKER
LDA STATUS SCROLL?
BNE AWRIT1
LDB PX+1 SCROLL PLAYER APPEAR
STB UL+1,Y
LDB XOF,Y
LSRB
ADDB PX
STB XCENT,Y
AWRIT1 LDA WH,Y GET WIDTH
ASLA DOUBLE FOR PIXEL WIDTH
DECA NO NEED TO DO END COLUMN
STA WIDE
LDD XSIZER,Y GET SIZE
SUBD #$080 SMALLEN IT
TSTA
BHI APGO
LDU #APPTR
JMP KILEX2
*
*WRITE EXPLOSION
*Y=DATA BLOCK
*
WRITE DEC FRAMES,Y ONE LESS FRAME
BEQ KILEXP DONE
LDA WH,Y GET WIDTH
ASLA DOUBLE FOR PIXEL WIDTH
DECA NO NEED TO DO ZEROS ON LEFT COLUMN
STA WIDE
LDD XSIZER,Y
ADDD #$100
APGO STD XSIZER,Y
STA XSIZE
LSRA 1/2 AND SAVE
LDB XOF,Y GET OFFSET
BNE APGO1 OBSCURE BUG CHECK (NO 1/2 UNIT FROM TOP)
CLRA
APGO1 STA TEMP2
LEAX DATA,Y POINT AT THE DATA
LDA XSIZE
LDB XOF,Y GET OFFSET
MUL DISTANCE UP FROM CENTER
STD TEMP1 SAVE
LDB XCENT,Y GET CENTER
CLRA
SUBD TEMP1 LETS BE GENERAL PURPOSE
ADDB TEMP2 ADD 1/2 SIZE
ADCA #0 AND PROPAGATE
BNE CHK2
CMPB #XMIN
BHI CHK3 WERE OK
CHK2 DEC WIDE
ADDB XSIZE
ADCA #0
BNE CHK2
CHK1 CMPB #XMIN
BLS CHK2
STB UL,Y STORE IN PLACE
LDD WH,Y FIND OFFSET
SUBA WIDE
MUL
ABX
BRA CHK3A
CHK3 STB UL,Y
CHK3A LDA WIDE
DECA
LDB XSIZE FIND FILL DEFLECTION
MUL
ADDB UL,Y ADD FIRST POINT
ADCA #0 FIND FULL DEFLECTION
BEQ CHK4 AOK
CHK5 DEC WIDE 1 LESS
SUBB XSIZE 1 LESS DOWNWARD
SBCA #0
BNE CHK5
CHK4 CMPB #XMAX
BHS CHK5
* FIND "LOOP" ENTRY
LDA WIDE GET HEIGHT
LBEQ KILEXP
STA XHITE,Y SAVE FOR ERASE
SUBA #16 16 = 0 OFFSET, 0 = 16 OFFSET
NEGA
LDB #BSSIZE SIZE OF ITERATION
MUL
ADDD #BSLOOP BEGINNING
PSHS D,Y
LDU DMACNT,Y SUPRESS HIGH NIB, SLOW, SUPRESS, SER TO BLOCK
LDD DMAWH,Y GET WH
SEI NO INTS BABY
STD DMASIZ
LDA UL+1,Y GET Y OF DMADESINATION
STA DMADES+1
LDB WH+1,Y GET INITIAL Y HEIGHT (AMOUNT TO ADD TO SOURCE PTR)
LDA UL,Y GET X WIDTH AT START
LDY #DMADES PLACE TO STOE STUFF
RTS JUMP INTO IT
*EXPLOSION APPEAR UPDATE
*
HXUPDV LDY EXPTR
BEQ APUPD
HXUPDL JSR ERASE
JSR WRITE
LDY ,Y
BNE HXUPDL
APUPD LDY APPTR
BEQ APUPDX
APUPDL JSR AWRITE
LDY ,Y
BNE APUPDL
APUPDX RTS
REPEAT EQU $C0
ENDLET EQU $A0
ENDCOL EQU $90
ON EQU $40 INDICATE COLOR IS ON
ON2 EQU $20 COLOR 2 ON
L2V FCB 23 1
FCB 1+ON2 COLOR 2
FCB ENDCOL
FCB 13 2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