forked from historicalsource/defender
-
Notifications
You must be signed in to change notification settings - Fork 0
/
AMODE1.SRC
executable file
·1312 lines (1285 loc) · 27.3 KB
/
AMODE1.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
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
* TEXT EQUATES
WTEXTB EQU $C002
WNUMBB EQU $C00E
LANDV EQU $C0DD
MUTV EQU LANDV+2
SWRMPV EQU MUTV+2
BOMBV EQU SWRMPV+2
SWARMV EQU BOMBV+2
BAITV EQU SWARMV+2
CREDV EQU BAITV+2
SCANV EQU CREDV+2
ELECV EQU SCANV+2
HOFV EQU $C0FD
INIT$V EQU HOFV+2
HALLDV EQU INIT$V+2
HALENV EQU HALLDV+2
* STILOB PICT,X,Y CREATES AN OBJECT WITH NO VELOCITY AT X,Y
STILOB MACRO \0,\1,\2
JSR GETOB GET AN OBJECT
LDD #0 VELOCITY
STD OXV,X
STD OYV,X
LDD #\1 X
STD OX16,X
LDD #\2
STD OY16,X
LDD #\0 PICTURE
STD OPICT,X
STX OPTR AND APPEND TO LIST
ENDM
NAPP MACRO \0,\1
LDA #\0
LDX #\1
JMP SLEEPP
ENDM
* BSO BONER DOES NOT ALLOW MACRO AND SYMBOL FOR LJSR SO CHANGED TO MLJSR
MLJSR MACRO \0,\1
JSR LJSRV
FDB \1
FCB \0
ENDM
*SAM EQUATES
BLKLEN EQU 14
INITS EQU $A000
PNUMB EQU INITS+6
INITDS EQU PNUMB+2
SCOREN EQU INITDS+4
ORG THTAB
*
*** SAMRAM
*
TEMPA RMB 1
TEMPB RMB 1
XTEMP$ RMB 2
CURSR$ RMB 2
CUREND RMB 2
LGOFLG RMB 1
LGOPTR RMB 2
DEFSPT RMB 2
DEFDPT RMB 2
WX RMB 2
DEFRPT RMB 2
DCOLOR RMB 1
LEN RMB 1
PIX RMB 1
ENTFLG RMB 1
INIDIR RMB 1
INITN RMB 1
PSCORE RMB 2
STALT RMB 1
UDDEL RMB 1
UDCNT RMB 1
UDSFLG RMB 1
SPOINT RMB 2
OCRED RMB 1
ICREDF RMB 1
FIRFLG RMB 1
FIRCNT RMB 1
*** LEDRAM
LASPRC RMB 2 LASER PROCESS
MANPTR RMB 2 MAN OBJECT
SHIPTR RMB 2 PLAYER OBJECT
ENEMYP RMB 2 BAD GUY OBJECT
MANFRF RMB 1 FRAMES OF FREE FALL
P500OB RMB 2 500 PT. OBJECT
OTABPT RMB 2 TABLE OF OBJECTS POINTER
LSTATE RMB 2 EXTRA STATE FOR THE LASER ROUTINE
TEXPTR RMB 2
TEXTMP RMB 2
ORG $B300 USE TERRAIN AREA
DEFDSC RMB 4 "DEFENDER" WHOLE DESCRIPTER
DEFRAM RMB BLKLEN*15 "DEFENDER" OBJECT BLOCKS
DEFPIC RMB 4*15 "DEFENDER" PICTURE DESCRIPTERS
DEFBLK RMB 24*60 "DEFENDER" DATA
* EQUATES
XMAN EQU $1E00
YMAN EQU $DB00
XSHIP EQU $0800
YSHIP EQU $5000
AMTYPE EQU 0
ORG $C000
JMP HALLOF VECTORS
JMP SCNR
*
*HALL OF FAME ENTRY
*
HALLOF JSR GNCIDE KILL ALL PROCESSES
LDA #$FF SYSTEM STATUS
STA STATUS
JSR STINIT REINITIALIZE STARS
LDA CREDIT INITIALIZE OLD CREDITS
STA OCRED
CLRA
STA ICREDF CLEAR CREDIT INCREASE FLAG
STA ENTFLG CLEAR ENTRY FLAG
LDA PWRFLG CHECK FOR POWER ON INITIALIZATION
LBEQ AMODE$ YES?, SKIP TO WILLI PAGE
NEWP CREDS,AMTYPE TURN ON CREDITS
LDY #.P1SCR START WITH PLAYER 1
LDA #1
HALL1 STA PNUMB PLAYER NUMBER
STY PSCORE PLAYER SCORE ADDRESS
LDX #THSTAB+12*7 TODAYS EIGHTH SCORE
JSR CPXCY COMPARE
LBHS HALL12 NOT GOOD ENOUGH?, NEXT PLAYER
INC ENTFLG SET ENTRY FLAG
JSR SCRCLR
LDA PNUMB
DECA
BNE HALL1A
JSR P1SW UPRIGHT SCREEN
BRA HALL1B
HALL1A JSR P2SW
HALL1B LDB #$85 LIGHT BLUE LETTERS
STB PCRAM+1
LDA #$FE TODAYS SOUND - PHANTOM
LDX #THSTAB TODAYS TOP SCORE
JSR CPXCY COMPARE
BHS HALL2 NOT THE BEST?
LDA #$FD HIGH SCORE SOUND - TOCCATA
HALL2 LDX #$CC02 SOUND PIAS
LDB #$FF CLEAR LINES
JSR STBXBV
LDB #$E4 SELECT ORGAN
JSR STBXBV
HALL3 DECB DELAY
BNE HALL3
LDB #$FF CLEAR LINES
JSR STBXBV
TFR A,B
JSR STBXBV PLAY SOUND
LDU #PLYR1-2 "PLAYER 1" OR "PLAYER 2"
LDA PNUMB
ASLA
LEAU A,U
LDX #$3E38 SCREEN ADDRESS
MLJSR 2,WTEXTB WRITE TO SCREEN
LDU #HOFV HALL OF FAME ENTRY INSTRUCTIONS
LDX #$1458 SCREEN ADDRESS
MLJSR 2,WTEXTB WRITE TO SCREEN
LDD #$412F INITIALIZE INTIALS
STD INITS
LDA #$40
STD INITS+2
STD INITS+4
JSR HOFIN DISPLAY INITIALS
LDA #40 FIRST INITIAL STALL TIME
STA STALT
NEWP HOFST,AMTYPE TURN ON STALL TIMER
NEWP HOFBL,AMTYPE TURN ON BLINK
NEWP HOFUD,AMTYPE TURN ON UP DOWN STICK
CLR INITN ZERO INITIALS COUNTER
JSR HOFUL UNDERLINE INITIALS
*FIRE SWITCH
HALL3A CLRA
STA FIRCNT ZERO SWITCH OPEN COUNTER
STA FIRFLG CLEAR SWITCH OPEN FLAG
HALL3B NAPP 1,HALL4 SLEEP 1
HALL4 LDA PIA21 CHECK FIRE SWITCH
BITA #1
BNE HALL5 CLOSED?
TST STALT CHECK STALL TIMER
BEQ HALL6 OUT OF TIME?, ENTER HIM
INC FIRCNT ADVANCE SWITCH OPEN COUNTER
LDA FIRCNT CHECK IF TIME
CMPA #5
BNE HALL3B NO?, GO TO SLEEP
STA FIRFLG YES?, SET SWITCH OPEN FLAG
BRA HALL3B GO TO SLEEP
HALL5 CLR FIRCNT ZERO SWITCH OPEN COUNTER
TST FIRFLG CHECK SWITCH OPEN FLAG
BEQ HALL3B NOT SET?, GO TO SLEEP
LDA #20 RESET STALL TIMER
STA STALT
INC INITN NEXT INITIAL
JSR HOFUL UPDATE UNDERLINES
LDA INITN CHECK IF LAST
CMPA #3
BNE HALL3A WAIT FOR NEXT FIRE SWITCH
HALL6 JSR GNCIDE KILL PROCESSES
LDX #THSTAB+12*6 TODAYS SEVENTH SCORE
LDU #THSTAB-12 ABOVE TODAYS TOP SCORE
JSR HOFAS ADD SCORE TO LIST
LDX #CRHSTD+12*7 ALL TIME EIGHTH SCORE
BSR CPXCY COMPARE
BHS HALL12 NOT THAT GOOD?, NEXT PLAYER
LDX #CRHSTD+12*6 ALL TIME SEVENTH SCORE
LDU #CRHSTD-12 ABOVE ALL TIME TOP SCORE
JSR HOFAS ADD SCORE TO LIST
HALL12 LDY #.P2SCR PLAYER TWO
LDA PNUMB
INCA
CMPA #3 CHECK IF DONE
LBNE HALL1
TST ENTFLG CHECK IF ENTRY WAS MADE
BNE HALL13
NAPP $FF,HALL13 NO ENTRY, SLEEP 4 SECS
HALL13 JMP HALDIS ATTRACT MODE NOW
*
*COMPARE NIBBLES AT X BLOCK 0 WITH SCORE AT Y
*
CPXCY PSHS D,X SAVE REGISTERS
JSR RCMOSD READ NIBBLES AT X TO D
CMPD 1,Y A DIFFERENCE?
BNE CPXY1
JSR RCMOSA CHECK NEXT NIBBLES
CMPA 3,Y
CPXY1 PULS X,D,PC RESTORE REGISTERS, RETURN
*
*HALL OF FAME INITIALS DISPLAY
*
HOFIN LDX #$46AC TOP LEFT OF INITIALS
LDD #$1408 SIZE OF INITIALS
JSR BLKCLR ERASE BLOCK
LDU #INIT$V INITIALS TEXT VECTOR
MLJSR 2,WTEXTB WRITE TO SCREEN
RTS
*
*HALL OF FAME - UNDERLINE INITIALS
*
HOFUL CLR TEMPA INITIAL COUNTER
LDX #$45B7 STARTING ADDRESS
HOFUL1 LDU #$1111 NORMAL COLOR
LDA TEMPA
CMPA INITN IS THIS ACTIVE INITIAL
BNE HOFUL2
LDU #$DDDD BLINK COLOR FOR ACTIVE INITIAL
HOFUL2 LDD #$0400 LENGTH OF UNDER LINE
HOFUL3 STU D,X DRAW UNDER LINE
DECA
BNE HOFUL3
INC TEMPA NEXT INITIAL
LEAX $800,X CENTER SPACING BETWEEN UNDERLINES
CMPX #$5DB7 DONE?
BNE HOFUL1 NO?, NEXT UNDERLNE
RTS
*
*HALL OF FAME - ADD SCORE AND INITIALS X=BOTTOM OF LIST
* TO LIST U=TOP OF LIST
*
HOFAS STU XTEMP$ SAVE TOP OF LIST ADDRESS
LDY PSCORE GET PLAYER SCORE ADDRESS
HOFAS1 BSR CPXCY COMPARE
BHS HOFAS2
BSR HOFMD MOVE SCORE DOWN ONE STEP
LEAX -12,X NEXT SCORE UP
CMPX XTEMP$ ABOVE TOP SCORE?
BHI HOFAS1
HOFAS2 LEAX 12,X ONE STEP DOWN
LDD 1,Y STORE SCORE
JSR WCMOSD
LDA 3,Y
JSR WCMOSA
LDU #INITS GET INITIALS ADDRESS
HOFAS3 LDA ,U GET INITIAL
JSR WCMOSA STORE IT
LEAU 2,U NEXT INITIAL
CMPU #INITS+6 DONE?
BNE HOFAS3
RTS
*
*HALL OF FAME - MOVE A SCORE AND INITIALS
* DOWN ONE STEP X=OLD ADDRESS
*
HOFMD PSHS X SAVE OLD POSITION
HOFMD1 JSR RCMOSD GET 4 NIBBLES
LEAX 8,X MOVE POINTER TO DESTINATION
JSR WCMOSD STORE 4 NIBBLES
LEAX -24,X CHECK IF DONE
CMPX ,S
BEQ HOFMD2
LEAX 12,X BACK FOR NEXT NIBBLES
BRA HOFMD1
HOFMD2 PULS X,PC RESTORE STACK, RETURN
*
*HALL OF FAME STALL TIMER
*
HOFST DEC STALT COUNT DOWN STALL TIMER
NAPP 60,HOFST SLEEP 1 SECOND
*
*HALL OF FAME COLOR BLINK
*
HOFBL LDA PCRAM+$D GET BLINKING COLOR
BNE HOFBL1 ON?
LDA PCRAM+1 MAKE SAME AS NORMAL COLOR
BRA HOFBL2
HOFBL1 CLRA TURN OFF
HOFBL2 STA PCRAM+$D CHANGE COLOR
NAPP 15,HOFBL BLINK PERIOD
*
*HALL OF FAME UP DOWN STICK HANDLER
*
HOFUD CLR INIDIR ZERO INITIALS DIRECTION
HOFUD1 LDA PIA21 GET PIA DOWN SIDE
BITA #$80 CHECK DOWN
BEQ HOFUD2
LDA #$FF DOWN DIRECTION
BRA HOFUD4
HOFUD2 LDA PIA31 GET PIA UP SIDE
BITA #1 CHECK UP
BEQ HOFUD3
LDA #1 UP DIRECTION
BRA HOFUD4
HOFUD3 CLR INIDIR NO CHANGE
BRA HOFUD8 SLEEP
HOFUD4 CMPA INIDIR CHECK IF KNOWN
BNE HOFUD9 NOT KNOWN?
DEC UDCNT KNOWN?, COUNT DELAY
BNE HOFUD8 STILL COUNTING?, SLEEP
*CHANGE LETTER
HOFUD5 LDX #INITS GET ACTIVE INITIALS ADDRESS
LDB INITN
ASLB
ABX
LDA ,X GET ACTIVE INITIAL
ADDA INIDIR CHANGE UP/DOWN
CMPA #$3F TOO LOW?
BNE HOFUD6
LDA #$5A BACK TO Z
HOFUD6 CMPA #$5B TOO HIGH?
BNE HOFUD7
LDA #$40 BACK TO SPACE
HOFUD7 STA ,X SAVE NEW INITIAL
JSR HOFIN UPDATE INITIALS DISPLAY
LDA UDDEL GET LAST DELAY
LSRA DECAY IT
ADDA #5 TOP SPEED LIMIT
STA UDDEL SAVE NEW DELAY
STA UDCNT INITIALIZE COUNTER
HOFUD8 NAPP 1,HOFUD1 SLEEP 1
*NEW DIRECTION
HOFUD9 STA INIDIR NEW DIRECTION
LDA #55 PREINITIAL DELAY
STA UDDEL
LDA #3 FIRST LETTER DELAY
STA UDCNT
BRA HOFUD8 SLEEP 1
*
*CHECK BYTE
*
FDB $FFFF
*
*HALL OF FAME DISPLAY
*
HALDIS CLR HSRFLG CLEAR HIGH SCORE RESET FLAG
JSR GNCIDE KILL ALL PROCESSES
JSR DEFNNN EXPAND "DEFENDER" DATA
JSR SCRCLR CLEAR ACTIVE SCREEN
JSR P1SW ALWAYS UPRIGHT
CLR PCRAM+1 BLACK LETTERS
NEWP CREDS,AMTYPE TURN ON CREDITS
JSR SCORES DISPLAY SCORES
LDU #HALLDV GET HEADINGS MESSAGE VECTOR
LDX #$3854 SCREEN ADDRESS
MLJSR 2,WTEXTB WRITE TO SCREEN
*UNDERLINE HEADINGS
LDU #$1111 UNDERLINE COLOR
LDX #$1E7B LEFT ADDERSS
LDD #$5F00 OFFSET OF RIGHT END, RIGHT UNDERLINE
HALD1 STU D,X
CMPA #$41 OFFSET OF LEFT END, RIGHT UNDERLINE
BNE HALD2
LDA #$1F OFFSET OF RIGHT END, LEFT UNDERLINE
HALD2 DECA
BPL HALD1
*
LDA #$2F SLASH FOR PSEUDO-WORDS
STA PNUMB+1 RANK NUMBER
STA INITDS+3 INITIALS
STA SCOREN+6 SCORE
LDU #HALENV GET DATA LINE MESSAGE VECTOR
LDX #$1886 SCREEN ADDRESS
STX SPOINT
LDX #THSTAB TODAYS GREATEST TABLE ADDRESS
STX XTEMP$
BSR HALDT DISPLAY TABLE
LDX #$5986 SCREEN ADDRESS
STX SPOINT
LDX #CRHSTD ALL TIME GREATEST TABLE ADDRESS
STX XTEMP$
BSR HALDT DISPLAY TABLE
LDA #$3F YELLOW "DEFENDER"
STA PCRAM+$C
LDY #DEFDSC MAKE WHOLE DEFENDER DESCRIPTER
LDD #$3C18
STD ,Y
LDD #DEFBLK
STD 2,Y
LDD #$3038 SCREEN ADDRESS
JSR CWRIT WRITE TO SCREEN
NEWP COLR,AMTYPE LASER COLOR LETTERS
LDA #60 DELAY TIMER
STA STALT
HALD3 TST ICREDF CHECK FOR INCREASE IN CREDITS
BNE HALD4 YES?, GIVE INSTRUCTIONS
TST HSRFLG CHECK FOR HIGH SCORE RESET
LBNE HALDIS YES?, HALL OF FAME AGAIN
DEC STALT TIME OUT?
BEQ HALD4
NAPP 10,HALD3 NOPE, NOT YET
HALD4 BRA LEDRET ON TO INSTUCTIONS
*
*HALL OF FAME DISPLAY ONE TABLE U=DATA LINE MESSAGE VECTOR
* SPOINT=SCREEN ADDRESS XTEMP$=TABLE DATA ADDRESS
*
HALDT LDA #$31 INITIALIZE RANK NUMBER
STA PNUMB
HALDT1 CLRA CLEAR LEADING ZERO NOT FLAG
LDY #SCOREN SCORE PSEUDO WORD ADDRESS
LDX XTEMP$ GET TABLE DATA POINTER
HALDT2 JSR LDBXBV GET SCORE NIBBLE
LEAX 1,X ADVANCE DATA POINTER
ANDB #$F REMOVE GARBAGE
BNE HALDT3 NOT ZERO?, DISPLAY
TSTA CHECK LEADING ZERO NOT FLAG
BNE HALDT3 SET?, DISPLAY ZERO
LDB #$40 REPLACE LEADING ZERO WITH SPACE
BRA HALDT4 DISPLAY
HALDT3 INCA SET LEADING ZERO FLAG NOT FLAG
ADDB #$30 CHANGE TO ASCII NUMBER
HALDT4 STB ,Y+ STORE IN PSEUDO WORD
CMPY #SCOREN+6 CHECK IF SCORE DONE?
BNE HALDT2
JSR RCMOSD GET FIRST 2 INITIALS
STD INITDS STORE IN PSEUDO WORD
JSR RCMOSA GET LAST INITIAL
STA INITDS+2 STORE IN PSEUDO WORD
STX XTEMP$ SAVE DATA POINTER
LDX SPOINT GET SCREEN ADDRESS
MLJSR 2,WTEXTB WRITE DATA LINE TO SCREEN
LEAX 10,X MOVE SCREEN POINTER ONE LINE DOWN
STX SPOINT SAVE SCREEN POINTER
INC PNUMB ADVANCE RANK NUMBER
LDA PNUMB CHECK IF DONE
CMPA #$39
BNE HALDT1
RTS
*
*INSTRUCTION PAGE
*
LEDRET JSR GNCIDE KILL ANY EXCESS
JSR SCINIT GET THE WORLD,SCANNER AND TERRAIN
LDA #$D9 SET STATUS
STA STATUS
JSR SCORES
NEWP CREDS,AMTYPE TURN ON CREDITS
JSR BORDER
LDX #TEXTAB+2
STX TEXPTR
NEWP COLR,AMTYPE
NEWP CBOMB,AMTYPE
NEWP TIECOL,AMTYPE
NEWP SCPROC,AMTYPE
NEWP TEXTP,AMTYPE
STILOB ASTP1,XMAN,YMAN ASTRONAUT
LDD #$6666
STD OBJCOL,X
STX MANPTR SAVE HIS OBJECT
STILOB PLAPIC,XSHIP,YSHIP PLAYER
LDD #$0
STD OBJCOL,X LEAVE SHIP
STX SHIPTR SAVE IT
JSR GETOB GET AN OBJECT
LDD #LNDP1
STD OPICT,X
LDD #$1DA0
STD OX16,X
LDD #$4000
STD OY16,X
LDD #$A0
STD OYV,X
LDD #0
STD OXV,X MAKE HIM DESCEND.
LDD #$4433
STD OBJCOL,X BLIP
JSR APVCT MAKE HIM MATERIALIZE
STX ENEMYP
NAPP $E6,AMODE1 WAIT FOR HIM TO REACH MAN
AMODE1 LDD #$FF50 GOING UP!
LDX ENEMYP GET THE GUYS BLOCK
STD OYV,X
LDX MANPTR
STD OYV,X HIS TOO.
NAPP $A0,AMODE2 WAIT FOR HIM TO BE IN LINE WITH THE LASER.
AMODE2 NEWP LASR$,AMTYPE
STX LASPRC SAVE NEW PROCESS ID.
NAPP $15,AMODE3
SCINIT LDA #$FF
STA STATUS
JSR OINIT INITIALIZE OBJEX PLEASE
JSR SCRCLR
LDD #0
STD BGL
STD BGLX
MLJSR 0,BGI
JSR CRINIT
LDA #$DB THIS IS THE STATUS
STA STATUS WHY??? WHO KNOWS!
LDX #$1030 CENTER
STX PLAXC FOR SCANNER
RTS
KLASUB LDX LASPRC TIME TO KILL THE LASER
LDU LSTATE KILL A LASER CODE
CLRA
AMODE6 STA 0,U
LEAU $100,U
CMPU PD,X
BLS AMODE6
JMP KILL KILL THE LASER PROCESS
AMODE3 BSR KLASUB
LDX ENEMYP TIME TO BLOW UP THE ENEMY
JSR KILLOB
JSR XSVCT BLOW UP THE BASTARD
LDX SHIPTR GET THE SHIP
LDD #$0040 X
STD OXV,X
LDD #$00D4 Y
STD OYV,X MOVE TO THE MAN
LDA #$2D 30 FRAMES TILL INTERSECTION
STA MANFRF COUNT IN RAM
LDX MANPTR MANS POINTER
LDD #0 NO Y VEL
STD OYV,X FOR EUGENE.
AMODE4 LDX MANPTR GET THE MANS PTR
LDD OYV,X GET HIS VELOCITY
ADDD #0008 MAKE IT FASTER
STD OYV,X AND PUT IT BACK.
DEC MANFRF ONE LESS FRAME
BEQ AMODE5
NAPP 2,AMODE4
*
* INTERSECTION OF SHIP AND MAN
*
AMODE5 STILOB C5P1,$1DFF,$9000 500 PTS.
LDD #$0
STD OBJCOL,X
STX P500OB
LDD #0
LDU #$0C0
LDX SHIPTR
STD OXV,X
STU OYV,X DOWN TO TERRAIN
LDX MANPTR
LDD #$1E80
STD OX16,X HYPER THE MAN
LDD #$A2E0
STD OY16,X
STU OYV,X
NAPP $50,AMODE7
AMODE7 LDX P500OB
LDD #$E000
STD OY16,X MOVE THE 500 DOWN
LDD #$1C00
STD OX16,X BOTH COORDS
LDX MANPTR
LDD #0
STD OYV,X STOP THE MAN
LDX SHIPTR GET THE SHIP
LDD #PLBPIC
STD OPICT,X TURN AROUND
LDD #$FFC0
STD OXV,X
LDD #$FE80
STD OYV,X MOVE SHIP BACK
NAPP $60,AMODE8
AMODE8 LDX SHIPTR
LDD #PLAPIC
STD OPICT,X
LDD #0
STD OXV,X
STD OYV,X
LDX P500OB
LDD OBJX,X GET COORD
JSR KILLOB TRASH THE OBJECT
JSR OFF66 AND REMOVE CORPSE
*
* TIME TO START FORMING THE TABLE.
*
LDU #ENMYTB TABLE OF OBJECTS.
AMOD12 JSR GETOB OBJECT PLEASE*****************BSO BONER***
FCB $EC,$C9,$00,$0C (LDD OLEN,U)GET THE OBJECT PICTURE
STD OPICT,X
FCB $EC,$C9,$00,$24 (LDD 3*OLEN,U)
STD OBJCOL,X BLIP
LDD #$1F00 LARGE X
STD OX16,X
LDD #$A000 LOW Y
STD OY16,X
LDD #$FF40 NEG Y V
STD OYV,X
LDD #0 NO X
STD OXV,X
JSR APVCT MAKE IT APPEAR
STU OTABPT SAVE OUR TABLE POINTER
STX ENEMYP SAVE THE GUYS POINTER.
NAPP $5F,AMOD10 WAIT FOR IN LINE WITH LASER
AMOD10 NEWP LASR$,AMTYPE
STX LASPRC SAVE THE PROCESS POINTER.
NAPP $17,AMOD11
AMOD11 JSR KLASUB TRASH THE LASER
LDX ENEMYP GET THE GUY
JSR KILLOB FREE IT
JSR GETOB GET IT BACK
JSR XSVCT BYE
LDU OTABPT GET THE POINTER BACK****************BSO BONER*******
FCB $EC,$C9,$00,$18 (LDD 2*OLEN,U) GET THE X****BSO BONER*******
STD OX16,X
LDD ,U++ MOVE TO NEXT AND FETCH Y
STD OY16,X
LDD #0
STD OYV,X
STD OXV,X NO MOVEMENT PLEASE
JSR APVCT APPEARANCE HERE PLEASE.
STU OTABPT
NAPP $20,BMODE2
BMODE2 LDX TEXPTR
LEAX 2,X
STX TEXPTR PUT THE TEXT DOWN
NAPP $20,BMODE3
BMODE3 LDU OTABPT
CMPU #OTABND END
LBNE AMOD12
NAPP $FF,AMOD13
AMOD13 NAPP $FF,AMODE$ DO IT AGAIN!
LASR$ LDX SHIPTR GET SHIP
LDX OBJX,X GET SCREEN COORDS
LASRR LEAX $704,X
STX PD,U
STX PD+2,U
STX LSTATE
LAS0 LDA #4
LDX PD,U
LDB #$11
LAS1 STB ,X
LEAX $100,X
DECA
BNE LAS1
LDB #$99
STB ,X
STX PD,U
LDY FISX
CMPY #FISEND-3
BLO LAS2
LDY #FISTAB
LAS2 LDX PD+2,U
LDA #3
LAS3 LDB ,Y+
STB ,X
LEAX $100,X
DECA
BNE LAS3
STY FISX
STX PD+2,U
LDX LSTATE
LAS4 CLR ,X
LEAX $100,X
STX LSTATE
NAPP 1,LAS0
TEXTP LDY #TEXTAB START OF TABLE****************BSO BONER**********
TEXTP1 FCB $EE,$A9,$00,$0E (LDU TENT,Y) GET MESSAGE VECTOR**********
LDX ,Y++ GET ADDRESS*******************BSO BONER**********
MLJSR 2,WTEXTB WRITE THIS ONE.
STY TEXTMP SAVE PTR
NAPP 6,TEXTP2
TEXTP2 LDY TEXTMP GET IT BACK
CMPY TEXPTR ENOUGH???
BNE TEXTP1 NOPE...DO ANOTHER
BRA TEXTP AND CONTINUE
*
*WILLIAMS PAGE
*
AMODE$ JSR GNCIDE
CLR ICREDF CLEAR CREDIT INCREASE FLAG
LDA #$FB
STA STATUS
JSR SCRCLR
CLR MESPT
LDD #$FFFF
STD NUMBER
NEWP COLR,AMTYPE
NEWP TIECOL,AMTYPE
LDA #$3F
STA PCRAM+$C
WILLI JMP LOGO SAM STUFF
*
*WILLIAMS LOGO
*
LOGO JSR DEFNNN EXPAND "DEFENDER" DATA
LDA #3 #BYTES PER SCREEN
STA LGOFLG
LDX #LGOTAB
STX LGOPTR
LOGO0 LDA LGOFLG
STA TEMPB
LDY LGOPTR
LOGO1 LDA ,Y+
CMPA #$AA DATA OR INSTRUCTION?
BLS LOGO3
*INSTRUCTION
COMA
BEQ LOGO1 NULL BYTE
DECA
BNE LOGO10 QUIT
LDD ,Y++ HYPER
STD CURSR$
CLRA
BRA LOGO7
*DATA
LOGO3 ASLA MOVE CURSER
BCC LOGO4
DEC CURSR$
LOGO4 ASLA
BCC LOGO5
INC CURSR$
LOGO5 ASLA
BCC LOGO6
DEC CURSR$+1
LOGO6 ASLA
BCC LOGO7
INC CURSR$+1
LOGO7 STA TEMPA SAVE DATA
*WRITE TO SCEEN
LDD CURSR$
LSRA
TFR D,X
LDB ,X SAVE OTHER PIXEL
BCS LOGO8
ORB #$F0 LEFT
BRA LOGO9
LOGO8 ORB #$F
LOGO9 STB ,X
LDA TEMPA GET DATA
BNE LOGO3 OTHER PIXEL
DEC TEMPB
BNE LOGO1 NEXT BYTE
STY LGOPTR SLEEP
LDA #2
LDX #LOGO0
JSR SLEEPP
LOGO10 STX CUREND SAVE END OF CURSER
LDA #3 SLOW?
CMPA LGOFLG
BNE LOGO1$ NOPE
LDA #10 NOPE MAKE FAST
STA LGOFLG
NEWP PRES,AMTYPE CREATE THE NEXT ONE.
LOGO1$ LDX #LGOTAB
STX LGOPTR
BRA LOGO0 CONTINUE
*
*ELECTRONICS PRESENTS
*
PRES NEWP DEFEND,AMTYPE CREATE DEFEND.
PRES1 LDX #$3258
LDU #ELECV
MLJSR 2,WTEXTB
LDA #5
LDX #PRES1
JSR SLEEPP
*
*DEFENDER
*
DEFEND NAPP $30,DEFEN$ START APPEARS
DEFEN$ LDD #DEFPIC INITIALIZE DESCRIPTER POINTER
STD DEFSPT
LDD #DEFBLK INITIALIZE DATA POINTER
STD DEFDPT
LDD #0 ZERO BGL
STD BGL
LDD #$0C00 INITIALIZE 16 BIT X COORINATE
STD WX
LDD #DEFRAM INITIALIZE OBJECT POINTER
STD DEFRPT
*START LOOP
DEF1 LDX DEFRPT
LDY DEFSPT
LDD #$040C WIDTH, HEIGHT
STD ,Y
LDD DEFDPT DATA ADDRESS
STD 2,Y
ADDD #4*24
STD DEFDPT
STY OPICT,X DESCRIPTER ADDRESS
LDD WX
STD OX16,X 16 BIT X COORDINATE
ADDD #$100
STD WX
LDD #$9800 16 BIT Y COORDINATE
STD OY16,X
JSR APVCT START APPEAR
LEAX BLKLEN,X NEXT OBJECT
STX DEFRPT
LEAY 4,Y NEXT DECSRIPTER
STY DEFSPT
CMPY #DEFPIC+4*15 DONE?
BNE DEF1
*
DEF2 NAPP $2E,DEF33
DEF33 LDX #DEFDSC MAKE WHOLE DEFENDER DESCRIPTER
LDD #$3C18
STD ,X
LDD #DEFBLK
STD 2,X
NEWP DEF50,AMTYPE START WHOLE DEFENDER RESTORE
NAPP $28,DEF44
DEF44 NEWP CBOMB,AMTYPE
*
*COPYRIGHT
*
COPYRT LDU CUREND GET END OF "WILLIAMS" CURSER
LDY #CPRTAB TABLE START
LDX #$3BD0 TOP LEFT
CPR1 LDD ,Y++
STD XTEMP$ SAVE DATA
LDA #1 BIT POINTER
CPR2 CLRB
BITA XTEMP$
BEQ CPR3
LDB #$10
CPR3 BITA XTEMP$+1
BEQ CPR4
ORB #1
CPR4 STB ,X+
ASLA
BNE CPR2
LEAX $F8,X
CMPY #CPREND
BNE CPR1
*"WILLIAMS" CHECK
LDX #PCRAM GET COLOR ZERO ADDRESS
LDB LOGO8+1 GET WILLIAMS COLOR NUMBER
LDA B,X GET WILLIAMS COLOR
COMA FULL RED PRESENT?
ANDA #7
BNE WILCK1 NO?, BOGUS
LDX #WCURS!.$C35A CONFUSION
LDD #WCURS!.$3CA5 MORE CONFUSION
STU D,X TRANSFER CURSER
WILCK1 LDA #1 SET POWER FLAG
STA PWRFLG
NEWP CREDS,AMTYPE TURN ON CREDITS
LDA #60 DELAY TIMER
STA STALT
CPR55 TST ICREDF CHECK FOR INCREASE IN CREDITS
LBNE LEDRET YES?, GIVE INSTRUCTIONS
DEC STALT TIME OUT?
BEQ CPR56
NAPP 10,CPR55 NOPE, NOT YET
CPR56 JMP HALDIS DISPLAY HALL OF FAME
*
*"DEFENDER" WHOLE WRITING ROUTINE
*
DEF50 LDY #DEFDSC DESCRIPTER
LDD #$3090 SCREEN ADDRESS
JSR CWRIT
TST RAMALS CHECK ONE SIZE
BNE DEF51
TST RAMALS+RAMSIZ CHECK ANOTHER TO BE SURE
BNE DEF51
NEWP WILLIR,AMTYPE APPEAR DONE, QUICK RSTORE LOGO
JMP SUCIDE
DEF51 NAPP 1,DEF50 SLEEP 1, REFRESH
*
*"DEFENDER" DATA EXPANDER
*
DEFNNN LDX #DEFBLK INITIALIZE SERIAL POINTER
LDY #DEFDAT DATA TABLE START
CLRA
STA PIX LEFT PIXEL FIRST
STA LEN ZERO LENGTH ACCUMULATOR
DEFX1 LDA ,Y GET LEFT DATA NIBBLE
LSRA
LSRA
LSRA
LSRA
BSR DEFX2 DECODE
LDA ,Y+ GET RIGHT DATA NIBBLE
ANDA #$F
BSR DEFX2 DECODE
CMPY #DEFDEN DONE?
BNE DEFX1
*
DEFX2 BITA #$C DIRECT OR EXTENDED
BNE DEFX3
*EXTENDED
ADDA LEN INCLUDE UPPER BITS
ASLA MULT BY 4
ASLA
STA LEN SAVE LENGTH
RTS NEXT NIBBLE
*DIRECT
DEFX3 PSHS A
ANDA #3 EXTRACT LENGTH OF LINE
ADDA LEN INCLUDE EXTENDED BITS
STA LEN
PULS A
ANDA #$C EXTRACT COLOR
LSRA
LSRA
LDU #DCOLRS-1 COLOR TABLE START
LDB A,U
STB DCOLOR
CMPX #DEFBLK+24*60 CHECK FOR NEXT LINE
BLO DEFX4
LEAX 1-24*60,X NEXT LINE
DEFX4 LDA PIX CHECK RIGHT OR LEFT PIXEL
BEQ DEFX5 LEFT FIRST?
LDA ,X RIGHT FIRST
ANDA #$F0 SAVE OLD LEFT
STA ,X
LDA DCOLOR
ANDA #$F RIGHT COLOR ONLY
ORA ,X
STA ,X SAVE NEW RIGHT PIXEL
LDA DCOLOR
BRA DEFX7
DEFX5 COM PIX
LDA DCOLOR MAIN LINE LOOP
DEFX6 STA ,X SAVE NEW LEFT AND RIGHT
DEC LEN COUNT DOWN LENGTH
BMI DEFX8 LINE DONE?
DEFX7 LEAX 24,X
DEC LEN COUNT DOWN LENGTH
BPL DEFX6 LINE NOT DONE?
CLR PIX LAST RIGHT
DEFX8 CLR LEN ZERO LENGTH ACCUMULATOR
RTS
*
*CREDITS
*
CREDS LDB CREDIT GET CREDITS
BEQ CREDS2 NO CREDITS?, NO DISPLAY
CMPB OCRED CHECK IF COIN ADDED
BLS CREDS1
STB OCRED YES?, UPDATE OLD CREDITS
INC ICREDF SET INCREASE CREDIT FLAG
CREDS1 LDU #CREDV MESSAGE VECTOR
LDX #$28E5 SCREEN ADDRESS
MLJSR 2,WTEXTB WRITE TO SCREEN
CLRA NO HIGH
LDX #$48E5 PLACE FOR NUMBERS
MLJSR 2,WNUMBB WRITE IT
CREDS2 NAPP 16,CREDS SLEEP 16
*
*WILLIAMS LOGO FAST RESTORE
*
WILLIR LDA #$FF FAST RATE
STA LGOFLG
NAPP 2,WILR1 SLEEP 2
WILR1 LDA #10 BACK TO OLD RATE
STA LGOFLG
JMP SUCIDE
*
*PLAYER SCORES
*