forked from historicalsource/smashtv
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathLZRORB.ASM
1183 lines (1097 loc) · 21.3 KB
/
LZRORB.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
.FILE "LZRORB.ASM"
.TITLE "ROBO-RAMA GAME PROGRAM"
.WIDTH 132
.OPTION B,D,L,T
.MNOLIST
;
; INITIATED: DECEMBER 20, 1989
; MODIFIED: FOREVER....
; SOFTWARE: EUGENE JARVIS
;
; COPYRIGHT (C) 1989 WILLIAMS ELECTRONICS GAMES, INC.
;
;
; GET THE SYSTEM STUFF
.INCLUDE "MPROC.EQU" ;MPROC EQUATES
.INCLUDE "DISP.EQU" ;DISPLAY PROC. EQUATES
.include "sys.inc" ;z unit system equates
.include "macros.hdr" ;macros definitions
.INCLUDE "IMGTBL.GLO"
.INCLUDE "ROBO.EQU"
; .INCLUDE "MARK.EQU"
;
;SOUNDS
;
.REF EXP1,EXP3,LAZSND,EXP3HI
;
;SYMBOLS EXTERNALLY DEFINED
;
; .REF LASERSPD
.REF ECON,ORB_LIT,FRANIM,BIG3,SCRADD2,P1DATA,P2DATA,DEXIT
.REF PSTOP,ADPCS4,HALT,BOUND,WAVE
.REF GET_VALID_XY,GAMSTATE,WAVEYX,EHALT
.REF RANDPER,RANDOM,RANGRAND,DRINF,SET_GATE_2,GET_WVADDR
.REF RANDU,SRAND,PLYROBJS
.REF FINDPAL,PALSET,DELPAL,GETFPAL
;
;SYMBOLS DEFINED IN THIS FILE
;
.DEF SPAWN_ORB,ONSCRN_ORB,ORB_CNT,ORB_DN,MAXORB,OFSCRTST
.DEF SCORPLAY,ORBBNDCK,BOOM4
.DEF KILL_O1,ORB_ORB,KILL_LZR,ORBLAZ,ORBBUL,KILL_OB,GETPLYR
;
;UNINITIALIZED RAM DEFINITIONS
;
.BSS MAXORB,8 ;MAXIMUM ON SCREEN FOR CURRENT WAVE
.BSS ORB_CNT,16 ;ORB CNT ON SCREEN
.BSS ORB_DN,16 ;0=NO, 1=YES
;
;EQUATES/STRUCURES FOR THIS FILE TO FOLLOW
;
;
;ORB DATA STRUCTURE
;
.TEXT
;
ONSCRN_ORB:
;A2=# OF ORBS TO CREATE ON SCREEN AT START OF WAVE
CREATE CYCPID,ORB_LIT
MOVB A2,@ECON ;YES ENEMY TO ENEMY!
OH1 PUSH A2 ;CREATE A BUNCH OF THEM
CREATE ORBPID,OORB
PULL A2
DSJNE A2,OH1
PUSH A11
MOVI ORBCTB0,A11
MOVE @WAVE,A0
CMPI 1,A0
JRZ OH2
CMPI 2,A0
JRZ OH2
CMPI 8,A0
JRZ OH2
CMPI 13,A0
JRZ OH2
MOVI 700,A0
CALLA RANDPER
JRC OH2
MOVI ORBCTB1,A11
OH2
CREATE 0,ORBCOL
PULL A11
RETS
ORBDLY SLEEP 4*60
MOVI CYCPID,A0
MOVE A0,*A10(PROCID)
DIE
*
*COLOR CYCLE YOUR ORBS
*A11=TABLE TO USE
ORBCOL
SLEEP 4
MOVE A13,A10
CREATE 0,ORBDLY
MOVI NUORB,A0
CALLA FINDPAL
JREQ ORBCOL
SLL 24,A0 ;ISOLATE THE NUMBER
SRL 16,A0
CLR A10
MOVE A0,A9
ORBCOLP
MOVE A9,A1 ;GET DESTINATION
MOVI 24,A2
INC A10
CMPI 3,A10
JRLO ORBCOL1
CLR A10
ORBCOL1
MOVE A10,A0
SLL 5,A0
ADD A11,A0
MOVE *A0,A0,L
CALLA PALSET
SLEEP 6
JRUC ORBCOLP
ORBCTB0 .LONG NUORB2+16,NUORB+16,NUORB3+16 ;BLUE GLOWER
ORBCTB1 .LONG NUORB5+16,NUORB4+16,NUORB5+16 ;GREEN-YELLOW GLOWER
OORB:
;OORB IS CALLED AT THE START OF A WAVE TO PLACE X # OF ORBS ON SCREEN
;AT THE BEGINNING OF A WAVE
;CLEAR ANY STRUCTURE VARIABLES HERE
MOVI 60,A0
MOVI 60,A1
MOVB @BOUND,A2
JRNZ TOPIT
CLR A11 ;A11 CLR=SKIP CIRCLE TABLE ALIGNMENT
CALLA GET_VALID_XY ;MAKE SURE NEW ORB IS NOT
;OVERLAPPING ANY EXISTING SHAPE
;WHICH IS ALREADY ON SCRN AT START
;A0 & A1 ARE SET UP
;ADD IN OFFSETS FOR THIS PARTICULAR ARENA
TOPIT MOVE @GAMSTATE,A2
CMPI INAMODE,A2
JREQ DMD
MOVE @WAVEYX,A2,L
;A2=PACKED OFFSETS
MOVX A2,A3
SLL 16,A3
ADD A3,A0 ;ADJUSTED A0 XVAL!
ANDI 0FFFF0000H,A2
ADD A2,A1 ;ADJUSTED A1 YVAL!
;
DMD
;A0,A1 ARE SETUP.
CALLR IH1 ;INIT ORB (BEGINOBJ)
CALLA BEGINOBJ2 ;STUFF OBJ
CALLR SETUP_ORB ;INC ORB_CNT
JRUC LUP_TOP
SPAWN_ORB:
;CALLED TO SEND OUT 1 ORB FROM A RANDOM DOOR.
;SPAWN ORB IS CALLED FROM 'WAVE OVERLORD' CODE WHICH DISPERSES
;ALL THE BAD GUYS THROUGHOUT A WAVE
MOVE @ORB_DN,A0 ;0=STILL SOME TO COME OUT
;1=ALL FINISHED!
JRNZ ORB_OUT
MOVE @ORB_CNT,A2 ;MOVE BYTE (# ORB ON SCRN) TO A2
MOVB @MAXORB,A3
CMP A3,A2 ;ORBS MAXED OUT?
JRGT ORB_OUT ;
MOVB A3,@ECON ;YES ENEMY TO ENEMY!
CREATE ORBPID,AORB ;START ONE ORB
ORB_OUT:
RETS
;
AORB:
;YES A NEW ORB WILL APPEAR
;THIS ORB WAS SPAWNED FROM 'WAVE OVERLORD' CODE
CALLA INIT_ORB
CALLR SETUP_ORB ;INC CNT, SET DIR, SET DEATH FLAG, ETC
*
* ORB PROCESS
* A8=OBJECT
* A11=PLAYER TO SEEK
* A13=PROCESS
* PDATA=BULLET HIT COUNT
* PDATA+010H=ORB FIRING LASER = LASER PROCESS OR 0
* PDATA+030H=ORB CRASHING >=1
* PDATA+040H=XACC
* PDATA+050H=YACC
LUP_TOP:
CLR A0
MOVE A0,*A13(PDATA),L ;CLEAR BULLET HIT COUNT
MOVE A0,*A13(PDATA+020H),L ;CLEAR LASER FIRE AND CRASH FLAGS
SLEEP 2
MOVE @EHALT,A0
JRNZ LUP_TOP ;HALT ORBS WHILE PLAYER ENTERS
SLEEP 30
CALLA GETPLYR
MOVE A0,A11
CALLA GETORBV
MV:
MOVI 100,A0 ;GET NEW VELOCITY?
CALLA RANDPER
JRNC MVV01 ;NO
CALLR GETORBV
MOVI 20,A0 ;GET NEW PLAYER TO SEEK
CALLA RANDPER
JRNC MVV01 ;NO
CALLA GETPLYR
MOVE A0,A11
MVV01
MOVE *A13(PDATA+040H),A0,W ;GET ACCELERATIONS
MOVE *A13(PDATA+050H),A1,W
MOVE *A8(OXVEL),A2,L
MOVE *A8(OYVEL),A3,L
ADD A0,A2
ADD A1,A3
MOVE A2,A0
MOVE A3,A1
SRA 4,A0 ;SUB OUT DAMPING FACTOR
SRA 4,A1
SUB A0,A2
SUB A1,A3
MOVE A2,*A8(OXVEL),L
MOVE A3,*A8(OYVEL),L
CALLR ORBBNDCK ;CHECK BOUNDARY COLLISION
MOVI 09,A0 ;08
CALLA RANDPER
JRNC MV1
CALLR GETLZDIR ;GET LAZER DIRECTION
SLL 5,A0 ;ADJUST FOR LONG WORDS
MOVI LASTAB,A10 ;RANDOM FIRING ANGLE
ADD A0,A10 ;GROUPS OF THREE
ADD A0,A10
ADD A0,A10
MOVE *A10+,A0,L ;GET FIRING IMAGE
MOVE *A10+,A9,L ;GET POSITIONING ANIMATION
MOVE *A8(OIMG),A1,L
CMP A0,A1 ;ON FIRING IMAGE?
JREQ MVV ;YES
MOVK 1,A1 ;ROTATE INTO POSITION
JSRP FRANIM
MVV
CALLA PSTOP ;STOP THE ORB
; MOVE @HALT,A0
; JRNZ MVFIRLP
CLR A1
MOVI LZRPID,A1
MOVE *A10,A7,L
CALLA GETPRC
MOVE A8,*A0(PDATA),L ;TELL LASER WHO FIRED IT
MOVE A0,*A13(PDATA+010H),L ;TELL ORB LASER PROCESS
MOVI LAZSND,A0
CALLA ONESND
MVFIRLP
SLEEP 4
MOVE *A13(PDATA+010H),A0,L ;LASER STILL GOING ?
JRNE MVFIRLP ;YES
CLR A0 ;LASER IS DONE
MOVE A0,*A13(PDATA+020H),W
CALLR GETORBV ;GET ORB VELOCITY
MV1
SLEEP 2
JRUC MV
LASTAB
.LONG ORB1,ROTSD,LASRR,ORB1,ROTSD,LASRL
.LONG ORB4,ROTUP,LASRU,ORB4,ROTUP,LASRD
.LONG ORB1,ROTSD,LASRR,ORB1,ROTSD,LASRL
.LONG ORB4,ROTUP,LASRU,ORB4,ROTUP,LASRD
*
*GET LASER DIRECTION
*A8=ORB, A11=TARGET
*RETURNS A0=0(RT),1(LFT),2(UP),3(DOWN)
GETLZDIR:
*CALCULATE DELTAX, DELTAY
MOVE *A8(OXPOS),A0,W
MOVE *A8(OYPOS),A1,W
MOVE *A11(OXPOS),A2,W
MOVE *A11(OYPOS),A3,W
SUB A0,A2
SUB A1,A3
MOVE A2,A4
MOVE A3,A5
ABS A4
ABS A5
CLR A0
CMP A4,A5
JRHI GTLZDR0
MOVE A2,A2
JRNN GTLZDRX
MOVK 1,A0
JRUC GTLZDRX
GTLZDR0
MOVK 2,A0
MOVE A3,A3
JRN GTLZDRX
MOVK 3,A0
GTLZDRX
RETS
*
*GET ORB VELOCITY
*A11=PLAYER TO SEEK
*RETURNS PDATA+040H XACC; PDATA+050H YACC
*
GETORBV
MOVI 50,A0
CALLA SRAND
MOVE A0,A1
MOVI 50,A0
CALLA SRAND
MOVE *A11(OXPOS),A2,W
MOVE *A11(OYPOS),A3,W
ADD A0,A2
ADD A1,A3
MOVE *A8(OXPOS),A0,W
MOVE *A8(OYPOS),A1,W
SUB A0,A2
SUB A1,A3
SLL 6,A2
SLL 6,A3
MOVE A2,*A13(PDATA+040H),W
MOVE A3,*A13(PDATA+050H),W
RETS
*
*CHECK ORB OUT OF BOUNDS
*A0,A1,A2,A3 DESTROYED
ORBBNDCK:
MOVI [03AH,02AH],A2 ;BOUNDS CHECK
MOVI [0E8H,0166H],A3
CALLA SCRTSTG
JREQ MV0 ;IN BOUNDS O.K.
MOVE *A8(OXVEL),A1,L
MOVE *A8(OYVEL),A2,L
DEC A0
JRNE MV01
ABS A1 ;MAKE XV POSITIVE
JRUC MV00
MV01
DEC A0
JRNE MV02
ABS A1 ;MAKE XV NEGATIVE
NEG A1
JRUC MV00
MV02
ABS A2
DEC A0
JREQ MV00 ;UP CASE
NEG A2 ;DOWN WALL CASE
MV00
MOVE A1,*A8(OXVEL),L
MOVE A2,*A8(OYVEL),L
MV0
RETS
INIT_ORB:
;INITIAL ORB POSITION,IMAGE SHAPE,AGE ETC....
;DO STFOBF AND GET A0 PNTR
MOVI 0,B0 ;DOORS 1-4
MOVI 4,B1
CALLA RANGRAND ;TIE THIS IN WITH DIFFICULTY!
MOVE A0,A1
SLL 5,A1
ADDI DRINF,A1
MOVE *A1,A1,L
MOVB *A1,A1
JRZ G
CMPI 06,A1
JRGE G
;DOOR THIS GUY WILL BE SENT TO IS CLOSING RIGHT NOW. SO SEND HIM TO DOOR 4
MOVI 4,A0 ;DOOR 4
G
PUSH A0 ;A0=DOOR 1-4
MOVI 01FH,A1 ;TIME FOR DOOR TO REMAIN OPEN
;OPEN DOOR
CALLA SET_GATE_2
;NOW PLACE ORB BEHIND APPROPRIATE DOOR
PULL A2
MOVI SX,A1
SLL 5,A2 ;INTO DOOR X/Y TABLES
ADD A2,A1
MOVE *A1,A0,L
MOVI SY,A1
ADD A2,A1
MOVE *A1,A1,L
;A0=OXVAL
;A1=OYVAL
PUSH A2 ;INDEX BASED ON DOOR 1-4
CALLR IH1
CALLA BEGINOBJ
PULL A2
;NOW GIVE X/Y VEL FOR THIS ORB
MOVI ORBXV,A0
ADD A2,A0
MOVE *A0,A0,L
MOVE A0,*A8(OXVEL),L
ADDI ORBYV,A2
MOVE *A2,A0,L
MOVE A0,*A8(OYVEL),L
RETS
;DOOR #
; 3
;1 2
; 4
ORBXV: .LONG 0,10000H,-10000H,0,0
ORBYV: .LONG 0,0,0,10000H,-10000H
IH1: ;ENTER HERE IF ON SCRN TANK
;STUFF NEEDED SHIT
;A0=OXVAL
;A1=OYVAL
MOVI ORB1,A2 ;(OIMG) DOES NOT MATTER
; MOVI NUORB2,A2 ;(OIMG) DOES NOT MATTER
MOVI 230,A3 ;(OZPOS)
MOVI DMAWNZ,A4 ;(OFLAGS) NON-ZERO VALUE
MOVI CLSENMY|TYPORB,A5 ;(OID)
CLR A6 ;(OXVEL)
CLR A7 ;(OYVEL)
RETS
SETUP_ORB:
;
; UPDATE ORB COUNT
;
MOVE @ORB_CNT,A0
INC A0
MOVE A0,@ORB_CNT
MOVI ORB,A2
CALLA GET_WVADDR
MOVE *A0(32),A1,W ;GET DIFFICULTY LEVEL FOR THIS ORB
; MOVE A1,*A13(LEVEL),W
MOVE *A0(16),A1,W ;DEC WAVE RAM CNT FOR THIS ORB
DEC A1
MOVE A1,*A0(16),W
JRNZ BZ
;END OF THIS WAVES ORB CNT
MOVK 1,A1
MOVE A1,@ORB_DN
CREATE 0,DEXIT ;TURNS ON ARROW, ETC.
;CREATE THIS ONLY WHEN ALL ENEMIES
;ARE GONE!
;
BZ
RETS
SX: .LONG 0,-040000H,01960000H,0CA0000H,0CA0000H
SY: .LONG 0,0830000H,0830000H,20000H,01140000H
*
*ORB KILL LAZER
*A8=ORB OBJECT
*KILL LAZER IF ANY
*
ORBKILLZR
MMTM SP,A0,A1,A2,A7,A8
MOVE *A8(OPLINK),A2,L ;ORB PROCESS
MOVE *A2(PDATA+010H),A1,L ;LINK TO LASER PROCESS
JREQ KLX ;NO LAZER
MOVE *A1(PA8),A8,L ;GET LAZER OBJECT
JRUC KILL_LZR1
*
*LAZER COLLIDE WITH PLAYER OR ORB
*
KILL_LZR
;A8=LAZER PNTR
;A0=WHAT I HIT
MMTM SP,A0,A1,A2,A7,A8
MOVE *A8(OPLINK),A1,L
MOVE *A1(PDATA),A1,L ;DID I HIT MY OWN ORB??
CMP A0,A1
JREQ KLX ;YES, NO ACTION
MOVE *A1(OPLINK),A2,L
KILL_LZR1
CLR A1
MOVE A1,*A2(PDATA+010H),L ;NULL OUT POINTER TO LASER
MOVE A8,A0
CALLA DELOBJ
CALLA DELPAL
**********************
MOVI 05432H,A2
**********************
MOVE *A8(OPLINK),A0,L
CALLA KILL
KLX
MMFM SP,A0,A1,A2,A7,A8
RETS
*
*CLEAN UP ORB MESS
*A8=ORB
*
ORBCLEAN
MOVE *A8(OPLINK),A0,L
CALLA KILL ;KILLS PROCESS IN A0
ORBCLN1
CALLR ORBKILLZR ;KILL LASER IF ANY
MOVE A8,A0
CALLA DELPAL ;NEEDED? NOT IF IN PLYR PAL!
CALLA DELOBJ
MOVE @ORB_CNT,A0,W ;DELETE A FAT FROM CNT
DEC A0
MOVE A0,@ORB_CNT,W
RETS
*
*ORB HIT BY ORB
*
;RESTORE EVERYTHING EXCEPT A0,A8
;A0=KILLER
;A8=VICTIM
ORB_ORB:
MMTM SP,A1,A2,A3,A4,A5,A6,A7
CMP A8,A0 ;PROCESS ONLY ONCE
JRHS ORBORBX
MOVE *A8(OXPOS),A1,W
MOVE *A0(OXPOS),A2,W
SUB A2,A1
MOVE A1,A2
ABS A2
CMPI 16,A2
JRHI ORBORBX ;NOT CLOSE ENOUGH FOR COLLISION
MOVE *A8(OYPOS),A3,W
MOVE *A0(OYPOS),A4,W
SUB A4,A3
MOVE A3,A4
ABS A4
CMPI 16,A4
JRHI ORBORBX ;NOT CLOSE ENOUGH FOR COLLISION
SLL 16,A1
SLL 16,A3
SRA 5,A1
SRA 5,A3
MOVE *A8(OPLINK),A5,L ;ORB PROCESS
MOVE *A5(PDATA+010H),A5,L ;LASER LINK
JRNE ORBORB1
MOVE *A8(OXVEL),A2,L
SRA 1,A2
ADD A2,A1
MOVE A1,*A8(OXVEL),L
MOVE *A8(OYVEL),A4,L
SRA 1,A4
ADD A4,A3
MOVE A3,*A8(OYVEL),L
ORBORB1
MOVE *A0(OPLINK),A6,L ;ORB PROCESS
MOVE *A6(PDATA+010H),A6,L ;LASER LINK
JRNE ORBORBX ;YES, DONT MOVE
NEG A1
MOVE *A0(OXVEL),A2,L
SRA 1,A2
ADD A2,A1
MOVE A1,*A0(OXVEL),L
NEG A3
MOVE *A0(OYVEL),A4,L
SRA 1,A4
ADD A4,A3
MOVE A3,*A0(OYVEL),L
ORBORBX
MMFM SP,A1,A2,A3,A4,A5,A6,A7
RETS
*
*ORB HIT BY BULLET
*A8=ORB
*A0=BULLET THAT HIT US
*
ORBBUL
MMTM SP,A0,A1,A2,A3,A7
MOVE *A8(OPLINK),A7,L ;ORB PROCESS
MOVE *A7(PDATA+010H),A1,L ;LASER LINK
JRNE ORBBUL1 ;DONT PUSH GUY SHOOTING
MOVE *A0(OXVEL),A1,L ;GIVE IT A PUSH
MOVE *A8(OXVEL),A2,L
SRA 2,A1 ;2,A1
ADD A1,A2
MOVE A2,*A8(OXVEL),L
MOVE *A0(OYVEL),A1,L
MOVE *A8(OYVEL),A3,L
SRA 2,A1 ;2,A1
ADD A1,A3
MOVE A3,*A8(OYVEL),L
ORBBUL1
MOVE A0,A1 ;SAVE AO
MOVE *A7(PDATA),A0,W ;INCREMENT HIT COUNT
INC A0
MOVE A0,*A7(PDATA),W
CMPI 3,A0 ;4
JRHS ORBBUL2 ;TOO MANY HITS, BLOW IT UP
MOVI 300,A0
CALLA RANDPER
JRNC ORBBULX ;IS THE GUY HISTORY??...NO
*
*ORB IS HISTORY GO INTO CRASH SPIN
*KILL LASER IF ANY
*
ORBBUL2
MOVE *A7(PDATA+030H),A0,W
JRNE ORBBULX ;ALREADY CRASHING
*DIE GRAY
; MOVI NUORB2,A0 ;DULL GRAY DEATH
; CALLA GETFPAL
; MOVE A0,*A8(OPAL),W
MOVE A1,A0 ;RESTORE A0, BULLET OBJECT THAT HIT YOU
MOVI ORBPT,A1 ;AMOUNT OF SCORE FOR ORB
CALLA SCORPLAY
CALLR ORBKILLZR ;KILL LASER IF ANY
MOVE *A8(OPLINK),A0,L ;ORB PROCESS
MOVI ORBPID,A1,W ;GET ID
MOVI ORBCRASH,A7
CALLA XFERPROC
ORBBULX
MMFM SP,A0,A1,A2,A3,A7
RETS
OCRCTB .LONG NUORB4,NUORB5
*
*SPIN AND CRASH THE ORB
*
ORBCRASH
MOVI 6,A0
CALLA RANDU
ADDI 3,A0
MOVE A0,A10
MOVI SPNORB,A9 ;TRY SPINNING ACTION
MOVK 2,A0 ;GET SPIN RATE
CALLA RANDU
MOVE A0,*A13(PDATA+030H),W ;SET CRASHING FLAG
CMPI 1,A0 ;ADJUST TIME FOR FAST SPIN
JRNE ORBCRL
ADDK 2,A10
ORBCRL
MOVE *A13(PDATA+030H),A11,W ;GET SPIN RATE
ORBCRL1
SLEEP 1
MOVI [050H,040H],A2 ;BOUNDS CHECK
MOVI [0D0H,0146H],A3
CALLA SCRTSTG
JRNE ORBBLO ;HIT A WALL
DSJS A11,ORBCRL1
MOVK 4,A1
JSRP FRANIM
JRNC ORBCRL
MOVI SPNORB,A9 ;TRY SPINNING ACTION
DSJS A10,ORBCRL
*CLEAN UP THE MESS AND BLOW IT UP !!!!
ORBBLO
CALLR ORBCLN1
CALLR OEXP2 ;START THE EXPLOSION
JAUC SUCIDE ;CAN THE PROCESS
KILL_OB
;SMART BOMB DEATH!
;A8=ORB
;A9=P1 OR P2DATA OF WHO SMARTED ME
MOVI ORBPT,A1 ;AMOUNT OF SCORE FOR ORB
MOVE A9,A2 ;PLAYER
CALLA SCRADD2 ;DO IT!
CALLR ORBCLEAN
CALLR OEXP
RETS
*
*KILL ORB BECAUSE OF COLLISION WITH RING
*EXTER HERE FROM COLLISION ROUTINE - RINGS KILL ORB
*A8=ORB
*
KILL_O1
MMTM SP,A1,A2,A7
MOVI ORBPT,A1 ;AMOUNT OF SCORE FOR ORB
CALLA SCORPLAY
CALLR ORBCLEAN
CALLR OEXP2 ;CHUNKS
MMFM SP,A1,A2,A7
RETS
*
*PLAYER SCORE
*A0=BULLET OBJECT THAT KILLED
*A1=AMOUNT TO ADD (8 DIGIT BCD)
*
SCORPLAY
MMTM SP,A0,A1,A2,A4,A7 ;SCRADD2 IS DIRTY, SAVE THESE
MOVE *A0(OPLINK),A0,L
MOVB *A0(MYPLYR),A0 ;A0=PLAYER NUMBER
*FIND A2=P1DATA OR P2DATA
MOVI P1DATA,A2
DEC A0
JREQ SCPL1
MOVI P2DATA,A2
SCPL1
CALLA SCRADD2 ;DO IT!
MMFM SP,A0,A1,A2,A4,A7
RETS
*
*ORB EXPLOSION PROCESS SMART BOMB, RINGS
*
OEXP
MOVI EXP3,A0
CALLA ONESND
CREATE 0,BIG3
RETS
OEXP2
MOVI EXP1,A0
CALLA ONESND
CREATE 0,ORB_EXP
CREATE 0,ADPCS4
RETS
*
*ORB COLLIDES WITH LAZER
*A8=ORB IMAGE PTR
*A0=LAZER
*
ORBLAZ:
MMTM SP,A1,A2,A7
MOVE *A0(OPLINK),A1,L
MOVE *A1(PDATA),A1,L
CMP A1,A8 ;MY OWN LASER ?
JREQ KILORBX ;YES, DONT DIE
CALLR ORBCLEAN
CREATE 0,ORB_EXP
CREATE 0,ADPCS4
MOVI EXP3HI,A0
CALLA ONESND
KILORBX
MMFM SP,A1,A2,A7
RETS
*
*ORB EXPLOSION PROCESS
*A8=ORB
*
ORB_EXP:
CLR A6
CLR A7
CALLA GETANIXY
; ADDI 0350000H,A2 ;A1=Y OFFSET
MOVE A2,A1
MOVE A3,A0
MOVI 199,A3 ;259
MOVI DMAWNZ|M_NOCOLL|M_FLIPV,A4 ;NON-ZERO VALUE
MOVI CLSNEUT|TYPNEUT,A5
MOVI EXPb1,A2
CALLA BEGINOBJ2
;CREATE EXPLOSION, AND THEN DIE
MOVI BOOM4,A9
MOVK 1,A1
JSRP FRANIM
MOVE A8,A0
CALLA DELOBJ
DIE
*
*FIRE LASER TO THE RIGHT
*A8=FIRING ORB OBJECT
*GET A0=OXVAL, A1=OYVAL, A2=OIMG, A3=ZPOS, A4=OFLAGS, A5=OID, A6=XV, A7=YV
LASRR
MOVE *A8(OXPOS),A0,W
ADDK 20,A0
SLL 16,A0
MOVE *A8(OYPOS),A1,W
ADDK 6,A1
SLL 16,A1
MOVI HLINE,A2
MOVI 230,A3
MOVI DMAWNZ,A4
MOVI CLSENMY|TYPORBL,A5
CLR A6
CLR A7
CALLA BEGINOBJ2
MOVI 0010001H,A1 ;SHRINK TO POINT
MOVE A1,*A8(OSIZEX),L
MOVE A0,A8
*
*LASER RIGHT PROCESS
*A8=OBJECT
*A13=PROC
LASRRP
MOVI [023H-5,01AH],A2 ;BOUNDS CHECK
MOVI [0FCH,0171H+5],A3
CALLA OFSCRTST ;IS IT IN BOUNDS ?
JRNE LASRRDIE ;DIE OFF RIGHT LASER IN WALL
MOVE *A8(OSIZEX),A0,W ;GROW THE SUCKER
; MOVE @LASERSPD,A1
; ADD A1,A0 ;ADDK 3
ADDK 3,A0
MOVE A0,*A8(OSIZEX),W
SLOOP 1,LASRRP
*
*FIRE LASER TO THE LEFT
*A8=FIRING ORB OBJECT
*GET A0=OXVAL, A1=OYVAL, A2=OIMG, A3=ZPOS, A4=OFLAGS, A5=OID, A6=XV, A7=YV
LASRL
MOVE *A8(OXPOS),A0,W
SLL 16,A0
MOVE *A8(OYPOS),A1,W
ADDK 6,A1
SLL 16,A1
MOVI HLINE,A2
MOVI 230,A3
MOVI DMAWNZ,A4
MOVI CLSENMY|TYPORBL,A5
CLR A6
CLR A7
CALLA BEGINOBJ2
MOVI 0010001H,A1 ;SHRINK TO POINT
MOVE A1,*A8(OSIZEX),L
MOVE A0,A8
*
*LASER LEFT PROCESS
*A8=OBJECT
*A13=PROC
LASRLP
MOVI [023H-5,01AH],A2 ;BOUNDS CHECK
MOVI [0FCH,0171H+5],A3
CALLA OFSCRTST
JRNE LASRLDIE ;DIE OFF RIGHT LASER IN WALL
MOVE *A8(OSIZEX),A0,W ;GROW THE SUCKER
; MOVE @LASERSPD,A1
; ADD A1,A0 ;ADDK 3
ADDK 3,A0
MOVE *A8(OXPOS),A1,W
SUBK 3,A1
MOVE A1,*A8(OXPOS),W ;MOVE OVER TOP LEFT
MOVE A0,*A8(OSIZEX),W
SLOOP 1,LASRLP
*
*FIRE LASER UP
*A8=FIRING ORB OBJECT
*GET A0=OXVAL, A1=OYVAL, A2=OIMG, A3=ZPOS, A4=OFLAGS, A5=OID, A6=XV, A7=YV
LASRU
MOVE *A8(OXPOS),A0,W
ADDK 8,A0
SLL 16,A0
MOVE *A8(OYPOS),A1,W
SLL 16,A1
MOVI VLINE,A2
MOVI 230,A3
MOVI DMAWNZ,A4
MOVI CLSENMY|TYPORBL,A5
CLR A6
CLR A7
CALLA BEGINOBJ2
MOVI 0010004H,A1 ;SHRINK TO POINT
MOVE A1,*A8(OSIZEX),L
MOVE A0,A8
*
*LASER UP PROCESS
*A8=OBJECT
*A13=PROC
LASRUP
MOVI [023H-5,01AH],A2 ;BOUNDS CHECK
MOVI [0FCH,0171H+5],A3
CALLA OFSCRTST
JRNE LASRUDIE ;DIE OFF RIGHT LASER IN WALL
MOVE *A8(OSIZEY),A0,W ;GROW THE SUCKER
; MOVE @LASERSPD,A1
; ADD A1,A0 ;ADDK 3
ADDK 3,A0
MOVE *A8(OYPOS),A1,W
SUBK 3,A1
MOVE A1,*A8(OYPOS),W ;MOVE OVER TOP LEFT
MOVE A0,*A8(OSIZEY),W
SLOOP 1,LASRUP
*
*FIRE LASER DOWN
*A8=FIRING ORB OBJECT
*GET A0=OXVAL, A1=OYVAL, A2=OIMG, A3=ZPOS, A4=OFLAGS, A5=OID, A6=XV, A7=YV
LASRD
MOVE *A8(OXPOS),A0,W
ADDK 7,A0
SLL 16,A0
MOVE *A8(OYPOS),A1,W
ADDK 16,A1
SLL 16,A1
MOVI VLINE,A2
MOVI 230,A3
MOVI DMAWNZ,A4
MOVI CLSENMY|TYPORBL,A5
CLR A6
CLR A7
CALLA BEGINOBJ2
MOVI 0010004H,A1 ;SHRINK TO POINT
MOVE A1,*A8(OSIZEX),L
MOVE A0,A8
*
*LASER DOWN PROCESS
*A8=OBJECT
*A13=PROC
LASRDP
MOVI [023H-5,01AH],A2 ;BOUNDS CHECK
MOVI [0F2H,0171H+5],A3
CALLA OFSCRTST
JRNE LASRDDIE ;DIE OFF RIGHT LASER IN WALL
MOVE *A8(OSIZEY),A0,W ;GROW THE SUCKER
; MOVE @LASERSPD,A1
; ADD A1,A0 ;ADDK 3
ADDK 3,A0
; ADDK 3,A0
MOVE A0,*A8(OSIZEY),W
SLOOP 1,LASRDP
*
*RIGHT LASER DIE
*A8=OBJECT
*A13=PROCESS
LASRRDIE:
MOVE *A8(OXPOS),A0,W ;SET X COORD TO END
MOVE *A8(OSIZEX),A1,W
ADD A1,A0
MOVI 1,A1 ;SET WIDTH TO 1
MOVE A1,*A8(OSIZEX),W
MOVE A0,*A8(OXPOS),W
MOVI SPLSHRT,A9
LASRDIE1
CALLA PSTOP ;STOP LASER
MOVE *A13(PDATA),A0,L ;KILL POINTER IN ORB PROCESS
MOVE *A0(OPLINK),A0,L
CLR A1
MOVE A1,*A0(PDATA+010H),L ;NULL OUT POINTER TO LASER
MOVI CLSNEUT,A0,W ;CHANGE TO CLASS NEUTRAL, NO COLLISIONS
MOVE A0,*A8(OID),W
MOVK 1,A1
JSRP FRANIM
MOVE A8,A0 ;KILL THE SHIT AND DIE
CALLA DELOBJ
CALLA DELPAL
JAUC SUCIDE
*
*LEFT LASER DIE
*
*A8=OBJECT
*A13=PROCESS
LASRLDIE:
MOVI SPLSHLFT,A9
JRUC LASRDIE1
*
*UP LASER DIE
*
*A8=OBJECT
*A13=PROCESS
LASRUDIE:
MOVI SPLSHUP,A9
JRUC LASRDIE1
*
*DOWN LASER DIE
*
*A8=OBJECT
*A13=PROCESS
LASRDDIE:
MOVE *A8(OYPOS),A0,W ;SET Y COORD TO END
MOVE *A8(OSIZEY),A1,W
ADD A1,A0