-
Notifications
You must be signed in to change notification settings - Fork 9
/
RRG23.ASM
executable file
·1572 lines (1571 loc) · 23.9 KB
/
RRG23.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
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
STTL ROBOT GAME
OPT NOL
LIB RRF
OPT LIS
ORG RGORG
JMP PLAYRV
JMP RNDXYV
JMP CKOBSV
JMP MANDSV
JMP START1
JMP START2
JMP TDISP
FDB MANLP1
FDB LLPIC
*
*SOUNDS
*
PDSND FCB $EE,$02,$08,$11,$01,$20,$17,0 PLAYER DEATH
ST1SND FCB $F0,$01,$10,$28,0 START 1
ST2SND FCB $F0,$01,$10,$25,0 START 2
WVSND FCB $E0,$1D,$04,$0E,0 WAVE END
LASSND FCB $D0,$01,$08,1,0 LASER SOUND
*
*GAME START
*
START2 LDA #2
BRA SST0
STRTX JMP SUCIDE
START1 LDA #1
SST0 LDY #HCK2+1345
TST STATUS
BPL STRTX
LDB COINSL+1 CHECK FREEBY
ANDB #$F
CMPB #9
BNE SST00 NO FREE PLAY
STA CREDIT
SST00 CMPA CREDIT
BHI STRTX INSUFFICIENT FUNDS
STA PLRCNT MAKE APPROPRIATE SOUND
CLR BUNITS
CLR CUNITS
LDB #8
JSR AUD GAMES PLAYED
LDU #$D015
NEGA
ADDA #$9A
ADDA CREDIT
DAA
STA CREDIT
LDX #CREDST
JSR WCMOSA
LDA PLRCNT
SUBA #2
LDD #ST1SND
BCS SST01
LDD #ST2SND
SST01 JSR SNDLD
CLRA
CKS11 ADDA ,U ADD NEXT BYTE
LEAU $8,U NEXT ONE
CMPU #$EAB1
BLO CKS11
STA -1345,Y STORE
LDA #$7F
STA STATUS
JSR SCRCLR
LDX #PLDATA
SST1 CLR ,X+
CMPX #PLDEND
BNE SST1
LDX #NSHIP GET # OF SHIPS
JSR RCMOSA
JSR NEWBCH IN BINARY PLEASE
STA ZP1LAS
LDA #1
STA CURPLR
LDA #1
STA ZP1WAV
STA PCFLG
LDX #REPLAY
JSR RCMOSA
CLRB
LSRA
RORB
LSRA
RORB
LSRA
RORB
LSRA
RORB
STD REPLA
STD ZP1RP+1
JSR GETWV
LDX #PLDATA
SSTRAN LDA ,X+
STA PLDLEN-1,X
CMPX #ZP1END
BNE SSTRAN
LDA PLRCNT
DECA
BNE PLSTRT
CLR ZP2LAS NO PLAYER 2
PLSTRT LDA #$7F
STA STATUS
JSR PLINDX
DEC PLAS,X
JSR SCRCLR
JSR GNCIDE
LDX [ACTIVE] REINIT PROC STRUCT IF NO COINS
BNE PLS0
JSR PINIT
MAKP PLS0
JMP EXECV
PLS0 JSR CRINIT
JSR EXINIT
JSR OINIT
JSR GTWCOL GET WALL COLOR
JSR P1SW
LDA PIA3 COCKTAIL??
BPL PLS000 NO
LDA CURPLR PLAYER 2?
DECA
BEQ PLS000 NO
JSR P2SW
PLS000 JSR TDISP
JSR COLST
CLR RIPFLG
LDA PCFLG
BNE PLS00C
JSR WVMESS
BRA PLS0A NO DEATH.. NO MESSIE POOH
PLS00C LDD ZP1SCR+1
BNE PLS0C NOT GAME START
LDA #$11
STA TEXCOL
LDA #113
JSR WRD5V COPYRIGHT MESSAGE
BRA PLS0D
PLS0C JSR WVMESS
PLS0D CLR PCFLG
LDA PLRCNT
DECA
BEQ PLS0A 1 PLAYER GAME
LDA PSTCOL
STA TEXCOL
LDB CURPLR
LDA #103
JSR WRD7V
NAP 115,PLS0B PLAYER UP MESSAGE
PLS0B CLR TEXCOL
LDB CURPLR
LDA #103
JSR WRD7V ERASE MESSAGE
PLS0A JSR PLRES
JSR PLINIT
CLR PCRAM+6
CLR CRAM+6
JSR HULKST
JSR BRNST
JSR TANKST
JSR HUMST
JSR PSINIT
JSR RINIT
JSR ROBOFF
LDA #8
STA PSTREF DOUBLE REFRESH RATE
MAKP PSTRPC REFRESH POSTS
JSR PSTON
JSR CRINIT
JSR CIRCST
JSR SQST
LDA #$19
STA STATUS
LDA BRNCNT BRAIN WAVE???
BEQ PLS00 NO
MAKP TRANST TRANSPORT EM
NAP 150,PLS1
PLS00 JMP APPEAR
PLS1 JSR PAPPR PLAYER APPEAR
JSR PSTON ON POSTS
NAP 06,PLS1A
PLS1A JSR PDAPPR DIAG PLAYER APPEAR
NAP 4,PLS2
PLS2 JSR ROBON
MAKP LSPROC
MAKP COLCHK
CLR STATUS
NAP 12,PLS3
PLS3 JSR ROBON TURN THEM ON
JSR PSTON
NAP 10,PLS4
PLS4 JSR ROBON
JSR PSTON
LDA #4
STA PSTREF STD REFRESH RATE
CLR TEXCOL OFF CPM
LDA #113
JSR WRD5V
JSR WVMESS ON WAVE #
LDX #$20FB COPIERS TAKE NOTE:
LDU #HIDTAB HIDDEN COPY RIGHT HERE
HIDLP LDA ,U+
EORA #$5A
BEQ HIDEND
JSR PR35V
BRA HIDLP
HIDEND JMP GEXEC
FCC ' (C) 1982 WILLIAMS ELECTRONICS INC. '
*
*MAKE YOUR ROBOTS APPEAR
*PD=CNT,PD2=PTR,PD4=REFPTR,PD6=REF LIM
*
APPEAR LDU CRPROC
CLR PD,U
LDX #RPTR
STX PD2,U
LDX RPTR
STX PD4,U
STX PD6,U
APL LDA #1
PSHS A 1/FRAME
APL1 LDX PD2,U GET INDEX
LDX ,X
BEQ AP3 ALL DONE
JSR APCENT GET CENTER
LDA PD,U
ANDA #3
CMPA #3
BNE AP1
JSR HAPST
BRA AP2
AP1 JSR APST
AP2 STX PD2,U
AP3 INC PD,U
LDA PD,U
CMPA #32
BLS AP4
LDY PD6,U EXPAND REFRESH LIST
BEQ APX1
LDY ,Y
BEQ APX1 DONE
STY PD6,U
AP4 DEC ,S
BNE APL1
PULS A
BSR APREF
NAP 1,APL
APX1 PULS A
NAP 2,APX2 LET EVERYONE FINISH
APX2 BSR ROBON TURN EVERYONE ON
NAP 10,PLS1
*
*REFRESH APEAREES
*
APREF PSHS X
LDA #4 4 PER FRAME
STA XTEMP
LDX PD4,U
APRL CMPX PD6,U
BNE APR1
LDX #RPTR
BRA APRX
APR1 JSR DMAON
APRX LDX ,X
DEC XTEMP
BNE APRL
STX PD4,U
PULS X,PC
*
*ON ROBOTS
*
ROBON LDX RPTR
BEQ ROBONX
ROBON1 JSR DMAON
LDX ,X
BNE ROBON1
ROBONX RTS
*
*ON POSTS
*
PSTON LDX PPTR
BEQ PSTONX
PSTON1 LDA PSTCOL
JSR OPON
STX [OBJID,X]
PSTONL LDX ,X
BNE PSTON1
PSTONX RTS
*
*OFF POSTS
*
PSTOFF LDX PPTR
BRA ROBOF0
*
*OFF ROBOTS
*
ROBOFF LDX RPTR
ROBOF0 BEQ ROBOFX
ROBOF1 LDD OBJX,X
LDY OPICT,X
JSR PCTOFF
LDX ,X
BNE ROBOF1
ROBOFX RTS
*
*APPEAR CENTER CALCULATE
*X=OBJ, STORES CENT-CENTMP
APCENT PSHS D,U
LDU OPICT,X X CENTER
LDB OBJW,U
LDA OBJX,X
ASLA
BCC APC1
LDA #$FF
APC1 MUL
ADDA OBJX,X
STA CENTMP
LDB OBJH,U
LDA OBJY,X
MUL
ADDA OBJY,X
STA CENTMP+1
PULS D,U,PC
*
*PLAYER DIAGONAL APPEAR
*
PDAPPR LDX #PLOBJ
LDY OPICT,X
LDA OBJH,Y
PSHS A
DPAPP1 LDA ,S
ADDA PX+1
DECA
STA CENTMP+1
CLRA
JSR DAPST
COMA
JSR DAPST
LDA ,S
SUBA #3
STA ,S
BPL DPAPP1
PULS A,PC
*
*SUPER PLAYER APPEAR
*
PAPPR LDX #PLOBJ
LDY OPICT,X
LDA OBJH,Y
PSHS A
PAPPR1 LDA ,S
ADDA PX+1
DECA
STA CENTMP+1
JSR APST VERTS
DEC ,S
BNE PAPPR1
LDA OBJW,Y
STA ,S
PAPPR2 LDA ,S
ADDA PX
DECA
STA CENTMP
JSR HAPST
DEC ,S
BNE PAPPR2
PULS A,PC
*
*GET WALL COLOR
*
GTWCOL JSR PLINDX
LDU #WCTAB
LDA PWAV,X
DECA
GTWL CMPA #9
BLS GTW1
SUBA #10
BRA GTWL
GTW1 LEAU A,U
LDA ,U
STA WALCOL
LDA 10,U
STA PSTCOL
LDB 20,U
LDX PSTP1
ABX
STX PSTANI POST IMAGE
LDA 30,U
STA LASCOL
RTS
*WAVE COLOR TABLES
WCTAB EQU *
FCB $22,$55,$11,$EE,$77,$33,$44,$88,$00,$CC
*POST COLOR TABLES
FCB $FF,$EE,$BB,$DD,$EE,$FF,$11,$BB,$DD,$AA
*POST IMAGES
FCB $00,$10,$20,$30,$40,$50,$70,$80,$00,$60
*LASER COLOR
FCB $99,$00,$99,$66,$99,$99,$99,$11,$AA,$99
*CHECK END OF WAVE
WVCHEK LDA ROBCNT
ADDA CIRCNT
ADDA ENFCNT
ADDA BRNCNT
ADDA TNKCNT
ADDA SQCNT
RTS
*
*GAME EXEC
*
GEXEC LDU CRPROC
LDA #18
STA PD,U
CLR SCRFLG
GEXEC0 BSR WVCHEK
BNE GEXEC1
JSR PLINDX
GEXX INC PWAV,X
BNE GEXX1
INC PWAV,X
GEXX1 INC PLAS,X
LDD #WVSND
JSR SNDLD
JSR GETWV
JSR GNCIDE
LDA #$7F
STA STATUS TURN EVERYTHING OFF
JSR SCRCLR
JSR RMST DO MARQUEE EFFECT
JMP PLSTRT
GEXEC1 LDA PIA2
CMPA #$58
BNE NORIPP
JSR RIPV
NORIPP DEC PD,U
BNE GEXECX
LDA #15
STA PD,U
LDA ROBCNT TOO MANY ROBOTS
CMPA #30
BHS GEXECX
LDD #$FFFE
TST SCRFLG
BNE GEXEC2
LDD #$FEFC BONE HIM FOR STALLING
GEXEC2 ADDA RMXSPD
CLR SCRFLG
CMPA #1
BGE GEXEC3
LDA #1
GEXEC3 STA RMXSPD
ADDB ROBSPD
CMPB RMXSPD
BGE GEXEC4
LDB RMXSPD
GEXEC4 STB ROBSPD
GEXECX LDA GAMTIM
INCA
CMPA #150 1/4 SEC. CTS
BLO GEXX2
LDB #6 HIT THE TIMER
JSR AUD1
CLRA
GEXX2 STA GAMTIM
NAP 15,GEXEC0
*
*PLAYER RESTORE
*
PLRES JSR PLINDX
LEAX PENEMY,X
LDU #ELIST
PLRES1 LDA ,X+
STA ,U+
CMPU #ELEND
BNE PLRES1
JSR PLINDX
LDA PWAV,X
CMPA #4
BHI PLRESX NO BOZO
LDB PLAS,X
STD XTEMP SAVE WAVE,SHIPS
TSTB
BEQ BOZO LAST SHIP
CMPA #2
BHI PLRESX NOT WAVE 1,2
LDX #NSHIP
JSR RCMOSA
JSR NEWBCH
DECA
CMPA XTEMP+1
BLS PLRESX NOT DOWN SHIPS
BOZO LDA XTEMP
LDX #BOZOTB-4
ASLA
ASLA
LEAX A,X
LDD ,X++
STA CDPTIM
STB ENSTIM
LDD ,X
STA ROBSPD
STB RMXSPD
PLRESX RTS
*
*BOZO TABLE: FOR ALL YOU BOZOS OUT THERE
*
BOZOTB EQU *
FCB 38,96,30,15 WAVE 1
FCB 38,96,25,12 2
FCB 36,48,20,10 3
FCB 30,30,15,7 4
*
*SAVE PLAYER STATE
*
PLSAV JSR PLINDX
LEAX PENEMY,X
LDU #ELIST
PLSAV1 LDA ,U+
STA ,X+
CMPU #ELEND
BNE PLSAV1
RTS
*
*GET NEXT WAVE
*
GETWV LDX #GA1 GET DIFFICULTY
JSR RCMOSB
JSR BCDBIN
JSR PLINDX
CMPB #5 EASY SET UP??
BHS GTWV0X NO
LDA PWAV,X
CMPA #14 WAVE 14 OR GREATER
BLO GTWV01 NO
LDB #5
GTWV01 CMPA #5 WAVE 5 OR GT?
BLO GTWV0X NO
LDA PLAS,X 4 OR MORE LASERS LEFT?
CMPA #3
BLO GTWV0X NO
LDB #5 YES SCREW HIM
GTWV0X SUBB #5
STB XTEMP+1 SAVE SIGN
BPL GETWV0
NEGB
GETWV0 STB XTEMP MAGNITUDE
LDB PWAV,X
LDU #WVTAB+2
LEAX PENEMY,X
GETWV1 CMPB #40
BLS GETWV2
SUBB #20
BRA GETWV1
GETWV2 EQU *
CMPU #WVCNT
BLO GETWV3
LEAU -3,U NO MAX/MINS
LDA B,U
BRA GETWV9
GETWV3 LDA B,U
PSHS D
LDB -2,U GET FRACTION
ANDB #$1F
LDA XTEMP
MUL MULTIPLY BY MAGNITUDE
PULS A
MUL
ADCA #0 ROUND
LDB XTEMP+1
EORB -2,U PLUS OR MINUS ????
PULS B
BPL GETWV4
NEGA
BEQ GETWV4 ZERO CASE
ADDA B,U
BCS GETWV5 O.K.
BRA GETWV6 UNDERFLOW GET MIN
GETWV4 ADDA B,U
BCS GETWV8 OVERFLOW GET MAX
GETWV5 CMPA -1,U CHECK MIN
BHS GETWV7
GETWV6 LDA -1,U
GETWV7 CMPA ,U
BLS GETWV9
GETWV8 LDA ,U
GETWV9 STA ,X+
LEAU 43,U
CMPU #WVTEND-1
BLO GETWV2
CLR ,X+ GET TANK COUNT
RTS
HIDTAB FCB $01,$19,$06,$7A,$6B,$63,$62,$68,$7A,$0D,$13,$16,$16,$13,$1B
FCB $17,$09,$7A,$1F,$16,$1F,$19,$67,$7A,$13,$14,$19,$67,$5A
WVTAB EQU *
FCB $8E,10,20 SIGN/DELTA,MIN,MAX
FCB 20,15,15,15,15,15,15,15,15,15,14,14,14,14,14,13,13,13,13,13 ROBSPD
FCB 14,14,14,14,14,14,13,13,13,13,13,13,12,12,12,12,12,12,15,12
FCB $8E,03,10
FCB 09,07,06,05,05,05,05,04,04,04,04,04,04,04,04,04,04,04,04,04 RMXSPD
FCB 04,04,04,04,04,04,03,03,04,03,03,03,03,03,03,03,03,03,04,03
FCB $0E,$08,12
FCB 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10 ENFNUM
FCB 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11
FCB $8E,13,40
FCB 30,28,26,24,22,20,18,18,16,14,14,14,14,14,14,14,14,14,14,14 ENSTIM
FCB 15,15,15,15,15,15,15,15,15,14,14,14,14,14,14,14,14,14,14,14
FCB $8E,12,40
FCB 30,28,26,24,30,20,18,16,18,25,12,12,12,25,25,12,12,12,18,20 CDPTIM
FCB 14,14,14,14,14,25,14,14,18,25,12,12,12,12,25,12,12,12,18,20
FCB $8E,05,09
FCB 08,08,07,07,07,07,07,06,06,06,06,05,05,05,05,05,05,05,05,05 HLKSPD
FCB 05,05,05,05,05,05,05,05,05,05,05,05,05,05,05,05,05,05,05,05
FCB $8E,25,80
FCB 64,64,64,64,64,40,40,38,38,38,38,38,38,38,38,38,36,36,36,36 BSHTIM
FCB 32,32,32,32,32,32,32,30,30,30,30,30,25,25,25,25,25,25,25,25
FCB $8E,6,10
FCB 08,08,08,08,08,07,07,07,07,07,07,07,07,07,07,06,06,06,06,06 BRNSPD
FCB 06,06,06,06,06,06,06,06,06,06,06,06,06,06,06,06,06,06,06,06
FCB $8E,20,40
FCB 32,32,32,32,32,32,32,30,30,30,30,30,30,28,28,28,28,28,28,28 THKSHT
FCB 30,30,30,30,30,30,28,28,28,28,28,26,26,26,26,26,24,24,24,24
FCB $0E,$A0,$FF
FDB $B0B0,$B0B0,$B0B0,$B0B0,$B0B0,$B0B0,$B0B0,$B0B0,$B0B0,$B0B0 SHLSPD
FDB $B8B8,$B8B8,$B8B8,$B8B8,$B8B8,$C0C0,$C0C0,$C0C0,$C0C0,$C0C0
FCB $8E,$0C,$30
FDB $1010,$1010,$1010,$1010,$1010,$1010,$1010,$0F0F,$0F0F,$0F0F TDPTIM
FDB $0E0E,$0E0E,$0E0E,$0E0E,$0E0E,$0E0E,$0E0E,$0E0E,$0E0E,$0E0E
FCB $0E,$28,$44
FDB $3232,$3232,$3232,$3232,$3232,$3232,$3838,$3838,$3838,$3838 SQSPD
FDB $3838,$3838,$3838,$3838,$3C3C,$3C3C,$3C3C,$3C3C,$3C3C,$3C3C
WVCNT EQU *
FCB 15,17,22,34,20,32,00,35,60,25,35,00,35,27,25,35,00,35,70,25 ROBCNT
FCB 35,00,35,00,25,35,00,35,75,25,35,00,35,30,27,35,00,35,80,30
FCB 05,15,25,25,20,25,00,25,00,20,25,00,25,05,20,25,00,25,00,20 PSTCNT
FCB 25,00,25,00,20,25,00,25,00,20,25,00,25,00,15,25,00,25,00,15
FCB 01,01,02,02,15,03,04,03,03,00,03,03,03,05,00,03,03,03,03,08 MOMCNT
FCB 03,03,03,03,25,03,03,03,03,00,03,03,03,03,00,03,03,03,03,10
FCB 01,01,02,02,00,03,04,03,03,22,03,03,03,05,00,03,03,03,03,08 DADCNT
FCB 03,03,03,03,00,03,03,03,03,25,03,03,03,03,00,03,03,03,03,10
FCB 00,01,02,02,01,03,04,03,03,00,03,03,03,05,22,03,03,03,03,08 KIDCNT
FCB 03,03,03,03,01,03,03,03,03,00,03,03,03,03,25,03,03,03,03,10
FCB 00,05,06,07,00,07,12,08,04,00,08,13,08,20,02,03,14,08,03,02 HLKCNT
FCB 08,15,08,13,01,08,16,08,04,01,08,16,08,25,02,08,16,08,06,02
FCB 00,00,00,00,15,00,00,00,00,20,00,00,00,00,20,00,00,00,00,20 BRNCNT
FCB 00,00,00,00,21,00,00,00,00,22,00,00,00,00,23,00,00,00,00,25
FCB 00,01,03,04,01,04,00,05,05,01,05,00,05,02,01,05,00,05,05,02 CIRCNT
FCB 05,00,05,06,01,05,00,05,05,01,05,00,05,02,01,05,00,05,05,01
FCB 00,00,00,00,00,00,10,00,00,00,00,12,00,00,00,00,12,00,00,00 SQCNT
FCB 00,12,00,07,00,00,12,01,01,01,01,13,01,02,02,02,14,02,01,01
WVTEND EQU *
*
*PLAYER INITIALIZE
*
PLINIT LDX #PLOBJ
LDD #MANDP1
STD OPICT,X
STD OLDPIC,X
CLR PLAIMC ANI COUNT+NUM
CLR PLAIMN
LDD #PISD
STD PLAIMB ANI BASE
LDD #PCOORD
STD OBJX,X
STA OX16,X
CLR OX16+1,X
STB OY16,X
CLR OY16+1,X
CLR LCNT
CLR PCFLG
CLR SAVCNT MAN SAVED COUNTER
CLR BCMCNT
CLR SPKCNT
CLR BRNFLG
CLR ENFCNT
LDA #2
STA TNKSPD
CLR SHLCNT
RTS
*
*PLAYER MOTION+OUTPUT
*
PLAYRV LDA STATUS
BITA #$01
BEQ PL00
RTS
PL00 TSTA
BPL PL01
LDA ATRSW2 FONY SWITCH
BRA PL02
PL01 LDA PIA2
PL02 LDX #PLOBJ
LDU #PITAB
ANDA #$F
ASLA
ASLA
LEAU A,U
LDD ,U GET YOUR TABLE ENTRY FOR SWITCH POSITION
ADDB PY16
CMPB #YMIN
BLO PL1
CMPB #YMAX-11
BHI PL1
STB PY16
PL1 CLRB
ASRA
RORB
ADDD PX16
CMPA #XMIN
BLO PL2
CMPA #XMAX-3
BHI PL2
STD PX16
PL2 LDD 2,U
BEQ PLXX NO IMAGE CHANGE
CMPD PLAIMB BASE CHANGE?
BEQ PL3
STD PLAIMB
CLR PLAIMN
CLR PLAIMC
PL3 LDB PLAIMC COUNT READY?
BNE PL10
LDU PLAIMB
LDA PLAIMN
LDB A,U
BNE PL4
CLR PLAIMN END OF SEQUENCE
LDB ,U
PL4 INC PLAIMN
DECB
ASLB
ASLB
CLRA
ADDD #MANLP1
STD PPICT
PL10 LDA PLAIMC
INCA
CMPA #2
BLO PL11
CLRA
PL11 STA PLAIMC
PLXX RTS
*
*PLAYER IMAGE TABLE
*DX,DY,IMAGE SEQ
*B0=U,B1=D,B2=L,B3=R
PITAB FDB 0,0 0000
FDB $00FF,PISU 0001 U
FDB $0001,PISD 0010 D
FDB $0,0 0011
FDB $FF00,PISL 0100 L
FDB $FFFF,PISL 0101 U+L
FDB $FF01,PISL 0110 D+L
FDB 0,0 0111
FDB $0100,PISR 1000 R
FDB $01FF,PISR 1001 U+R
FDB $0101,PISR 1010 D+R
FDB 0,0 1011
FDB 0,0 1100
FDB 0,0 1101
FDB 0,0 1110
FDB 0,0 1111
*
*PLAYER ANIMATION TABLE
*
PISL FCB 1,2,1,3,0
PISR FCB 4,5,4,6,0
PISD FCB 7,8,7,9,0
PISU FCB 10,11,10,12,0
*
*CHECK FOR OBSTACLE
*CARDBOARD BOX
*D= SCREEN ADDR X,Y
*X=OBJ,U=LIST TO CHECK AGAINST
*RET NE IF BLOCKED, EQ OTHERWISE
CKOBSV PSHS U,D
PSHS D
ADDD [OPICT,X]
PSHS D
BRA CKOBLP
CKOB1 LDD OBJX,U
CMPA ,S
BHS CKOBLP
CMPB 1,S
BHS CKOBLP
ADDD [OPICT,U]
CMPA 2,S
BLS CKOBLP
CMPB 3,S
BLS CKOBLP
PSHS U IS IT ITSELF??
CMPX ,S++
BNE CKOBX NOPE
CKOBLP LDU ,U
BNE CKOB1
CKOBX LEAS 4,S CLEAN UP YOUR MESS
PULS U,D,PC
*
*CHECK PLAYER COLLISION
*
COLCHK LDA #1
STA PCFLG
LDD PX PLAYER
LDU POLDPC
LDX #RPTR ROBOTS
JSR COL0
BNE PLEND DIE
LDD PX
LDU POLDPC
LDX #PPTR POSTS (FATAL OBSTACLES)
JSR COL0
BNE PLEND
LDD PX
LDU POLDPC
LDX #OPTR MOTION OBJECTS
JSR COL0
BNE PLEND
LDD PX HUMANS
LDU POLDPC
LDX #HPTR
JSR COL0
CLR PCFLG
NAP 1,COLCHK
*
*PLAYER DEAD
*
PLEND LDD #PDSND
JSR SNDLD
LDA #$1B
STA STATUS
JSR GNCIDE
LDB #7
JSR AUD1 MEN PLAYED
JSR COLST START YOUR COLORS
JSR PDEATH GO FOR IT...
JSR PLINDX
LDA ZP1LAS
ORA ZP2LAS
BNE PLEND1
LDA #$FF
STA STATUS
LDD #$1C0A GAME OVER MESSAGE
LDX #$3C7E
JSR BLKCLR
LDA #40
LDB #$AA
STB TEXCOL
JSR WRD7V
NAP 120,ENDPRC
PLEND1 JSR PLINDX
LDA RMXSPD-ELIST+PENEMY,X RESTORE MAX SPEED
STA RMXSPD
CMPA ROBSPD
BLS PLEND2
STA ROBSPD
PLEND2 CLRA
LDB ENFCNT CONVERT LEFTOVER ENFORCERS INTO CIRCLES
BEQ PLE2C
PLE0A SUBB #4
BMI PLE1A
INCA
BRA PLE0A
PLE1A TSTA
BNE PLE2A
TST CIRCNT
BNE PLE2A
INCA
PLE2A ADDA CIRCNT
CMPA CIRCNT-ELIST+PENEMY,X NO MORE THAN YOU STARTED WITH
BLS PLE2B
LDA CIRCNT-ELIST+PENEMY,X
PLE2B STA CIRCNT
PLE2C JSR PLSAV
PLEND3 JSR PLINDX
LDB PLAS,X
BNE PLE1B
LDD #$1C20 PLAYER N GAME OVER MESSAGE
LDX #$3C77
JSR BLKCLR
LDA #75
LDB #$AA
STB TEXCOL
LDB CURPLR
JSR WRD7V
NAP $60,PLE1B
PLE1B LDA CURPLR
PLE1 EORA #3
JSR PLDX
LDB PLAS,X
BEQ PLE1
STA CURPLR
JMP PLSTRT
*
*RANDOM X,Y->D ON PLAYFIELD FOR OBJECT X
*
RNDXYV EQU *
LDD [OPICT,X]
PSHS D
LDA #XMAX-XMIN
SUBA ,S+
JSR RANDU
ADDA #XMIN-1
TFR A,B
LDA #YMAX-YMIN
SUBA ,S+
JSR RANDU
ADDA #YMIN-1
EXG A,B
RTS
*LASER START
LSPROC CLR PD,U PREV STATE
CLR PD1,U TIMECOUNT
LSPLP LDA STATUS
BPL LSP0
LDD ATRSW2
BRA LSP00
LSP0 LDA PIA2
LDB PIA3
LSP00 LSRB
RORA
LSRB
RORA
ANDA #$F0
LDB PD,U
STA PD,U
CMPB PD,U
BNE LSPX
INC PD1,U
LDB PD1,U
CMPB #2
BEQ LSP1
ANDB #$7
BNE LSPNAP
LSP1 LDB LCNT
CMPB #4
BHS LSPX1
TST FREE
BEQ LSPNAP NO MORE PROCS
LSRA
LSRA
PSHS A
LSRA
ADDA ,S+
LDY #LTAB
LEAY A,Y
CMPA #LTEND-LTAB
BHS LSPNAP DUD
LDX ,Y
BEQ LSPNAP DUD
CLRA
JSR MKPROC
TFR X,U
JSR GETOBJ
STX PD,U
LDD 4,Y
ADDD #LLPIC
STD OPICT,X
STD OLDPIC,X
LDD PX
ADDA 2,Y
STA OX16,X
ADDB 3,Y
STB OY16,X
INC LCNT
LDD #LASSND
JSR SNDLD
BRA LSPNAP
LSPX CLR PD1,U
BRA LSPNAP
LSPX1 DEC PD1,U
LSPNAP NAP 1,LSPLP
*LASER TABLE: ROUTINE,XY OFFSET,OBJECT
LTAB EQU *
FDB 0,0,0 0000 CASE
FDB ULASR,$02FF,4 0001
FDB DLASR,$0204,4 0010
FDB 0,0,0 0011
FDB LLASR,$0004,0 0100
FDB ULLASR,$0000,12 0101
FDB DLLASR,$0004,8 0110
FDB 0,0,0 0111
FDB RLASR,$0204,0 1000
FDB URLASR,$0200,8 1001
FDB DRLASR,$0204,12 1010
LTEND EQU *
*RT. LASER
RLASR LDX PD,U
LDA OX16,X
ADDA #3
CMPA #XMAX-2
BHI RLDIE
STA OX16,X
LDD #$0100
JSR LASOUT
NAP 1,RLASR
*LEFT LASER
LLASR LDX PD,U
LDA OX16,X
SUBA #3