This repository has been archived by the owner on Apr 24, 2024. It is now read-only.
forked from historicalsource/defender
-
Notifications
You must be signed in to change notification settings - Fork 0
/
DEFB6.SRC
executable file
·2253 lines (2253 loc) · 34.8 KB
/
DEFB6.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
*
*UFO PROCESS START
*PD=OBJECT,PD2=SHOT TIMER
*
UFOST NEWP UFOLP,STYPE
LEAU ,X
OBI UFOP1,UFOKIL,$3333
STX PD,U
STU OBJID,X
LDD SEED
ANDA #$1F
ADDD BGL
STD OX16,X
LSRB
ADDB #YMIN
STB OY16,X
CLRA
CLRB
STD OYV,X
STD OXV,X
LDA #8
STA PD2,U INIT SHOT TIMER
BSR UFONV0
JMP APVCT
*UFO PROCESS
UFOLP LDX PD,U
LDD OPICT,X
CMPD #NULOB
BEQ UFO3
DEC PD2,U
BNE UFO1
LDA UFSTIM
JSR RMAX
STA PD2,U
JSR SHOOT
BEQ UFO1
LDD #USHSND
JSR SNDLD
UFO1 LDU OPICT,X
LEAU OBJL,U CYCLE IMAGE
CMPU #UFOP3
BLS UFO2
LDU #UFOP1
BSR UFONV
UFO2 STU OPICT,X
UFO3 NAP 6,UFOLP
*
*UFO VELOCITY
*
UFONV LDA SEED
CMPA UFOSK
BLS UFONVX
UFONV0 LDD #$4001
STD XTEMP
LDD OX16,X
SUBD PLABX
BMI UFONV1
NEG XTEMP
UFONV1 ADDD #20*32 X CLOSE?
CMPD #40*32
BLS UFONV3 YES, DONT SEEK
LDB XTEMP
SEX
ADDD PLAXV
STD OXV,X
UFONV3 LDA OY16,X
SUBA PLAYC
BMI UFONV4
NEG XTEMP+1
UFONV4 ADDA #10
CMPA #20 Y CLOSE?
BLS UFONVX YES, QUIT
CLRB
LDA XTEMP+1
ADDD PLAYV
ASRA DIVIDE BY 2
RORB
STD OYV,X
UFONVX RTS
*UFOKILL
UFOKIL DEC UFOCNT
KILP 0120,UFHSND
RTS
*
*PROBE START
*A=#
PRBST STA XTEMP
PRBS1 OBI PRBP1,PRBKIL,$CCCC
JSR RAND
LDD HSEED
ANDA #$3F
ADDA #$10
STD OX16,X INIT X
LSRB
ADDB #YMIN
STB OY16,X INIT Y
LDB SEED
ANDB #$3F
ADDB #-$20
PRBS2 SEX
STD OXV,X
LDB LSEED
ANDB #$7F
SUBB #$40
SEX
BMI PRBS3 MIN YV
ORB #$20
BRA PRBS4
PRBS3 ANDB #$DF
PRBS4 STD OYV,X
JSR APVCT
DEC XTEMP
BNE PRBS1
PRBSTX RTS
*
*KILL PROBE
*
PRBKIL KILO 0210,PRHSND
LDA #6
JSR RMAX
LEAY ,X
JSR MMSW
DEC PRBCNT
RTS
*
*RANDOM VELOCITY
*X=OBJECT
RANDV JSR RAND
LDB SEED
SEX
ASLB
ROLA X2
STD OYV,X
LDB LSEED
ANDB #$3F
ADDB #-$20
SEX
STD OXV,X
RTS
*
*MAKE A MINI SWARMER
*Y=CENTER,A=#
*
MMSW PSHS D,X,Y,U
STA XTEMP
MMSLP LDA SWCNT
INCA
CMPA #20
BHI MMSWX TOO MANY GUYS
STA SWCNT
NEWP MSWM,STYPE
LEAU ,X
OBI SWPIC1,MSWKIL,$2424
LDD OX16,Y
STD OX16,X
LDD OY16,Y
STD OY16,X
STX PD,U
STU OBJID,X
BSR RANDV
LDD HSEED
ANDB SWAC
STB PD2,U ACCEL
ANDA #$1F
STA PTIME,U
LDA SWSTIM
JSR RMAX
STA PD4,U
STX OPTR
DEC XTEMP
BNE MMSLP
MMSWX PULS D,X,Y,U,PC
*
*MINI SWARM KILL
*X=OBJECT
MSWKIL DEC SWCNT
JSR KILOFF
PSHS X
JSR KILLOP
PULS X
LDD OX16,X
SUBD #$40
STD OX16,X
LDD OY16,X
SUBA #2
STA OY16,X
LDU #SWXP1
STU OPICT,X
JSR XSVCT
LDD #$0115
JSR SCORE
LDD #SWHSND
JMP SNDLD
*
*MINI SWARM PROCESS
*PD=OBJECT,PD2 ACCELERATION,PD4=SHOT TIMER
*
MSWM LDX PD,U
LDB SWXV
LDY PLABX
CMPY OX16,X
BHS MSWM2
NEGB
MSWM2 SEX
STD OXV,X X VELOCITY
BRA MSWL
MSWLP LDB PD2,U
LDX PD,U
LDA PLAYC GET Y ACCEL
CMPA OY16,X
BHI MSWM3
NEGB
MSWM3 SEX
ADDD OYV,X
CMPD #$0200
BLT MSWM4
LDD #$0200
MSWM4 CMPD #-$200
BGT MSWM5
LDD #-$200
MSWM5 STD OYV,X
*DAMPING
COMA
COMB
ASLB
ROLA
ASLB
ROLA
TFR A,B
SEX
ADDD OYV,X
STD OYV,X
*RANDOM FACTOR
LDB SEED
ANDB #$1F
ADDB #-$10
SEX
ADDD OYV,X
STD OYV,X
LDD PLABX PAST HIM?
SUBD OX16,X
ADDD #150*32
MSP CMPD #300*32 WAY PAST?
BHI MSWM GO BACK + GIT IM
*FIRE?
MSWMF DEC PD4,U
BNE MSWL
JSR SWBMB BOMB GUY
MSWL NAP 3,MSWLP
*
*SWARM BOMB
*
SWBMB PSHS X
LDD PLABX
SUBD OX16,X
EORA OXV,X
BMI SWBX NOT HEADED FOR PLAYER
LEAY ,X
SHL FBOUT,BMBP1,BKIL
BEQ SWBX
LDD OXV,Y
ASLB
ROLA
ASLB
ROLA
ASLB
ROLA
STD OXV,X
LDD #SWSSND SWARMER SOUND
JSR SNDLD
CLRB
LDA PLAYC
SUBA OY16,X
SWB1 ASRA
RORB
ASRA
RORB
ASRA
RORB
ASRA
RORB
ASRA
RORB
STD OYV,X
SWBX LDA SWSTIM
JSR RMAX
STA PD4,U
PULS X,PC
*
*ASTRONAUT PROCESS
*WALK ON TERRAIN
*PD =CURRENT INDEX TO TLIST
*
ASTRO LDX PD,U
LEAX 2,X
CMPX #TLIST+32
BLO ASTRO1
LDX #TLIST
ASTRO1 STX PD,U
LDX ,X
BEQ ASTX NOONE THERE
LDD OBJX,X ON SCREEN?
BEQ ASTX NOPE
LDD OCVECT,X
CMPD #ASTKIL
BNE ASTX CAPTURED
LDD OPICT,X
CMPD #ASTP2
BHI ASTR WALKING TO RIGHT
*WALKING TO LEFT
LDA SEED
CMPA #8
BLS ASTRX1 TURN AROUND
JSR GETALT
ADDA #4
CMPA #$E8
BLS ASTL1
LDA #$E8
ASTL1 LDB #1
CMPA OY16,X
BEQ ASTL3
BHI ASTL2
NEGB
ASTL2 ADDB OY16,X
STB OY16,X UP/DOWN
ASTL3 LDU OPICT,X TOGGLE IMAGE
LEAU OBJL,U
CMPU #ASTP2
BLS ASTLX2
ASTLX1 LDU #ASTP1
ASTLX2 LDB #-$20 MOVE LEFT
BRA ASTX1
*WALKING TO RIGHT
ASTR LDA SEED
CMPA #$8
BLS ASTLX1 TURN AROUND
BSR GETALT
ADDA #15
CMPA #$E8
BLS ASTR1
LDA #$E8
ASTR1 LDB #1
CMPA OY16,X
BEQ ASTR3
BHI ASTR2
NEGB
ASTR2 ADDB OY16,X
STB OY16,X
ASTR3 LDU OPICT,X IMAGING
LEAU OBJL,U
CMPU #ASTP4
BLS ASTRX2
ASTRX1 LDU #ASTP3
ASTRX2 LDB #$20
ASTX1 STU OPICT,X
SEX
ADDD OX16,X
STD OX16,X
ASTX NAP 2,ASTRO
*
*GET ALTITUDE
*A=ALT,X=OBJ
*
GETALT PSHS B,X
LDD OX16,X
LSRA
RORB
LSRA
RORB
LSRA
RORB
LSRA
RORB
LSRA
RORB
LSRA
RORB
LDX #ALTBL
LDA D,X
PULS B,X,PC
*
*KILL ASTRO
*X=OBJECT
ASTKIL LDA PCFLG PLAYER?
BEQ ASTK1
CLRA
PULS D,PC IGNORE
ASTK1 BSR ASTCLR
JSR KILOFF
LDD #ASXP1
STD OPICT,X
LDD OX16,X
SUBD #$40
STD OX16,X
JSR XSVCT
LDD #AHSND
JMP SNDLD
AKIL1 LDU OBJID,X
BEQ ASTKIL NOT FALLING
LDA PCFLG
BEQ AKIL10 SHOT
LDD PADDR,U 1ST TIME
CMPD #AFALL2
BEQ AKIL2
LDD #ACSND
JSR SNDLD
PSHS X
NEWP P500,STYPE
LEAY ,X
PULS X
STX PD,Y ASTRO OBJ-500 ROUTINE
AKIL2 LDD #AFALL2
STD PADDR,U
NOKILL CLRA
PULS D,PC
AKIL10 BSR ASTK1
JMP KILLOP
*
*CLEAR ASTRO FROM LIST
*
ASTCLR LEAY ,X
ASTC0 PSHS X,U,A
LDU #TLIST
LDA #64
ASTC1 CMPY ,U++
BEQ ASTC2
DECA
BNE ASTC1
JSR ERROR
ASTC2 CLRD
STD -2,U
DEC ASTCNT
BNE ASTCX
NEWP TERBLO,STYPE BLOW UP TERRAIN
ASTCX PULS X,U,PC,A
*
*TERRAIN BLOW PROCESS
*
TERBLO LDA STATUS
ORA #2
STA STATUS
CLR PD,U LOOP COUNT
JSR MAPCH7
JSR BGERAS
*OFF SCANNER TERRAIN
LDX #STETAB
LDU #0
LDA #64
TBL1 STU [,X++]
DECA
BNE TBL1
TBLP0 LDX OFREE
LDD #TEREX
STD OPICT,X
LDB #2
STB XTEMP
TBLP JSR RAND
ANDA #$3F
ADDD BGL
STD OX16,X
JSR GETALT
STA OY16,X
SUBA #10
JSR XSVCT
DEC XTEMP
BNE TBLP
LDA SEED
ANDA #$1F
LDX #COLTAB
LDA A,X
STA PCRAM
LDD #AHSND LIGHTNING BOLT
JSR SNDLD
LDX #TBL3
LDA #2
TBL2 LDB #8
STB OVCNT PHONY OVERLOAD
JMP SLEEP
TBL3 CLR PCRAM
LDA PD,U GET ITERATION
LSRA
LSRA
LSRA
INCA
JSR RMAX RANDOM SLEEP
LDX #TBL4
BRA TBL2
TBL4 INC PD,U
LDA PD,U
CMPA #16
BNE TBLP0
LDD #TBSND
JSR SNDLD
JMP SUCIDE
*
*250 POINT PROCESS
*PD=ASTRO PROCESS
*
P250 OBI C25P1,NOKILL,$0000
LDD #$0125
BRA P5000
*
*500 POINT PROCESS
*X=EARTHLING OBJECT
*
P500 OBI C5P1,NOKILL,$0000
LDD #$0150
P5000 JSR SCORE
LDY PD,U
LDD PLAXV
STD OXV,X
LDD #0
STD OYV,X
LDA #$11
STA OTYP,X
LDD OX16,Y
STD OX16,X
LDD OY16,Y
BMI P501
ADDD #$1800
BRA P502
P501 SUBD #$2000
P502 STD OY16,X
STX OPTR
STX PD,U OBJECT INDEX
NAP 50,P503
P503 LDX PD,U
JSR KILOFF
JMP SUCIDE
*
*SHOOT AT PLAYER
*X=OBJECT FIRING
*
SHOOT PSHS X
SHL FBOUT,BMBP1,BKIL
BEQ SHOOTX NONE LEFT
LDB SEED
ANDB #$1F
ADDB #-$10
ADDB PLAXC
SUBB OBJX,X
SEX
ASLB
ROLA
ASLB
ROLA
STD OXV,X
LDB SEED REL?
CMPB #120
BLS SHOOT0 NO
LDD PLAXV
ASLB
ROLA
ASLB
ROLA
ADDD OXV,X
STD OXV,X
SHOOT0 LDB LSEED
ANDB #$1F
ADDB #-$10
ADDB PLAYC
SUBB OBJY,X
SEX
ASLB
ROLA
ASLB
ROLA
STD OYV,X
LDA #1 RETURN NE
SHOOTX PULS X,PC
*
*LANDER SHOOT
*
LSHOT DEC PD6,U
BNE LSHTX
LDA LDSTIM
JSR RMAX
STA PD6,U
BSR SHOOT
BEQ LSHTX
LDD #LSHSND
JSR SNDLD
LSHTX RTS
*
*START SCHITZOS
*A=NUMBER
*PD=X
*PD2=SHOT TIMER
*
SCZST PSHS A
STA XTEMP
SCZS0 NEWP SCZ0,STYPE
LEAU ,X
OBI SCZP1,SCZKIL,$CC33
JSR RAND
LDD BGL
SUBD #300*32
STD XTEMP2
LDD HSEED
SUBD XTEMP2
CMPD #600*32
BHS SCZS1
ADDD #$8000
SCZS1 ADDD XTEMP2 AVOID PLAYER
STD OX16,X
LDA SEED
LSRA
ADDA #YMIN
STA OY16,X
CLRD
STD OYV,X
STD OXV,X
LDA SZSTIM
JSR RMAX
STA PD,U
JSR APVCT
STU OBJID,X
STX PD,U
INC SCZCNT
DEC XTEMP
BNE SCZS0
PULS A,PC
*KILL SHITZO
SCZKIL DEC SCZCNT
KILP 0115,SCHSND
RTS
*
*GET TARGET FROM LIST
*RET EQ IF NONE,D=TRG OBJECT
*U=PROCESS
GTARG PSHS X
LDA ASTCNT
BEQ GTX NOBODY LEFT
LDX TPTR
GT1 LEAX 2,X
CMPX #TLIST+64
BLO GT2
LDX #TLIST
GT2 LDD ,X
BNE GT3
CMPX TPTR AROUND ONCE?
BNE GT1
PULS X,PC
GT3 STX TPTR FOUND ONE
STD PD2,U
STX PD4,U
GTX PULS X,PC
*
*START LANDERS
*A=NUMBER
*
LANDST PSHS A
STA XTEMP
LNDST0 TST ASTCNT NO MORE TARGETS
BNE LNDST1
JMP SCZS0
LNDST1 NEWP LANDS0,STYPE
LEAU ,X
OBI LNDP1,LKILL,$4433
JSR RAND
LDD HSEED
STD OX16,X
LDA #YMIN+2
STA OY16,X
LDD LNDYV
STD OYV,X
LDA LDSTIM SHOOTING TIME
JSR RMAX
STA PD6,U
LDA LNDXV
JSR RMAX
TFR A,B
CLRA
BITB #1
BEQ LNS2
COMB
COMA
LNS2 STD OXV,X
STU OBJID,X
JSR APVCT
STX PD,U
BSR GTARG
INC LNDCNT
DEC XTEMP
BNE LNDST0
LNDSTX PULS A,PC
*
*LANDER KIDNAP
*PD=OBJECT,PD2=TARGET,PD4=TLIST INDEX
*PD6=SHOT TIMER
LANDS0 LDX PD,U
LDY PD2,U
LDD [PD4,U] TARGET ALIVE?
BEQ LNDSAA
LDA OCVECT+1,Y
CMPA #ASTKIL!.$FF
BNE LNDSAA ORBIT
LDA OX16,X
ANDA #$FC
STA XTEMP
LDA OX16,Y
ANDA #$FC
CMPA XTEMP CLOSE?
BEQ LANDG0 GET IM
BRA LANDSA
LNDSAA LDA OTYP,X HYPERABLE
ANDA #$FE
STA OTYP,X
JSR GTARG RE:TARGET
LBEQ SCZ00 NO, FREAK
LANDSA JSR GETALT
SUBA #50
SUBA OY16,X
BHI LANDS1
CMPA #-20
BLT LNDS1
CLRA
CLRB
BRA LANDS2
LNDS1 LDD LNDYV
COMA
COMB
BRA LANDS2
LANDS1 LDD LNDYV
LANDS2 STD OYV,X NEW Y VEL
LDD OPICT,X APPEARING?
CMPD #NULOB
BEQ LANDS4
JSR LSHOT
LDU OPICT,X NEW PICT
LEAU OBJL,U
CMPU #LNDP3
BLS LANDS3
LDU #LNDP1
LANDS3 STU OPICT,X
LANDS4 NAP 6,LANDS0
*LETS GET HIM
LANDG0 CLRD
INC OTYP,X DONT HYPER ME
STD OXV,X
STD OYV,X
LDD #LNDP1
STD OPICT,X
LANDG LDX PD,U
LDY PD2,U
LDD [PD4,U]
BEQ LNDSAA DEAD
LDA OCVECT+1,Y
CMPA #ASTKIL!.$FF
BNE LNDSAA TAKEN
LDD OX16,Y
ANDB #$E0
STD XTEMP2
LDD OX16,X
ANDB #$E0
CMPD XTEMP2
BEQ LNDG2
BLT LNDG1
LDB #-$20
BRA LANDG1
LNDG1 LDB #$20
LANDG1 SEX
ADDD OX16,X
STD OX16,X
LNDG2 LDA OY16,Y
SUBA #12
CMPA OY16,X
BEQ LANDG3
LDD LNDYV
BHS LANDG2
COMA
COMB
LANDG2 ADDD OY16,X
STD OY16,X
LNDG20 JSR LSHOT
NAP 1,LANDG
*ARE WE ON HIM?
LANDG3 LDD OX16,X
ADDD #$0040
SUBD OX16,Y
CMPD #$80
BHI LNDG20 NOPE
LDD #LKIL1 CHANGE KILL VECTOR
STD OCVECT,X
LDD LNDYV
COMB
COMA
STD OYV,X SPLIT
STD OYV,Y
LDD #LPKSND
JSR SNDLD
LDD #AKIL1
STD OCVECT,Y
*FLEE
LANDF LDU CRPROC
LDX PD,U
LDA OY16,X
CMPA #YMIN+8
BLS LANDFX ALL DONE
JSR LSHOT
NAP 4,LANDF
*PULL HIM INSIDE
LANDFX LDD #LSKSND
JSR SNDLD
LNDFXA LDX PD,U
LDY PD2,U
LDD [PD4,U]
BNE LNDFX0
JSR KILOFF GIVE UP
DEC LNDCNT
INC LNDRES
JMP SUCIDE
LNDFX0 CLRD
STD OYV,X
STD OYV,Y
LDA OY16,Y
CMPA OY16,X
BLS LNDFX1
DEC OY16,Y
LDA #$12
JSR SNDOUT
NAP 1,LNDFXA
LNDFX1 LEAX ,Y KILL ASTRO
LDD OBJX,Y CENTER EARTHLING BLOW
ADDA #1
STD CENTMP
JSR ASTK1
SCZ00 DEC LNDCNT
INC SCZCNT
LDX PD,U
CLR OTYP,X OK TO HYPER
LDD #SCZP1
STD OPICT,X
LDD #$CC33
STD OBJCOL,X
LDD #SCZKIL
STD OCVECT,X
LDA SZSTIM
STA PD2,U
*
*I AM SCHITZO I,M FEELING FINE
*PD=OBJECT,PD2=SHOT TIME
*
SCZ0 LDX PD,U
LDB SZXV
LDY PLABX
CMPY OX16,X
BGE SCZ1
NEGB
SCZ1 SEX
STD OXV,X SEEK X
LDD PLABX X CLOSE?
SUBD OX16,X
ADDD #380
CMPD #$700
BLS SCZ6 SEEK Y
LDA PLAYC AVOID Y
SUBA OY16,X
BLS SCZ2
CMPA #8
BHI SCZ3
LDD SZYV
COMA
COMB
BRA SCZ5
SCZ2 CMPA #-8
BGT SCZ4
SCZ3 CLRD
BRA SCZ5
SCZ4 LDD SZYV
SCZ5 STD OYV,X
BRA SCZ10
SCZ6 LDA PLAYC SEEK Y
CMPA OY16,X
LDD SZYV
BHS SCZ7
COMA
COMB
SCZ7 STD OYV,X
LDD OBJX,X
BEQ SCZ12 NOT ON SCREEN
*RANDOM Y HOP
SCZ10 LDB SZRY
LDA SEED
BMI SCZ11
NEGB
SCZ11 ADDB OY16,X
CMPB #YMIN
BHS SCZ110
LDB #YMAX
SCZ110 STB OY16,X
DEC PD2,U SHOT TIME
BNE SCZ12
LDA SZSTIM
JSR RMAX
STA PD2,U
JSR SHOOT
BEQ SCZ12
LDD #SSHSND
JSR SNDLD
SCZ12 NAP 3,SCZ0
*
*KILL KIDNAPPING LANDER
*
LKIL1 LDU OBJID,X GOT A PASSENGER?
LDD [PD4,U]
BEQ LKILL
LDD #0
LDD #0 SPACE SAVER FO SOUND CALL
PSHS X
NEWP AFALL,STYPE START HIM FALLING
LDU PD2,U
STU PD,X
LDD #ASCSND
JSR SNDLD SCREAM.....
LDD #0
STD OYV,U
STX OBJID,U
PULS X
*KILL LANDR
LKILL DEC LNDCNT
KILP 0115,LHSND
RTS
*
*ASTRONAUT FALL
*
AFALL LDX PD,U
LDD #8 ACCEL DOWNWARD
ADDD OYV,X
CMPD #$300
BHS AFALL0
STD OYV,X
AFALL0 JSR GETALT
CMPA OY16,X HIT GROUND?
BHI AFALL1 NO
LDD OYV,X
CMPD #$E0 FATAL?
BLS ALAND NO
LDD OBJX,X
ADDD #$0107
STD CENTMP CENTER OF EXPLOSION
JSR ASTK1
JMP SUCIDE
AFALL1 NAP 4,AFALL
AFALL2 LDX PD,U
LDD #0
STD OYV,X
LDA PLAY16
ADDA #10
STA OY16,X
LDD PLABX
ADDD #$0080
STD OX16,X
JSR GETALT
CMPA OY16,X
BLO ALAND0 WERE ON THE GROUND
NAP 1,AFALL2
ALAND PSHS X
LDX #P250
BRA ALND00
ALAND0 PSHS X
LDX #P500
ALND00 LDA #STYPE
JSR MKPROC
LEAY ,X
PULS X
STX PD,Y ASTRO OBJECT TO 500 PROC
LDD #0
STD OBJID,X
STD OYV,X
LDD #ASTKIL
STD OCVECT,X
LDD #ALSND
JSR SNDLD
JMP SUCIDE
*
*TIEST
*A=# IN SQUAD 1-4
*
TIEST STA XTEMP
LDB TIEXV
COM TFLG ALTERNATE DIRECTIONS
BMI TIEST1
NEGB
TIEST1 STB XTEMP+1 X VELOCITY
LDX #TIE
LDA #STYPE
JSR MSPROC MAKE A SUPER PROCESS
LEAU ,X SAVE INDEX
LDA XTEMP
STA PD+8,U
CLRD
STD PD,U
STD PD2,U
STD PD4,U
STD PD6,U
TIEST2 OBI TIEP1,TIEKIL,$8888
LDB XTEMP+1
SEX
STD OXV,X