-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathBLK71.SRC
executable file
·723 lines (723 loc) · 14.1 KB
/
BLK71.SRC
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
TTL D E F E N D E R 1.0
NMLIST
NOGEN
***********************************************************
*
* TERRAIN , MINI-TERRAIN DATA
* AND PLAYER EXPLOSION
*
***********************************************************
*
*SYSTEM EQUATES
*
SLEEPP EQU $FFD1 LONG SLEEP VECTOR
PD2 EQU 9
*
* TERRAIN EQUATES
*
TLEN EQU $100
*
* PLAYER EXPLOSION EQUATES
*
PXPOST EQU 2 X POSITION TABLE
PYPOST EQU 4 Y POSITION TABLE
PXVELT EQU 6 X VELOCITY TABLE
PYVELT EQU 8 Y VELOCITY TABLE
PNBITS EQU $80 NUMBER OF PIECES
*
* TERRAIN VARIABLES
*
SETDP $A0
ORG $A000
TEMP1A RMB 1
TEMP1B RMB 1
TEMP1C RMB 1
TEMP2A RMB 2
TTBLP0 RMB 2 TERRAIN TABLE POINTER-FLAVOR 0
TTBLP1 RMB 2 TERRAIN TABLE POINTER-FLAVOR 1
LTPTR RMB 2 LEFT TERRAIN DATA POINTER
RTPTR RMB 2 RIGHT TERRAIN DATA POINTER
LTBYTE RMB 1 LEFT TERRAIN DATA BYTE
RTBYTE RMB 1 RIGHT TERRAIN DATA BYTE
LTCNT RMB 1 LEFT TERRAIN BIT COUNTER
RTCNT RMB 1 RIGHT TERRAIN BIT COUNTER
LOFF RMB 1 LEFT VERTICAL OFFSET
ROFF RMB 1 RIGHT VERTICAL OFFSET
SSTACK RMB 2 HARDWARE STACK
BGLX RMB 2 OLD SCREEN LEFT ADDRESS
TEMP2B RMB 2
*
* PLAYER EXPLOSION VARIABLES
*
ORG $A000
PCENT RMB 1 PLAYER CENTER
PCOLC RMB 1 COLOR COUNTER
PCOLP RMB 2 COLOR POINTER
PSED RMB 1 RANDOM SEED MS BYTE
LPSED RMB 1 RANDOM SEED LS BYTE
PSED2 RMB 1 RANDOM SEED 2 MS BYTE
LPSED2 RMB 1 RANDOM SEED 2 LS BYTE
*
* SYSTEM VARIABLES
*
BGL EQU $A020 BACKGROUND LEFT
IRQHK EQU $A024 IRQ HOOK
PCRAM EQU $A026 COLOR RAM BUFFER TABLE
*
* TERRAIN TABLES
*
ORG $B300
ALTTBL RMB TLEN*4 ALTITUDE TABLE
TERTF0 RMB $390 TERRAIN TABLE FLAVOR 0
TERTF1 RMB $390 TERRAIN TABLE FLAVOR 1
STBL RMB $130 SCREEN ADDRESS TABLE
*
* PLAYER EXPLOSION TABLE
*
ORG $B300
TABLE RMB 10*PNBITS
*
* VECTORS
*
ORG $C000
JMP BGINIT TERRAIN GENERATION
JMP BGOUT TERRAIN OUTPUT ROUTINE
JMP BGALT TERRAIN ALTITUDE TABLE GENERATOR
JMP BGERAS TERRAIN ERASE
FDB MTERR MINI TERRAIN DATA
JMP PLEX PLAYER EXPLOSION
FDB WVTAB WAVE DATA TABLE
FDB WVTEND "
*********************************************************
*
* TERRAIN GENERATION
*
BGINIT LDD BGL GET LEFT TERRAIN POINTER
ANDB #$E0 FIND NEAREST PIXEL
STD TEMP2B
ADDD #$2610 START ON RIGHT EDGE OF SCREEN
STD BGLX
CLR LTCNT FIND TERRAIN POSITION
LDX #TDATA-1
STX LTPTR
LDA #$E0 BASE OFFSET
STA LOFF
JSR RFONL1 SETUP LEFT BYTE
LDX #$10 ROTATE PLANET TO FIND OFFSET
TGEN1 CMPX BGLX
BEQ TGEN4
LDA LTBYTE
BPL TGEN2
DEC LOFF
BRA TGEN3
TGEN2 INC LOFF
TGEN3 JSR RFONL1
LEAX $20,X
BRA TGEN1
TGEN4 LDD LTPTR SAVE TERRAIN POINTER
STD TEMP2A
LDA LTCNT SAVE COUNTER
STA TEMP1A
LDA LTBYTE SAVE TERRAIN DATA BYTE
STA TEMP1B
LDA LOFF SAVE TERRAIN OFFSET
STA TEMP1C
LDX #TERTF0 INITIALIZE TERRAIN TABLE POINTERS
STX TTBLP0
LDX #TERTF1
STX TTBLP1
TGEN5 LDD BGLX INITIAL TERRAIN GENERATING LOOP
SUBD #$20
STD BGLX
CMPD TEMP2B
BMI TGEN6
JSR ADDL01
BRA TGEN5
TGEN6 LDD TEMP2A SET RIGHT TERRAIN POINTER
STD RTPTR
LDA TEMP1A SET RIGHT TERRAIN COUNTER
STA RTCNT
LDA TEMP1B SET RIGHT TERRAIN BYTE
STA RTBYTE
LDA TEMP1C SET RIGHT OFFSET
STA ROFF
LDY #STBL ZERO SCREEN ADDRESS TABLE
LDX #0
TGEN10 STX ,Y++
CMPY #STBL+$130
BNE TGEN10
RTS
*********************************************************
*
* TERRAIN OUTPUT ROUTINE
*
BGOUT LDD BGL UPDATE TABLES
ANDB #$E0
SUBD BGLX
ASLB
ROLA
ASLB
ROLA
ASLB
ROLA
STA TEMP1A
BEQ TTER08
BMI TTER09
TTER10 LDD BGLX
ADDD #$20
STD BGLX
JSR ADDR01
DEC TEMP1A
BNE TTER10
BRA TTER08
TTER09 LDD BGLX
SUBD #$20
STD BGLX
JSR ADDL01
INC TEMP1A
BNE TTER09
TTER08 LDD BGL
ANDB #$E0
STD BGLX
LDX #0
LDY #STBL
STS SSTACK SAVE HARDWARE STACK
LDS TTBLP0 FOR FLAVOR 0
BITB #$20 CHECK FLAVOR
BNE TTER02
LDS TTBLP1 CHANGE TO FLAVOR 1
TTER02 LDA #$98
TTER03 STX [,Y] FAST OUTPUT
PULS B,U
STD ,Y
STU [,Y++]
DECA
STX [,Y]
PULS B,U
STD ,Y
STU [,Y++]
DECA
STX [,Y]
PULS B,U
STD ,Y
STU [,Y++]
DECA
STX [,Y]
PULS B,U
STD ,Y
STU [,Y++]
DECA
STX [,Y]
PULS B,U
STD ,Y
STU [,Y++]
DECA
STX [,Y]
PULS B,U
STD ,Y
STU [,Y++]
DECA
STX [,Y]
PULS B,U
STD ,Y
STU [,Y++]
DECA
STX [,Y]
PULS B,U
STD ,Y
STU [,Y++]
DECA
BNE TTER03
TTER04 LDS SSTACK RECOVER HARDWARE STACK
RTS
*
* ADD LEFT PIXEL ROUTINE
*
ADDL01 JSR LFONR1 LEFT FUNCTION ON RIGHT SIDE
BMI ADDL07
DEC ROFF UP
BRA ADDL08
ADDL07 INC ROFF DOWN
ADDL08 LDA #$20 CHECK FLAVOR
BITA BGLX+1
BNE ADDL02
LDX TTBLP1 FLAVOR 1
JSR LFONL1 LEFT FUNCTION ON LEFT SIDE
BMI ADDL04
DEC LOFF UP
LDA LOFF
STA ,X
STA $1C8,X
LDD #$7007
STD 1,X
STD $1C9,X
LEAX 3,X MOVE TABLE POINTER
CMPX #TERTF1+$1C8
BNE ADDL09
LDX #TERTF1
ADDL09 STX TTBLP1
RTS
ADDL04 LDA LOFF DOWN
STA ,X
STA $1C8,X
INCA
STA LOFF
LDD #$0770
STD 1,X
STD $1C9,X
LEAX 3,X MOVE TABLE POINTER
CMPX #TERTF1+$1C8
BNE ADDL03
LDX #TERTF1
ADDL03 STX TTBLP1
RTS
ADDL02 LDX TTBLP0 FLAVOR 0
JSR LFONL1 LEFT FUNCTION ON LEFT SIDE
BMI ADDL06
DEC LOFF UP
LDA LOFF
STA ,X
STA $1C8,X
LDD #$7007
STD 1,X
STD $1C9,X
LEAX 3,X MOVE TABLE POINTER
CMPX #TERTF0+$1C8
BNE ADDL10
LDX #TERTF0
ADDL10 STX TTBLP0
RTS
ADDL06 LDA LOFF DOWN
STA ,X
STA $1C8,X
INCA
STA LOFF
LDD #$0770
STD 1,X
STD $1C9,X
LEAX 3,X MOVE TABLE POINTER
CMPX #TERTF0+$1C8
BNE ADDL05
LDX #TERTF0
ADDL05 STX TTBLP0
RTS
*
* ADD RIGHT PIXEL ROUTINE
*
ADDR01 LDA LTBYTE CHECK LEFT SIDE
BPL ADDR07
DEC LOFF UP
BRA ADDR08
ADDR07 INC LOFF DOWN
ADDR08 JSR RFONL1 RIGHT FUNCTION ON LEFT SIDE
LDA #$20 CHECK FLAVOR
BITA BGLX+1
BEQ ADDR02
LDX TTBLP1 FLAVOR 1
LEAX -3,X MOVE TABLE POINTER
CMPX #TERTF1-3
BNE ADDR03
LDX #TERTF1+$1C5
ADDR03 STX TTBLP1
LDA RTBYTE CHECK ON RIGHT SIDE
BPL ADDR04
DEC ROFF UP
LDA ROFF
STA ,X
STA $1C8,X
LDD #$0770
STD 1,X
STD $1C9,X
JSR RFONR1 RIGHT FUNCTION ON RIGHT SIDE
RTS
ADDR04 LDA ROFF DOWN
STA ,X
STA $1C8,X
INCA
STA ROFF
LDD #$7007
STD 1,X
STD $1C9,X
JSR RFONR1 RIGHT FUNCTION ON RIGHT SIDE
RTS
ADDR02 LDX TTBLP0 FLAVOR 0
LEAX -3,X MOVE TABLE POINTER
CMPX #TERTF0-3
BNE ADDR05
LDX #TERTF0+$1C5
ADDR05 STX TTBLP0
LDA RTBYTE CHECK RIGHT SIDE
BPL ADDR06
DEC ROFF UP
LDA ROFF
STA ,X
STA $1C8,X
LDD #$0770
STD 1,X
STD $1C9,X
JSR RFONR1 RIGHT FUNCTION ON RIGHT SIDE
RTS
ADDR06 LDA ROFF DOWN
STA ,X
STA $1C8,X
INCA
STA ROFF
LDD #$7007
STD 1,X
STD $1C9,X
JSR RFONR1 RIGHT FUNCTION ON RIGHT SIDE
RTS
*********************************************************
*
* TERRAIN ALTITUDE TABLE GENERATOR
*
BGALT LDX #TDATA SET DATA POINTER
STX RTPTR
LDA ,X SET TERRAIN BYTE
STA RTBYTE
LDA #7 SET TERRAIN BIT COUNTER
STA RTCNT
LDA #$E0 SET BASE OFFSET
STA ROFF
LDX #ALTTBL SET ALTITUDE TABLE POINTER
ALTT1 LDA ROFF
STA ,X+ STORE IN TABLE
LDA RTBYTE CHECK BYTE
BPL ALTT2
DEC ROFF UP
BRA ALTT3
ALTT2 INC ROFF DOWN
ALTT3 JSR RFONR1 NEXT BIT
LDA RTBYTE CHECK BYTE
BPL ALTT4
DEC ROFF UP
BRA ALTT5
ALTT4 INC ROFF DOWN
ALTT5 JSR RFONR1 NEXT BIT
CMPX #ALTTBL+4*TLEN CHECK FOR DONE
BNE ALTT1
RTS
********************************************************
*
* TERRAIN ERASE
*
BGERAS LDX #0 ZERO
LDY #STBL ERASE TABLE START
ERAS1 STX [Y++] ERASE AT TABLE
CMPY #STBL+$130 DONE?
BNE ERAS1
RTS
*
* RIGHT TERRAIN FUNCTION ON LEFT SIDE
*
RFONL1 LDA LTCNT
BEQ RFONL2
DEC LTCNT
LDA LTBYTE
ASLA
ADCA #0
STA LTBYTE
RTS
RFONL2 LDU LTPTR
LEAU 1,U
CMPU #TDATA+TLEN
BNE RFONL3
LDU #TDATA
RFONL3 STU LTPTR
LDA #7
STA LTCNT
LDA ,U
STA LTBYTE
RTS
*
* RIGHT TERRAIN FUNCTION ON RIGHT SIDE
*
RFONR1 LDA RTCNT
BEQ RFONR2
DEC RTCNT
LDA RTBYTE
ASLA
ADCA #0
STA RTBYTE
RTS
RFONR2 LDU RTPTR
LEAU 1,U
CMPU #TDATA+TLEN
BNE RFONR3
LDU #TDATA
RFONR3 STU RTPTR
LDA #7
STA RTCNT
LDA ,U
STA RTBYTE
RTS
*
* LEFT TERRAIN FUNCTION ON LEFT SIDE
*
LFONL1 LDA LTCNT
CMPA #7
BEQ LFONL3
INC LTCNT
LDA LTBYTE
LSRA
BCC LFONL2
ADDA #$80
LFONL2 STA LTBYTE
RTS
LFONL3 LDU LTPTR
CMPU #TDATA
BNE LFONL4
LDU #TDATA+TLEN
LFONL4 LEAU -1,U
STU LTPTR
CLR LTCNT
LDA ,U
LSRA
BCC LFONL5
ADDA #$80
LFONL5 STA LTBYTE
RTS
*
* LEFT TERRAIN FUNCTION ON RIGHT SIDE
*
LFONR1 LDA RTCNT
CMPA #7
BEQ LFONR3
INC RTCNT
LDA RTBYTE
LSRA
BCC LFONR2
ADDA #$80
LFONR2 STA RTBYTE
RTS
LFONR3 LDU RTPTR
CMPU #TDATA
BNE LFONR4
LDU #TDATA+TLEN
LFONR4 LEAU -1,U
STU RTPTR
CLR RTCNT
LDA ,U
LSRA
BCC LFONR5
ADDA #$80
LFONR5 STA RTBYTE
RTS
*
* TERRAIN DATA TABLE
*
TDATA FCB $2A,$AA,$AA,$AA,$AA,$AA,$AB,$A1,$D5,$55,$55,$55,$55,$55,$AA,$BF
FCB $FF,$FF,$FF,$C0,$00,$00,$00,$55,$55,$57,$FF,$C0,$01,$55,$55,$55
FCB $55,$55,$55,$5F,$E0,$15,$55,$55,$57,$FF,$F0,$00,$15,$55,$5F,$FF
FCB $FF,$FF,$FF,$00,$00,$00,$00,$05,$55,$7F,$FF,$E0,$00,$05,$55,$55
FCB $55,$55,$FC,$05,$55,$55,$50,$01,$FF,$FF,$FF,$C0,$00,$0A,$AA,$AA
FCB $AA,$FF,$00,$00,$FF,$FF,$FF,$FF,$F0,$00,$00,$1F,$E0,$00,$55,$55
FCB $55,$40,$AA,$AA,$AA,$AA,$AA,$AA,$B5,$57,$AA,$AA,$AA,$F5,$7F,$D5
FCB $55,$55,$57,$FF,$80,$07,$E0,$7F,$F1,$55,$7F,$FF,$FF,$00,$00,$00
FCB $00,$00,$0F,$EF,$76,$91,$11,$11,$5E,$DB,$E9,$84,$77,$EC,$C4,$87
FCB $47,$98,$08,$98,$3F,$C3,$CB,$DB,$9F,$C7,$5F,$2F,$C7,$7D,$EF,$BF
FCB $FA,$4C,$57,$2B,$61,$EF,$EF,$FB,$F7,$E8,$00,$20,$40,$00,$14,$04
FCB $04,$3C,$06,$00,$1D,$07,$3C,$E1,$A5,$55,$55,$45,$2A,$AA,$AA,$AA
FCB $A8,$55,$55,$55,$55,$55,$55,$55,$55,$55,$55,$56,$AA,$AA,$FE,$AA
FCB $AA,$AA,$AA,$AA,$AA,$AA,$AA,$EA,$AA,$AA,$A8,$02,$AA,$AA,$AA,$AA
FCB $BF,$BE,$3E,$63,$FF,$E0,$D8,$1C,$18,$2A,$AB,$1E,$77,$7A,$AF,$A8
FCB $40,$70,$7D,$40,$0B,$FB,$FA,$FF,$C1,$53,$54,$75,$70,$03,$00,$00
********************************************************
*
* MINI TERRAIN
*
MTERR FCB $25,$70,$07,$26,$77,$00,$26,$07,$70,$24,$07,$70
FCB $23,$07,$70,$23,$70,$07,$24,$07,$70,$25,$70,$07
FCB $26,$77,$00,$25,$07,$70,$24,$07,$70,$23,$07,$70
FCB $21,$07,$70,$22,$70,$07,$24,$77,$00,$24,$70,$07
FCB $26,$77,$00,$26,$77,$00,$25,$77,$00,$25,$70,$07
FCB $26,$77,$00,$24,$07,$70,$23,$70,$07,$25,$77,$00
FCB $26,$70,$07,$26,$77,$00,$26,$77,$00,$25,$07,$70
FCB $23,$07,$70,$22,$07,$70,$21,$77,$00,$21,$70,$07
FCB $23,$70,$07,$25,$70,$07,$25,$07,$70,$25,$77,$00
FCB $25,$77,$00,$24,$77,$00,$22,$07,$70,$20,$07,$70
FCB $1E,$07,$70,$1C,$07,$70,$1D,$70,$07,$1F,$70,$07
FCB $21,$70,$07,$22,$70,$07,$24,$70,$07,$26,$70,$07
FCB $26,$77,$00,$26,$77,$00,$26,$77,$00,$26,$77,$00
FCB $26,$77,$00,$25,$77,$00,$25,$70,$07,$26,$77,$00
FCB $24,$07,$70,$23,$77,$00,$24,$77,$00,$22,$07,$70
FCB $23,$70,$07,$22,$07,$70,$21,$70,$07,$23,$70,$07
FCB $25,$70,$07,$26,$77,$00,$26,$07,$70,$24,$07,$70
FCB $23,$07,$70,$23,$70,$07,$24,$07,$70,$25,$70,$07
FCB $26,$77,$00,$25,$07,$70,$24,$07,$70,$23,$07,$70
FCB $21,$07,$70,$22,$70,$07,$24,$77,$00,$24,$70,$07
FCB $26,$77,$00,$26,$77,$00,$25,$77,$00,$25,$70,$07
FCB $26,$77,$00,$24,$07,$70,$23,$70,$07,$25,$77,$00
FCB $26,$70,$07,$26,$77,$00,$26,$77,$00,$25,$07,$70
FCB $23,$07,$70,$22,$07,$70,$21,$77,$00,$21,$70,$07
FCB $23,$70,$07,$25,$70,$07,$25,$07,$70,$25,$77,$00
FCB $25,$77,$00,$24,$77,$00,$22,$07,$70,$20,$07,$70
FCB $1E,$07,$70,$1C,$07,$70,$1D,$70,$07,$1F,$70,$07
FCB $21,$70,$07,$22,$70,$07,$24,$70,$07,$26,$70,$07
FCB $26,$77,$00,$26,$77,$00,$26,$77,$00,$26,$77,$00
FCB $26,$77,$00,$25,$77,$00,$25,$70,$07,$26,$77,$00
FCB $24,$07,$70,$23,$77,$00,$24,$77,$00,$22,$07,$70
FCB $23,$70,$07,$22,$07,$70,$21,$70,$07,$23,$70,$07
**********************************************************
*
* PLAYER EXPLOSION X = PLAYER CENTER
*
PLEX PULS D
STD PD2,U SAVE RETURN ADDR
STX PCENT SAVE PLAY CENTER
LDD #$0808
STD PSED INITIALIZE SEED
LDD #$1732
STD PSED2 INITIALIZE SEED2
* INITIALIZE PIECES
LDY #TABLE
PINIT1 LDA PCENT X POSITION
CLRB
STD PXPOST,Y
LDA PCENT+1 Y POSITION
STD PYPOST,Y
PINIT2 LDA LPSED RANDOM NUMBER
LSRA
EORA LPSED
LSRA
LSRA
ROR PSED
ROR LPSED
LDA PSED
ANDA #1 TOP X VELOCITY
SUBA #1 FOR FOUR QUADRANTS
LDB LPSED
STD PXVELT,Y
BPL PINIT3 FIND ABSOLUTE X VELOCITY
COMA
COMB
PINIT3 PSHS D SAVE ABSOLUTE VELOCITY
LDA LPSED2 RANDOM NUMBER 2
LSRA
EORA LPSED2
LSRA
LSRA
ROR PSED2
ROR LPSED2
LDA PSED2
ANDA #3 TOP Y VELOCITY
SUBA #2 FOR FOUR QUADRANTS
LDB LPSED2
STD PYVELT,Y
BPL PINIT4 FIND ABSOLUTE Y VELOCITY
COMA
COMB
PINIT4 LSRA DIVIDE BY 2
RORB
ADDD ,S++ ADD TO ABSOLUTE X VELOCITY
CMPD #$016A CHECK FOR CORNERS
BHS PINIT1 IF CORNER GET ANOTHER RANDOM NUMBER
LDX #0
STX ,Y ZERO SCREEN ADDRESS
LEAY 10,Y NEXT POINT
CMPY #TABLE+10*PNBITS
BNE PINIT1
* PLAYER EXPLOSION
LDX #PXCOL INITIALIZE COLOR POINTER
STX PCOLP
LDA #56 INITIALIZE COLOR COUNTER
STA PCOLC
PX1 LDA #1 SLEEEP!!!!!!
LDX #PX1A
JMP SLEEPP
PX1A LDX #0 ALWAYS ZERO
LDY #TABLE INITIALIZE TABLE POINTER
LDA [PCOLP] GET COLOR
STA PCRAM+$B SET IN PSEUDO COLOR RAM
BEQ PX8 ZERO COLOR, QUIT
PX2 LDU ,Y ERASE OLD PIECE
STX ,U
STX $100,U
LDD PYVELT,Y GET Y VELOCITY
ADDD PYPOST,Y ADD Y POSITION
CMPA #$2A CHECK IF OFF SCREEN
BLO PX7 OFF SCREEN, NEXT PIECE
STD PYPOST,Y SAVE NEW Y POSITION
STA 1,Y UPDATE Y SCREEN ADDRESS
LDD PXVELT,Y GET X VELOCITY
ADDD PXPOST,Y ADD X POSITION
CMPA #$98 CHECK IF OFF SCREEN
BHI PX7 OFF SCREEN, NEXT PIECE
STD PXPOST,Y SAVE NEW X POSITION
STA ,Y UPDATE X SCREEN ADDRESS
TSTB CHECK LEFT OR RIGHT FLAVOR
BMI PX6
LDD #$BBBB LEFT FLAVOR
STD [Y]
BRA PX7
PX6 LDU ,Y
LDD #$0B0B RIGHT FLAVOR
STD ,U
LDD #$B0B0
STD $100,U
PX7 LEAY 10,Y NEXT PIECE
CMPY #TABLE+10*PNBITS CHECK FOR LAST PIECE
BNE PX2 NO, LOOP
DEC PCOLC NEXT COLOR COUNT
BNE PX1 NEXT PIECE
LDU PCOLP NEXT COLOR
LEAU 1,U
STU PCOLP
LDA #4 RE-INITIALIZE COLOR COUNTER
STA PCOLC
BRA PX1 CONTINUE
PX8 JMP [PD2,U] RETURN
* PLAYER EXPLOSION COLOR TABLE
PXCOL FCB $FF,$7F,$3F,$37,$2F,$27,$1F,$17,7,6,5,4,3,2,0
*
*WAVE DATA
*MAX,MIN,INTRADELT,INTERDELT
*W1,W2,W3,W4
WVTAB FCB 20,0,0,0
FCB 15,20,20,20 LANDERS
FCB 3,0,0,0
FCB 0,3,4,5 TIES
FCB 6,0,0,0
FCB 0,1,3,4 PROBES
FCB 10,0,0,0
FCB 0,0,0,0 SCHITZOS
FCB 10,0,0,0
FCB 0,0,0,0 SWARMERS
FCB 30,0,0,0
FCB 30,25,20,16 WAVE TIME
FCB 5,0,0,0
FCB 5,5,5,5 WAVE SIZE
FCB $60,0,3,2
FCB $16,$1E,$26,$2E LANDER XV
FCB $01,0,0,0
FCB $00,$00,$01,$01 LANDER YV MSB
FCB $FF,0,$10,$00
FCB $70,$B0,$00,$00 LSB
FCB $80,$10,$FC,$FE
FCB $4A,$3A,$2A,$2A LDSTIM
FCB $30,0,0,0
FCB $20,$28,$2C,$30 TIE XV
FCB 2,0,0,0
FCB 1,1,2,2 SZRY
FCB 1,0,0,0
FCB $00,$00,$01,$01 SZYV MSB
FCB $FF,$0,$08,$06
FCB $62,$E0,$02,$12 " LSB
FCB $60,$0,$8,$4
FCB $0C,$1C,$24,$28 SZXV
FCB $FF,$08,$FE,$FE
FCB $2A,$22,$1E,$1C SZSTIM
FCB $60,$0,$08,$02
FCB $16,$1E,$20,$22 SWXV
FCB 40,10,-2,-1
FCB 25,25,25,25 SWSTIM
FCB $3F,0,0,0
FCB $1F,$1F,$1F,$3F SWAC
FCB $C0,$18,$F4,$FC
FCB $D4,$C4,$A4,$94 UFOTIM
FCB 10,3,$FF,$FF
FCB 15,13,12,10 UFSTIM
FCB 200,40,$F4,$F8
FCB 240,220,200,200 UFOSK
WVTEND EQU *
END