forked from historicalsource/smashtv
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathSCORE.ASM
986 lines (943 loc) · 19.3 KB
/
SCORE.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
.FILE "SCORE.ASM"
.TITLE "SCORE STUFF FOR ROBO-RAMA GAME PROGRAM"
.WIDTH 132
.OPTION B,D,L,T
.MNOLIST
;
; INITIATED: MAY 6,1989
; MODIFIED: !
; SOFTWARE: MARK TURMELL
;
; COPYRIGHT (C) 1989 WILLIAMS ELECTRONICS GAMES, INC.
;
;
; GET THE SYSTEM STUFF
.INCLUDE "MPROC.EQU" ;MPROC EQUATES
.INCLUDE "DISP.EQU" ;DISPLAY PROCESSOR EQUATES
.include "sys.inc" ;zunit system equates
.include "macros.hdr" ;macros, yeah!
.INCLUDE "IMGTBL.GLO"
.INCLUDE "ROBO.EQU"
.INCLUDE "LINK.EQU"
;
;SOUNDS
;
.REF FREEMAN,LOWSND,YAMOFF,FREESND
;
;SYMBOLS EXTERNALLY DEFINED
;
.REF LFCY,RFCY,LFACEP,RFACEP,LIVECNT,AUD1,SENDCRNR,KOFFC
.REF GETFPAL,AFONT0,BLNKAREA,P1DATA,P2DATA,STATUS2,XYSEEK2
.REF STARTUP,OBJON,OBJOFF,CANT,OVERLAP
.REF RD7FONT,RD15FONT,GAMSTATE,KILOBJ,DTIME,WNDO
.REF STRNGLEN,DMAN,CR_STRTP,CR_CONTP,CCCC
.REF GET_CREDITS,DMAQ,QDMAFLG ;FOR FILE SCORE USAGE
.REF STRCNRMO
.REF GETPRC,BEGINOBJ,BEGINOBJ2,HEXTOASC,STRLNRM,WORLDTL
.REF WAVEYX,METERP1,METERP2,FRANIM,P1LVS,P2LVS
.REF KILL
.REF ICNFLG,FREETOT
;
;SYMBOLS DEFINED IN THIS FILE
;
.DEF AH,CNTDIG1,CNTDIG2,SET_1ST,FFLG
;,AH2
.DEF PDSIZE,MSG_PROC2,MSG_PROC,SCORETYP,SCORE_FLAG,METERS
.DEF SCRADD2,INIT_SCORE,DRAW_SCORE,SCORE,SCRADD3
.DEF DELSCORE,FSCORE,BSCORE,P1MTRY,P2MTRY,FILLUP
.DEF EXTRA,FIXMETERS,FIXMETERS2,MTR1CNT,IS2,IS1
;
;UNINITIALIZED RAM DEFINITIONS
;
.BSS FFLG,8
.BSS CNTDIG1,8
.BSS CNTDIG2,8
.BSS ADDSCR,16
.BSS SCOUNT,16
.BSS SCORETYP,16
; .BSS MSGSET,16
.BSS OLDCRD,16
.BSS SCORE_FLAG,16
.BSS BSCORE,16
.BSS P1MTRY,16
.BSS P2MTRY,16
.BSS MTR1CNT,16 ;2 8 BIT POSITIONS FOR METER CNTRS
;
;EQUATES FIRST ORIGINATED IN THIS FILE
;
SCRSPC .EQU 12 ;SPACER FOR DIGITS (INCLUDING DIGIT)
BPDMA1 .EQU 01
BPDMA2 .EQU 02
MSGSLP .EQU 52*1/4
MSGSLP2 .EQU 52*2/4
**************************************************************************
.TEXT
EXTRA:
MMTM SP,A1,A2,A3,A4,A5,A6,A7
MOVE *A0(OPLINK),A0,L
MOVB *A0(PNUM),A4
; MOVE A8,A0
; CALLA DELOBJ
MOVK 1,A0
MOVB A0,@ICNFLG
CALLR DO_EXTRA
MOVB @FREETOT,A0
INC A0
MOVB A0,@FREETOT
MOVE A4,A9
CALLA SENDCRNR
CREATE FLYPID,KOFFC
MMFM SP,A1,A2,A3,A4,A5,A6,A7
RETS
DO_EXTRA
MMTM SP,A8,A7,A4
MOVI P1DATA,A8
MOVE @P1LVS,A7,L
CMPI 1,A4
JREQ CN
;PLYR 2
CMPI 2,A4
JRNZ OUT2
MOVI P2DATA,A8
MOVE @P2LVS,A7,L
CN MOVE *A8(PLIVES),A4,W ;GET NUMBER OF PLAYERS LIVES
INC A4
MOVE A4,*A8(PLIVES),W
CMPI 10,A4
JRGE OUT
SLL 7,A4 ;*128 (NEXT HEADER PLEASE!!)
ADDI AFONT0,A4 ;COMPUTE CORRECT HEADER
MOVE A4,A1
MOVE A7,A8
MOVE *A8(OFLAGS),A4,W
CALLA ANI
OUT
CREATE 0,YAMSND
OUT2
MMFM SP,A8,A7,A4
RETS
YAMSND
;CHECK TO SEE IF IN RACKUP, IF SO, DO MUSICAL FREEMAN SND
MOVB @CANT,A0
JRNZ DIOUT ;REGMN
; MOVI FREESND,A0 ;AUDIO EXTEND
; CALLA ONESND
; JRUC DIOUT
;REGMN
MOVI YAMOFF,A0
CALLA ONESND
SLEEP 2
MOVI FREEMAN,A0 ;AUDIO EXTEND
CALLA ONESND
DIOUT
MOVI AUDEXTRA,A0
CALLA AUD1
DIE
MTR1OR2 .LONG METERP1,METERP2
FILLUP:
;FILL UP THIS PLAYERS METER FROM EMPTY TO FULL
;A10=PLAYERS PROC PTR WHO IS FILLING UP
;
; MOVK 1,A0
; MOVB A1,@FFLG ;SOMEONE FILLING UP FLAG
; MOVI WAVESND,A0
; CALLA ONESND
; CALLR KILLBEEP
MOVE @METERP2,A8,L
MOVB *A10(PNUM),A0
DEC A0
JRNZ TAG1
MOVE @METERP1,A8,L
TAG1
MOVI FILLIN,A9
MOVK 1,A1
JSRP FRANIM
;A10
CALLA GETCNT
MOVB *A10(PNUM),A0
DEC A0
SLL 3,A0
ADDI MTR1CNT,A0 ;BASE OF METER CNT RAM
MOVK 1,A1
MOVB A1,*A0
CLR A1
MOVB A1,@FFLG ;SOMEONE FILLING UP FLAG
DIE
;KILLBEEP:
; MOVI BEEPID,A0
; CLR A1
; NOT A1
; JAUC KILALL ;KILL LOW ENERGY BEEPING PROCESS
FILLIN:
.LONG BOX6
.WORD 6
.LONG BOX5
.WORD 6
.LONG BOX4
.WORD 6
.LONG BOX3
.WORD 6
.LONG BOX2
.WORD 6
.LONG BOX1
.WORD 6
.LONG 0
METERS:
;CK FOR PLAYER #
;A10=PLAYER PROC PTR WHO IS METERING DOWN
MOVB @FFLG,A0 ;ANYBODY FILLING UP FLAG
JRNZ RY
MOVB *A10(PNUM),A0
DEC A0
SLL 3,A0
MOVI MTR1CNT,A2
ADD A0,A2
MOVB *A2,A1
INC A1
CMPI 8,A1
JRLT DAD
MOVK 7,A1
DAD
MOVB A1,*A2
PUSH A1
SLL 2,A0
ADDI MTR1OR2,A0
SLL 5,A1
ADDI METRS,A1
MOVE *A1,A1,L
PUSH A8
MOVE *A0,A8,L
MOVE *A8,A8,L
; MOVE @METERP1,A8,L
MOVE *A8(OFLAGS),A4,W
CALLA ANI
PULL A8
PULL A1
; MOVB @MTR1CNT,A0
CMPI 7,A1
JREQ STP
CMPI 5,A1
JRNZ GETCNT
MOVI LOWSND,A0
CALLA ONESND
; CREATE BEEPID,MRBEEP
GETCNT:
MOVE *A10(WPN_TYP),A0
SLL 4,A0
ADDI TIMERS,A0
MOVE *A0,A0,W
MOVE A0,*A10(SHOTCNT)
RY RETS
FIXMETERS:
SLEEP 1
MOVB @MTR1CNT,A0
SLL 5,A0
ADDI METRS,A0
MOVE *A0,A1,L
MOVE @METERP1,A8,L
MOVE *A8(OFLAGS),A4,W
CALLA ANI
; CALLR GETCNT
DIE
FIXMETERS2:
SLEEP 1
MOVB @MTR1CNT+8,A0
SLL 5,A0
ADDI METRS,A0
MOVE *A0,A1,L
MOVE @METERP2,A8,L
MOVE *A8(OFLAGS),A4,W
CALLA ANI
; CALLR GETCNT
DIE
STP:
; CALLR KILLBEEP
CLR A0
MOVE A0,*A10(WPN_TYP),W
RETS
;MRBEEP:
; MOVI BEEPLO,A0
; CALLA ONESND
; SLOOP 24,MRBEEP
; DIE
;SUBLZR .EQU 000H ;REGULAR LAZER SHOTS
;SUBSPRY .EQU 0001H ;SPRAY SUB TYPE
;SUBSPEW .EQU 0002H ;SPEW TYPE WEAPON (3)
;SUBGRND .EQU 0003H ;GRENADE
;SUBNOSTP .EQU 0004H ;NON STOPPING BULLET
TIMERS: .WORD 100,6,10,4,7,11,8,8 ;WEAPON 0,1,2,3,4 ETC
METRS .LONG BOX7,BOX1,BOX2,BOX3,BOX4,BOX5,BOX6,BOX7
IS2 MOVI P2DATA,A11
MOVI [35H,111H],A3
JRUC IS3
IS1
MOVI P1DATA,A11
MOVI [35H,24H],A3
IS3 CLR A0
MOVE A0,*A11(SCRCNT),L
MOVE A0,*A11(SCRSUB),L
MOVE A3,*A11(PSCRAD),L ;Y,X LOCATION OF SCORE 1
RETS
INIT_SCORE:
CALLR IS1
; MOVE A0,*A11(PSCORE),L
MOVE @GAMSTATE,A0
CMPI INAMODE,A0
JRZ DOP1MSG
; MOVE @MSGSET,A0
MOVE @STATUS2,A0
SRL 1,A0
JRC NOMSG1
DOP1MSG:
CREATE P1PID,MSG_PROC ;ALWAYS DISPLAY START STUFF IN ATTRACT
NOMSG1:
CALLR IS2
; MOVE A0,*A11(PSCORE),L
MOVE @GAMSTATE,A0
CMPI INAMODE,A0
JRZ DOP2MSG
; MOVE @MSGSET,A0
MOVE @STATUS2,A0
SRL 2,A0
JRC NOMSG2
DOP2MSG:
CREATE P2PID,MSG_PROC ;ALWAYS DISPLAY START STUFF IN ATTRACT
NOMSG2:
CREATE SCOREPID,SCORE
RETS
SCORE:
MOVI P1DATA,A2 ;UPDATE PLAYER 1
CALLA MOVER
MOVI P2DATA,A2 ;UPDATE PLAYER 2
CALLA MOVER
NODICE:
SLEEP 10 ;4 ;5! ;7!
JRUC SCORE
;
; MOVER-COUNT UP TO SCORE SPECIFIED IN SCRCNT
;
MOVER:
MOVE *A2(SCRCNT),A4,L ;MOVE SCORE TO ADD INTO A1
JRZ BYEALL ;NO SCORE SO EXIT
MOVE *A2(SCRSUB),A0,L ;PRESENT BCD COUNT-UP
MOVE @ADDSCR,A1,W ;ADD SCORE (ADDSCR+) AT A TIME
CALLA BCDADD ;BCD PRODUCT IN A0
CMP A4,A0 ;COUNT_UP MORE THAN AMOUNT TO ADD?
JRHI PRFCT ;ALL DONE BYE!
MOVE A0,*A2(SCRSUB),L ;UPDATE BCD COUNT-UP
MOVE @ADDSCR,A1,W ;GET TOTAL AMOUNT PER ADD
JRUC ESCAPE1 ;DO IT
PRFCT:
CLR A0
MOVE A0,*A2(SCRCNT),L ;ZERO SCORE AMOUNT TO ADD
MOVE A0,*A2(SCRSUB),L ;ZERO COUNTER
JRUC BYEALL ;ALWAYS
ESCAPE1:
MOVE *A2(PSCORE),A0,L ;MOVE IN PLAYERS CURRENT SCORE
CALLA BCDADD ;ADD CONTENTS OF A1 TO SCORE
MOVE A0,*A2(PSCORE),L ;REVISED SCORE
BYEALL:
RETS
;
;DRAW_SCORE-UPDATE PLAYER 1 & 2 SCORE
;
;A2=PLAYER DATA STRUCTURE
;
DRAW_SCORE:
MOVI AFONT0,A12
MOVI SCRSPC,A8 ;SPACING BETWEEN DIGITS
MOVI DMAWNZ,A5 ;CONTROL REGISTER
;DRAW 1 BITS ONLY
UPDSLP1:
MOVI P1DATA,A9
MOVE @SCORETYP,A0
JRNZ PUTSCORE
RETS ;0=NO SCORES 1=1 PLYR 2=2PLYR 03H=BOTH
PUTSCORE:
CMPI 1,A0
JRZ OUTSCR
CHK1BIT:
CMPI 2,A0
JRZ UPDSLP2
;BOTH PLAYERS
CALLR OUTSCR
UPDSLP2:
MOVI P2DATA,A9 ;BASE TABLE PLAYER 2
;
;OUTPUT SCORE TO SCREEN
;A0=CURRENT PLAYER SCORE
;A9=PLINDX=PLAYER DATA AREA
;
OUTSCR:
MOVK 8,A6 ;DIGIT COUNT
MOVE *A9(PSCRAD),A3,L ;PLAYER SCORE ADDRESS
;
MOVI 00101H,A1
MOVE *A9(PSCORE),A0,L ;PLAYER SCORE IN BCD FORM
OUTSCL:
MOVE A0,A14
SRL 28,A14 ;NEXT DIGIT VALUE INTO LOWEST 4 BITS
SLL 7,A14 ;*128 (NEXT HEADER PLEASE!!)
ADD A12,A14 ;BASE ADDRESS OF IMAGE HEADER
*A1: CONSTANT COLOR:PALETTE
*A3: DESTINATION Y:X
*A5: OFFSET:CONTROL
*A14: ADDRESS OF IMAGE HEADER
*GETS: A2=H/W; A4=SAG
MOVE *A14,A2,L ;GET VSIZE:HSIZE
MOVE *A14(ISAG),A4,L ;GET SAG
MOVE @QDMAFLG,A13,W ;IS Q BEING MODIFIED?
JRNZ OUTSCRX
MOVK 1,A13
MOVE A13,@QDMAFLG,W ;Q BEING MODIFIED
MOVE @DMAQCUR,A13,L
CMPI DMAQ,A13
JRLS OUTSCRX ;Q OVERLOAD, CAN IT
MMTM A13,A1,A2,A3,A4,A5
MOVE A13,@DMAQCUR,L
CLR A13
MOVE A13,@QDMAFLG,W
ADDXY A8,A3 ;ADD SPACE AFTER DIGIT
SLL 4,A0 ;NEXT DIGIT PLEASE!
DSJ A6,OUTSCL
OUTSCRX:
RETS
SET_1ST
;A11=P1 OR P2DATA AREA
MMTM SP,A0,A1
CLR A0
MOVI 0500000H,A1 ;FIRST FREE MAN AT 500000
CALLR BCDADD
MOVE A0,*A11(PNEXTREP),L
MMFM SP,A0,A1
RETS
;
;SCRADD2-ADD BCD (8 DIGIT) AMOUNT TO PLAYERS SCORE
;A1=AMOUNT TO ADD (8 DIGIT BCD)
;
SCRADD3
;ENTRY POINT FOR BONUS RACKUP
MMTM SP,A4
MOVE *A2(PSCORE),A0,L ;GET SCORE
CALLR BCDADD ;ADD IN NEW VALUE
JRUC ONEPLYR
SCRADD2:
MMTM SP,A4
MOVE @GAMSTATE,A0
CMPI INAMODE,A0
JREQ RT
MOVE *A2(PSCORE),A0,L ;GET SCORE
CALLR BCDADD ;ADD IN NEW VALUE
MOVE @STATUS2,A4
;CHECK TO SEE IF WE WANT TO DOUBLE SCORES FOR TWO PLAYER GAME
CMPI 3,A4
JRNZ ONEPLYR
CALLR BCDADD ;ADD IN NEW VALUE
;TWO PLAYER GAME
ONEPLYR MOVE A0,*A2(PSCORE),L ;STUFF IT
MOVE *A2(PNEXTREP),A1,L ;GET NEXT FREE MAN SCORE POINT
CMP A1,A0
JRLO RT
;GIVE PLAYER EXTRA LIFE
MOVE A1,A0
MOVI 01500000H,A1 ;ADDITIONAL MEN
CALLR BCDADD
MOVE A0,*A2(PNEXTREP),L
MOVK 1,A4
CMPI P1DATA,A2
JREQ RT0
CMPI P2DATA,A2
JRNZ RT
MOVK 2,A4
RT0
CALLR DO_EXTRA
RT
MMFM SP,A4
ANRT RETS
;
;SCRADD-ADD BCD (4 DIGIT) AMOUNT TO PLAYERS SCORE
;A1,[Y,X]
;Y HALF IS THE AMOUNT TO ADD (4 DIGIT BCD)
;X HALF IS MULTIPLE FOR COUNT-UP
;Y HALF MUST BE EVENLY DIVISIBLE BY X HALF
;SCRADD:
; MOVE A1,@ADDSCR,W ;MULTIPLE FOR SCORE ADD
; SRL 16,A1 ;MOVE SCORE TO ADD INTO WORD
; MOVE *A2(SCRCNT),A0,L ;COUNT ALREADY STORED
; CALLR BCDADD ;ADD NEW VALUE (IN BCD)
; MOVE A0,*A2(SCRCNT),L ;TO NEW TOTAL
; RETS
;
;BCD ADD ROUTINE
;A0=SCORE (8 DIGIT BCD) 32 BITS
;A1=NUMBER TO ADD TO A0 (8 DIGIT BCD)
;PACKED BCD FORMAT 4-BITS/ DIGIT
;
BCDADD:
;NEED ALL THESE MMTM'S?
MMTM SP,A1,A3,A4,A5,A6
MOVK 8,A5 ;DO 8 DIGITS
CLRC ;CLEAR THE CARRY
MOVK 00AH,A6
BCDLP:
MOVK 00FH,A3
MOVK 00FH,A4
AND A1,A3 ;MASK GARBAGE
AND A0,A4 ;TRANSFER
ADDC A3,A4
CMP A6,A4 ;NEED TO ADJUST? (PAST 9 DEC.)
JRLO BCDAD1 ;NO. THEN ADD
ADDK 6,A4 ;RETURN NUMBER TO 0
SRL 4,A0 ;
SLL 28,A4
ADD A4,A0
SRL 4,A1
SETC ;SET CARRY
DSJS A5,BCDLP ;DO ALL 8 DIGITS
JRUC BCDADX ;UNSTACK REGISTERS
BCDAD1:
SRL 4,A0
SLL 28,A4
ADD A4,A0
SRL 4,A1
CLRC
DSJS A5,BCDLP
BCDADX:
MMFM SP,A1,A3,A4,A5,A6
RETS
CNTDWN:
;TAKE FACE AWAY, AND DISPLAY LARGE FONT DIGIT WITH COLOR CYCLE
;DISPLAY A COUNTDOWN
CREATE 0,OVERLAP
MOVI 0FFF0H,A0
CMPI P1DATA,A11
JRNE V1
MOVE @LFACEP,A8,L
MOVE A0,*A8(OYPOS)
MOVK 10,A0
MOVB A0,@CNTDIG1
MOVE @STATUS2,A0
ANDI 2,A0
MOVE A0,@STATUS
MOVE A0,@STARTUP
CREATE DG1PID,DIGIT1
JRUC V2
V1
MOVE @RFACEP,A8,L
MOVE A0,*A8(OYPOS)
MOVK 10,A0
MOVB A0,@CNTDIG2
MOVE @STATUS2,A0
ANDI 1,A0
MOVE A0,@STATUS
MOVE A0,@STARTUP
CREATE DG2PID,DIGIT2
V2
DIE
DIGIT2
;DO DIGIT CNT
;TURN ON NEW CNTR OBJECT
MOVE @P2LVS,A0,L
; CALLA OBJOFF
MOVE *A0(OYPOS),A1
XORI 0F00H,A1
MOVE A1,*A0(OYPOS)
MOVB @CNTDIG2,A0
ANDI 0FH,A0
SLL 5,A0
ADDI NUMBS,A0
MOVE *A0,A2,L ;GET IMAGE
MOVE @RFACEP,A1,L
MOVE *A1(OXVAL),A0,L
MOVE @RFCY,A1
ADDI 12,A1
SLL 16,A1 ;GET Y
MOVI CLSNEUT|TYPTEXT|SUBDG2I,A5
MOVI 260,A3
MOVI DMACNZ,A4 ;CONSTANT COLOR NON-ZERO
CLR A6
CLR A7
CALLA BEGINOBJ2
MOVI 03E3E0000H,A0 ;COLOR NUMBER TO CYCLE
MOVE A0,*A8(OPAL),L
HG2 SLEEP 60
MOVB @CNTDIG2,A0
ANDI 0FH,A0
DEC A0
MOVB A0,@CNTDIG2
JRLE DV72
SLL 5,A0
ADDI NUMBS,A0
MOVE *A0,A1,L ;GET IMAGE
MOVE *A8(OFLAGS),A4,W
CALLA ANI
JRUC HG2
DV72
MOVE @STATUS2,A1
ANDI 1,A1
MOVE A1,@STATUS
MOVE A1,@STARTUP
MOVE @P2LVS,A0,L
JRUC DV8
NUMBS .LONG FON150,FON150,FON151,FON152,FON153,FON154,FON155,FON156,FON157
.LONG FON158,FON159
.LONG FON159,FON159,FON159,FON159,FON159,FON159,FON159,FON159
DIGIT1
;DO DIGIT CNT
;TURN ON NEW CNTR OBJECT
MOVE @P1LVS,A0,L
; CALLA OBJOFF
MOVE *A0(OYPOS),A1
XORI 0F00H,A1
MOVE A1,*A0(OYPOS)
MOVB @CNTDIG1,A0
ANDI 0FH,A0
SLL 5,A0
ADDI NUMBS,A0
MOVE *A0,A2,L ;GET IMAGE
MOVE @LFACEP,A1,L
MOVE *A1(OXVAL),A0,L
MOVE @LFCY,A1
ADDI 12,A1
SLL 16,A1 ;GET Y
MOVI CLSNEUT|TYPTEXT|SUBDG1I,A5
; MOVI CLSNEUT|TYPNEUT,A5
MOVI 260,A3
MOVI DMACNZ,A4 ;CONSTANT COLOR NON-ZERO
CLR A6
CLR A7
CALLA BEGINOBJ2
MOVI 03E3E0000H,A0 ;COLOR NUMBER TO CYCLE
MOVE A0,*A8(OPAL),L
HG SLEEP 60
MOVB @CNTDIG1,A0
ANDI 0FH,A0
DEC A0
MOVB A0,@CNTDIG1
JRLE DV7
SLL 5,A0
ADDI NUMBS,A0
MOVE *A0,A1,L ;GET IMAGE
MOVE *A8(OFLAGS),A4,W
CALLA ANI
JRUC HG
DV7
MOVE @STATUS2,A1
ANDI 2,A1
MOVE A1,@STATUS
MOVE A1,@STARTUP
MOVE @P1LVS,A0,L
DV8
; CALLA OBJON
MOVE *A0(OYPOS),A1
XORI 0F00H,A1
MOVE A1,*A0(OYPOS)
MOVE A8,A0
CALLA DELOBJ
CLR A0
MOVE A0,*A11(PLIVES)
CMPI P1DATA,A11
JRNE V3
MOVE @LFCY,A0
MOVE @LFACEP,A1,L
MOVE A0,*A1(OYPOS)
JRUC V4
V3
MOVE @RFCY,A0
MOVE @RFACEP,A1,L
MOVE A0,*A1(OYPOS)
V4
MOVK 2,A0 ;INDICATE KILL OFF PLAYER PRC ETC
MOVB A0,*A11(CNTD)
CALLA LIVECNT
DIE
MSG_PROC2:
;BOTH PLAYERS ARE PLAYING!
;CHANGE MESSAGE ON HIS SCOREBOARD/PLUS STILL SHOW PLAYER SCORE!
;COLOR CYCLE IT
SLEEP 30
MOVE A11,A2
CREATE 0,CNTDWN
JRUC DO_MSGS
;
; MSG_PROC - ALTERNATE BETWEEN PRESS START X TO PLAY/CONTINUE
; INSERT COIN TO PLAY/CONTINUE
; PARAMS:
; A11 = PTR TO PLAYER DATA STRUCTURE
;
MSG_PROC:
MOVE A11,A2
PRESSLP:
MOVE @GAMSTATE,A0
CMPI ININTRO,A0
JRNZ DO_GO
DO_NADA:
SLOOP 1,PRESSLP
DO_GO:
CMPI P2DATA,A11
JRZ PMSG2
;PUT P1 METER ON SCREEN
MOVE @METERP1,A0,L
MOVE @P1MTRY,A1,W
MOVE A1,*A0(OYPOS),W
MOVE @SCORETYP,A0,W ;TURN ON PLAYER 1 SCORE
ORI 1,A0
MOVE A0,@SCORETYP,W
MOVI CLSNEUT|TYPTEXT|SUBP1TXT,A0
JRUC DOSCRE1
PMSG2:
;PUT P2 METER ON SCREEN
MOVE @METERP2,A0,L
MOVE @P2MTRY,A1,W
MOVE A1,*A0(OYPOS),W
MOVE @SCORETYP,A0,W ;TURN ON PLAYER 2 SCORE
ORI 2,A0
MOVE A0,@SCORETYP,W
MOVI CLSNEUT|TYPTEXT|SUBP2TXT,A0
DOSCRE1:
CLR A1
NOT A1
CALLA KILOBJ ;CLEAR PLAYER MESSAGE
MOVI MSGSLP,A9
WLUP1:
MOVE @GAMSTATE,A0
CMPI ININTRO,A0
JRZ DO_NADA
SLEEP 4 ;1
DSJS A9,WLUP1
;
DO_MSGS:
CALLA CCCC ;MAKE SURE THINGS ARE INTACT
CALLA GET_CREDITS ;GET CURRENT CREDITS
MOVE A0,@OLDCRD,W ;AND SAVE THEM AS PREVIOUS CREDITS
CALLR AH
MOVB *A11(CNTD),A0
JRNZ CB
MOVE *A11(PSCORE),A0,L
JRZ PRESSTRT ;NO SCORE, THIS IS A NEW START
MOVE @GAMSTATE,A0,W
CMPI INGAMEOV,A0
JREQ PRESSTRT
CMPI INAMODE,A0
JREQ PRESSTRT
CB CALLA CR_CONTP ;CONTINUATION
JRLO INSCONT ;NOT ENOUGH FOR THE CONTINUE
JRUC PRESSTOC
PRESSTRT:
CALLA CR_STRTP
JRLO INSCONT ;NOT ENUFF TO START THIS GUY
;
; OUTPUT "PRESS START 1" OR "PRESS START 2" ON TOP HALF
;
PRESSTOC:
MOVE A11,A2
MOVK STRT1MSG,A3 ;"PRESS START 1"
CMPI P1DATA,A11
JREQ PRESCON1
PRESCONA:
MOVK STRT2MSG,A3 ;"PRESS START 2"
PRESCON1:
CALLA PUTMSG
JRUC NEXT1
AH
CMPI P2DATA,A11
JRZ CLRSCRE2
MOVE @SCORETYP,A0,W ;TURN OFF PLAYER 1 SCORE
ANDI 0FFFEH,A0
MOVE A0,@SCORETYP,W
;TAKE AWAY P1 METER
MOVE @METERP1,A0,L
MOVI 0FFF0H,A1
MOVE A1,*A0(OYPOS),W
JRUC DOINTRO
CLRSCRE2:
MOVE @SCORETYP,A0,W ;TURN OFF PLAYER 2 SCORE
ANDI 0FFFDH,A0
MOVE A0,@SCORETYP,W
;TAKE AWAY P2 METER
MOVE @METERP2,A0,L
MOVI 0FFF0H,A1
MOVE A1,*A0(OYPOS),W
DOINTRO:
; MOVB @WNDO,A0
RETS
;AH2
;
;OUTPUT PLAYER STANDBY MESSAGE
;
; MOVK PLAYER1M,A3
; CMPI P1DATA,A11
; JREQ PRESSBMA
; MOVK PLAYER2M,A3
;PRESSBMA:
; CALLA PUTMSG ;"PLAYER X"
; MOVK STANDBYM,A3 ;"STANDBY"
; CALLA PUTMSG
; RETS
;
; OUTPUT "INSERT COIN" ON TOP HALF
;
INSCONT:
MOVE A11,A2
CLR A3 ;"INSERT COIN"
CALLA PUTMSG
;
; START OF NEXT MESSAGE
;
NEXT1:
;
; OUTPUT "TO CONTINUE" OR "TO PLAY" ON THE BOTTOM HALF
;
MOVB *A11(CNTD),A0
JRNZ CB2
MOVE A11,A2
JRUC TOPLAY
; MOVE *A11(PSCORE),A0,L
; JRZ TOPLAY ;NO SCORE, THIS IS A NEW START
; MOVE @GAMSTATE,A0,W
; CMPI INGAMEOV,A0
; JREQ TOPLAY
; CMPI INAMODE,A0
; JREQ TOPLAY
CB2 MOVK CONTMSG,A3 ;"TO CONTINUE"
CALLA PUTMSG
JRUC NEXT2
TOPLAY:
MOVK PLAYMSG,A3 ;"TO PLAY"
CALLA PUTMSG
NEXT2:
MOVI MSGSLP2,A9 ;CHECK IF COIN DROP STATUS HAS CHANGED
CRDLUP:
CALLA CCCC ;MAKE SURE THINGS ARE IN TACT
CALLA GET_CREDITS ;GET CURRENT CREDITS
MOVE @OLDCRD,A1
CMP A0,A1
JRNZ RE_PLOT
SLEEP 4 ;1
DSJS A9,CRDLUP
JRUC PRESSLP
RE_PLOT:
MOVI CLSNEUT|TYPTEXT|SUBP2TXT,A0
CMPI P2DATA,A11
JRZ KIP1
MOVI CLSNEUT|TYPTEXT|SUBP1TXT,A0
KIP1:
CLR A1
NOT A1
CALLA KILOBJ
JRUC DO_MSGS
;
; FSCORE - TRANSFER BOTH PLAYERS SCORE TO FORGROUND OBJECTS AND DISPLAY THEM
; IN PLACE OF DIRECT-DMA OBJECTS
; PARAMS:
; BSCORE SET = TEXT OFFSET ADDED, WORLD COORDINATES IGNORED
; BSCORE CLR = TEXT OFFSET IGNORED, SET TO WORLD COORDINATES
FSCORE:
;
MOVI P1DATA,A9 ;TRANSFER PLAYER 1 SCORE
CALLA TSCORE
MOVI P2DATA,A9 ;TRANSFER PLAYER 2 SCORE
TSCORE:
MOVK 8,A11 ;DIGIT COUNT
MOVE *A9(PSCRAD),A0,L ;PLAYER SCORE ADDRESS
MOVE *A9(PSCORE),A9,L ;PLAYER SCORE IN BCD FORM
MOVE @BSCORE,A2
JRZ PUTSCL
MOVE @WAVEYX,A1,L
ADD A1,A0 ;POSSIBLE OFFSET
PUTSCL:
MMTM SP,A0
MOVE A9,A10
SRL 28,A10 ;NEXT DIGIT VALUE INTO LOWEST 4 BITS
SLL 7,A10 ;*128 (NEXT HEADER PLEASE!!)
ADDI AFONT0,A10 ;BASE ADDRESS OF IMAGE HEADER
CLR A1
MOVY A0,A1 ;Y VAL
SLL 16,A0 ;X VAL
MOVI 50,A3 ;Z POS.
MOVI DMAWNZ|M_NOCOLL,A4 ;FLAGS
MOVI CLSNEUT|TYPTEXT|SUBSCOR,A5 ;OBJ. ID
CLR A6 ;X VEL
CLR A7 ;Y VEL
MOVE @BSCORE,A2
JRNZ NADJST
MOVE A10,A2 ;IMG
CALLA BEGINOBJ ;CREATE OBJECT, WORLD ADJUSTED
JRUC DADJST
NADJST:
MOVE A10,A2 ;IMG
CALLA BEGINOBJ2 ;CREATE OBJECT,WORLD UNADJUSTED
DADJST:
MMFM SP,A0
MOVI SCRSPC,A1 ;SPACE BETWEEN DIGITS
ADDXY A1,A0 ;ADD SPACE AFTER DIGIT
SLL 4,A9 ;NEXT DIGIT PLEASE!
DSJ A11,PUTSCL
RETS
;
; DELSCORE - DELETE FGND OBJECTS USED AS TEMPORARY SCORES
; IN PLACE OF DIRECT-DMA OBJECTS
DELSCORE:
MOVI CLSNEUT|TYPTEXT|SUBSCOR,A0
CLR A1
NOT A1
JAUC KILOBJ
;
PUTMSG:
;A3=MSG #
;A11=PLAYER INDEX
CMPI P1DATA,A11
JRNZ GP2 ;BR=PLAYER 2 IS BEING UPDATED
CLR A4 ;OFFSET FOR BASE X POSITION
MOVI CLSNEUT|TYPTEXT|SUBP1TXT,A5
JRUC SETPUS
GP2:
MOVI 0EBH,A4
MOVI CLSNEUT|TYPTEXT|SUBP2TXT,A5
SETPUS:
MOVI MSGIMG,A1
SLL 5,A3
ADD A3,A1
MOVE *A1,A2,L
SRL 1,A3
MOVI MSGX,A1
ADD A3,A1
MOVE *A1,A0,W
ADD A4,A0
SLL 16,A0
MOVI MSGY,A1
ADD A3,A1
MOVE *A1,A1,W
SLL 16,A1
CLR A6
CLR A7 ;NO OBJECT VELOCITIES
MOVI DMACNZ,A4 ;CONSTANT COLOR NON-ZERO
MOVE A3,A9
MOVI DMACNZ,A4 ;CONSTANT COLOR NON-ZERO
CALLA BEGINOBJ
MOVI 03B3B0000H,A0 ;COLOR NUMBER
MOVB *A11(CNTD),A1
JRNZ HH
CMPI 16*5,A9
JRLT GJ
HH MOVI 03E3E0000H,A0 ;COLOR NUMBER TO CYCLE
GJ
MOVE A0,*A8(OPAL),L
P2SETX:
RETS
MSGIMG:
.LONG incoin,pstrt1,pstrt2,tocont,toplay,plyr1,plyr2,stndby
MSGX:
.WORD 038H-7,02FH-7,02FH-7,034H-7,044H-7,03BH-8,03BH-8,03DH
MSGY:
.WORD 50+3,50+3,50+3,60+3,60+3,50+3,50+3,60+3
STRT1MSG .EQU 1
;STRING "PRESS START 1"
STRT2MSG .EQU 2
;STRING "PRESS START 2"
CONTMSG .EQU 3
;STRING "TO CONTINUE"
PLAYMSG .EQU 4
;STRING "TO PLAY"
.END