-
Notifications
You must be signed in to change notification settings - Fork 6
/
AUDIT.ASM
2957 lines (2588 loc) · 112 KB
/
AUDIT.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 'AUDIT.ASM'
.TITLE "ROBO AUDITS AND AJUSTMENTS HANDLING"
.WIDTH 132
.OPTION B,D,L,T
.MNOLIST
;
; SOFTWARE BUFUS: LARRY DEMAR, ROBBI ASHWORTH, AND DR. J
;
; COPYRIGHT (C) 1990 WILLIAMS ELECTRONICS GAMES, INC.
;
;
; GET THE SYSTEM STUFF
.INCLUDE "MPROC.EQU" ;MPROC EQUATES
.INCLUDE "DISP.EQU" ;DISPLAY PROC. EQUATES
.INCLUDE "\VIDEO\SYS\SYS.INC" ;Z UNIT SYSTEM EQUATES
.INCLUDE "\VIDEO\SYS\MACROS.HDR" ;MACROS DEFINITIONS
.INCLUDE "IMGTBL.GLO"
.INCLUDE "ROBO.EQU"
.INCLUDE "LINK.EQU" ;LINK EQUATES
.INCLUDE "MENU.EQU" ;MENU EQUATES
.TEXT
*
* BAD_AUD - ANYTIME AN AUDIT NUMBER IS FETCHED, IF ITS
* CHECKSUM IS BAD, THEN BAD_AUD GETS SET TO 1
* THIS CAUSES "ERROR" IF ANY AUDIT IN A CALCULATION
* IS CORRUPTED, AND KEEPS A BAD CHECKSUM BAD WHEN
* AN AUDIT IS CHANGED.
.BSS BAD_AUD,16 ;(BAD_AUD...NOT BAD_DOG!)
.BSS P_TIMR,16 ;TIMER UNITS FOR GAME
; .BSS P2_TIMR,16 ;TIMER UNITS FOR 2 PLAYERS
.BSS C_FRAC,16 ;TIME 10 SECONDS TO
* ;INDICATE COIN ACTIVITY
.BSS C_FLAGS,3*32 ;INTERRUPT COIN BOUNCE
.BSS COINCNTR,32 ;MECH COIN COUNTER TIMERS AND COUNTS
COINCNT1 .EQU COINCNTR
COINCNT2 .EQU COINCNTR+8
* TIMERS 1,2:B16-23,B24-B31; COUNTS 1,2 B0-B7;B8-B15
.BSS OCT_FLG,16 ;FLAG SAYS WE'RE HALFWAY THROUGH PUSS!
*
* IN THIS MODULE
.DEF C_FRAC,COINCNTR
.DEF L_MESS,AUD,AUD1,GET_ADJ
.DEF GET_AUD,SLAM_SW,STORE_AUDIT
.DEF CR_STRTP
.DEF CR_CONTP
.DEF P_START
.DEF P_CONT
.DEF CRED_P
.DEF L_TIMER
.DEF CRD_SCRN
.DEF ADD_DUMP
.DEF LM_SETUP
.DEF LM_FINIS
.DEF CMOS_VAL
.DEF CLR_AUD,FAC_SET,DISPDUMP
.DEF CLR_AUDR
.DEF FORM_ADC
.DEF F_ADC_S
.DEF BAD_AUD
.DEF ADJ_PAGE
.DEF STRCAT
; .DEF CLR_SUBS
.DEF NO_CREDS
.DEF COIN_PAG
.DEF CAT_A0
.DEF UNIT_CLR
.DEF CK_MAX
.DEF DUMP_FS
.DEF HTOHXASC
.DEF PUT_ADJ
.DEF LD_CTAB
.DEF DEF_PAGE
.DEF ROM_NAME
.DEF C_FLAGS
.DEF GET_CSTR
.DEF WAIT_MUT
.DEF UNSTACK
; .DEF COINIRQ
.DEF CLRSWPRC
.DEF KILL_CRD
.DEF CCCC
.DEF GET_CREDITS
.GLOBAL SYNCHALF,NOAUTOE,WDOGDIS,GAMSTATE
.REF STATUS,COINSND,BTIME,ATSTRT
*
* IN HSTD.ASM
*
.REF SET_PAGE,ENTERON,CANT
.REF P_FORK
.REF DEC_HSR,INIT_HSR
.REF RC_BYTEI
.REF RC_BYTE
.REF RC_WORD
.REF RC_LONG
.REF RC_LONGI
.REF WC_BYTE
.REF WC_BYTEI
.REF WC_WORD
.REF WC_WORDI
.REF WC_LONG
.REF WC_LONGI
*
* IN MENU.ASM
*
.REF GET_CSPT
.REF STR_OBJ
.REF STR_FREE
.REF CKPROMPT
.REF TWO_TS,TWO_TP
.REF BUILD_ST
.REF HID_P
.REF DIAG
.REF CS_ENTS
*
* IN ROBOATT.ASM
*
.REF WIPEOUT,CNTDIG1,CNTDIG2
.REF P1START
.REF P2START
*
* IN TEST.ASM
*
; .REF CK_DOOR
; .REF WT_ADV,WW_ADV
.REF WAIT_BUT
.REF FORM_SWS
;
; IN ROBOATT.ASM
;
.REF P1START
.REF P2START
*
* OTHERS
*
.REF SOUNDSUP
.REF RD15FONT,RD7FONT,DMAQWAIT,STRCNRM
.REF STRNGRAM,BLNKAREA,STRLNRM,HEXTOASC
.REF CLR_SCRN
.REF KILALL
.REF GETPRC,SWSTST,SWSTACK,SUCIDE
.REF ATSTRT
.REF GAMERASE,AUTOEON,AUTOEOFF
.REF COLRSTRT
;
; UNINITIALIZED RAM DEFINED IN THIS FILE
;
; SOUND EQUATES
;
.TEXT
**************************************************************************
* *
* COIN HANDLING *
* *
**************************************************************************
**************************************************************************
* *
* L_TIMER *
* *
* THIS IS CALLED EACH TICK THROUGH THE EXEC LOOP *
* BEFORE TIMER IS CLEARED. IT DOES NOTHING *
* IF THE GAME IS NOT IN PLAY. ELSE IT ADDS *
* THE EXEC TIME TO THE 1 PLAYER OR 2 PLAYER *
* TIMER BASED ON CURRENT NUMBER OF PEOPLE PLAYING. *
* *
**************************************************************************
FIVE_SEC EQU 113H ;THIS IS 5 SECONDS. (Experimentally!)
L_TIMER:
MOVE @GAMSTATE,A0 ;CHECK IF ITS IN PLAY
CMPI INAMODE,A0
JREQ CK_OCTO ;ATTRACT MODE..CHECK OCTOPUS!
CMPI INDIAG,A0
JREQ NO_PLAY
CMPI INGAMEOV,A0
JREQ NO_PLAY
MOVE @STATUS,A2
JRZ NO_PLAY
;
; WE'RE PLAYING!
;
MOVE @TIMER,A1,W ;GET ELAPSED TIME
MOVE @P_TIMR,A0,W ;GET PLAY TIMER.
ADD A1,A0 ;ADD ELAPSED TIME
CMPI FIVE_SEC,A0 ;ARE WE AT 5 SECONDS?
JRLO LTIMX ;NOT YET
MOVI AUD1TIME,A0
CMPI 3,A2 ;CHECK TWO PLAYER GAME
JRNE ONE_PLYR ;NO
MOVI AUD2TIME,A0 ;YES, AUDIT DOUBLE
ONE_PLYR
CALLA AUD1 ;CHALK IT!
CLR A0
LTIMX
MOVE A0,@P_TIMR,W ;CLEAR OUT TIMER
NO_PLAY:
RETS
*
* ITS A-MODE...CHECK OCTOPUS!
*
CK_OCTO:
MOVE @SWITCH,A0,L ;CHECK FOR OCTOPUS
NOT A0
ANDI >24FFFF,A0 ;GET STICKS 'N STARTS
MOVE @OCT_FLG,A1,W ;GOT PART 1?
JRNZ CK_P2 ;YEP...CHECK FOR OTHER HALF
CMPI >00201001,A0 ;NO CHECK PART 1
JRNZ NO_OCTO ;NO ONE HOME
MOVI 60,A1,W ;ONE SEC TO GET PART TWO
CK_P2:
DEC A1 ;WAIT EXACTLY 1 SEC.
MOVE A1,@OCT_FLG,W ;GOT PART 1 SET FLAG
JRNE NO_OCTO
CMPI >00002008,A0 ;JOYSTICKS CORRECT?
JRNZ NO_OCTO ;BR= NOPE!
MOVI ACTIVE,A13
MOVI HID_P,A7 ;START THE PROCESS!
CLR A1
CALLA GETPRC ;THAT'S ALL FOLKS!
NO_OCTO:
RETS
;
;UNSTACK THE SWITCHES FOR OTHER THAN PLAYER CONTROLS
;
UNSTACK:
MOVI SWSTST,A0 ;INITIALIZE SWITCH STACK
MOVE A0,@SWSTACK,L
UNSTKL:
MOVE @SWSTACK,A3,L
CMPI SWSTST,A3,L ;STACK AT START?
JREQ UNSTKX ;BR=NO SWITCHES ACTIVE
MOVE @FREE,A0,L
JRZ UNSTKX ;NO PROCESSES LEFT, TRY NEXT TIME AROUND
MOVE *A3+,A0,W ;GET ENTRY
MOVE A3,@SWSTACK,L ;UPDATE STACK
SLL 27,A0 ;MAX SWITCH # = 31
SRL 27,A0
MOVE A0,A2
ADD A0,A2
ADD A0,A2 ;MULT BY 3
SLL 4,A2 ;ADJUST FOR WORD SIZE (16)
ADDI SWTAB,A2
MOVE *A2+,A1 ;GET PID
MOVE *A2+,A7,L ;GET STARTING ADDR
JREQ UNSTKL ;NULL ENTRY
CALLA GETPRC ;SPAWN THE PROCESS
UNSTKX:
SLEEP 1
JRUC UNSTKL
*
*GIVE HIM A SERVICE CREDIT
*
SERVICE
MOVE @GAMSTATE,A0,W ;DIAGNOSTICS?
CMPI INDIAG,A0
JREQ SERVICX ;THEN NO ACTION!
CALLR CCCC ;MAKE SURE THINGS ARE IN TACT
MOVI AUDSERV,A0
CALLA AUD1 ;CHALK UP A SERVICE CREDITS!
SOUND1 COINSND
CALLR GET_CREDITS
ADDK 1,A0 ;ADD IN THE NEW ONES.
CALLR PUT_CREDITS ;NOW STORE EM BACK (ENFORCE MAX)
CALLR FORM_COIN_CKSUM_AND_STORE
JRUC CREDSP
SERVICX
DIE
**************************************************************************
* *
* FREEZE - PROCESS TO FREEZE THE GAME ACTION WHEN THE FREEZE BUTTON *
* GOES FROM OFF TO ON. GAME RESUMES WHEN THE BUTTON IS RELEASED. *
* *
**************************************************************************
FREEZE
MOVE @GAMSTATE,A0
CMPI INDIAG,A0
JREQ FREEZE_DIE ;NO FREEZE SHIT DURING DIAGNOSTICS
; CMPI INAMODE,A0
; JAEQ DIAG ;GAME ONLY PLEASE
; CMPI INGAMEOV,A0
; JAEQ DIAG
CALLA SYNCHALF
MOVE @NOAUTOE,A8,W
MOVK 1,A0
MOVE A0,@NOAUTOE,W
CALLA AUTOEOFF ;SHUT OFF AUTO-ERASE
CLR A0
MOVE A0,@DISPLAYON
CALLA DMAQWAIT ;BLOW OUT THE QUEUE'D IMAGES
PUSHST
DINT
CALLA WDOGDIS
MOVI 1500000,A1
FREZWT
DSJS A1,FREZWT
FREEZE_LP:
MOVE @SWITCH+>10,A0,W ;GET THE COIN DOOR SWITCHES
BTST 8,A0
JREQ FREEZE_LP ;LOOP 'TIL BUTTON COMES UP
POPST
MOVE A8,@NOAUTOE,W
MOVK 1,A0
MOVE A0,@DISPLAYON
FREEZE_DIE:
DIE
;
; THE FOLLOWING COIN ROUTINES ARE PROCESSES!
;
LCOIN:
MOVI ADJLMULT,A8 ;CMOS RAM ADJUST
MOVI LC_FLAG,A10 ;LEFT COIN FLAG
MOVI AUDLCOIN,A11 ;AUDIT NUMBER
JRUC VALID_COIN
CCOIN:
MOVI ADJCMULT,A8
MOVI CC_FLAG,A10 ;CENTER COIN FLAG
MOVI AUDCCOIN,A11
JRUC VALID_COIN
RCOIN:
MOVI ADJRMULT,A8
MOVI RC_FLAG,A10 ;RYTE COIN FLAG
MOVI AUDRCOIN,A11
JRUC VALID_COIN
XCOIN:
MOVI ADJXMULT,A8
MOVI XC_FLAG,A10 ;XTRA (FOURTH) COIN FLAG
MOVI AUDXCOIN,A11
JRUC VALID_COIN
;
; COIN CONTROL EQUATES
;
LC_FLAG .EQU C_FLAGS ;UHB LEFT COIN
RC_FLAG .EQU C_FLAGS+8 ;UHB RYTE "
CC_FLAG .EQU C_FLAGS+16 ;UHB CNTR "
XC_FLAG .EQU C_FLAGS+24 ;UHB XTRA "
;
; VALID_COIN- CHECK THE DURATION OF COIN DROP AND SEES IF IT IS A VALID
; ENTRY
;PARAMS REQUIRED:
; A8 = MULTIPLIER FOR THAT SWITCH.
; A10 = RAM TIMER/FLAG
; A11 = BASE AUDIT NUMBER
;
VALID_COIN:
MOVE @GAMSTATE,A0,W ;DIAGNOSTICS?
CMPI INDIAG,A0
JREQ CRX ;THEN NO ACTION!
MOVE A8,A0 ;MOVE MULTIPLIER ADJUST NUMBER TO A0
CALLA GET_ADJ ;FETCH IT
MOVE A0,A8 ;AND BACK TO STATIC REG...ANY THERE?
JRZ CRX ;NOPE....DON'T WASTE THE TIME!
CALLR SLAM_P ;SLAM AROUND?
JRNZ CRX ;THEN NO ACTION
MOVI LC_PID,A0 ;ALL 3 SLOTS USE THIS ID NOW
MOVE A0,*A13(PROCID),W ;SET OUR ID (IN CASE TABLE IS WRONG)
MOVB *A10,A0 ;GET FLAG BYTE
JRNZ CRX ;SOMEONE ELSE THERE...WE'RE A BOUNCE!
;
; OK....THIS IS A NEW POSITIVE EDGE....START THE DROP TIMING
;
MOVK 30,A0 ;HIT TIMER FOR 1/2 SEC.
MOVB A0,*A10
COIN_LOOP:
SLEEP 1 ;SLEEP TILL WE GET SUCCESS OR FAIL
MOVB *A10,A0 ;GET THE TIMER
JRGT COIN_LOOP
CALLR SLAM_P ;SLAM?
JRNZ CRX ;THEN WE'RE OUT OF HERE
;
; 1/2 SECOND HAS PASSED WITHOUT A SLAM....INDICATE COIN DROP
CLR A0
MOVE A0,@SOUNDSUP,W ;TURN SOUNDS ON. (A-MODE SOUND SUPRESSOR)
SOUND1 COINSND
MOVK 10,A0
MOVE A0,@BTIME ;RESTUFF BUYIN TIMER
CALLR DOCNT
MOVI 15*40H/8,A0 ;DON'T WIPE ON GAME OVER IF ITS WITHIN
MOVE A0,@C_FRAC,W ;15 SECONDS (THIS TIMES OUT TO OVER 20)
MOVE A11,A0
CALLR AUD1 ;CHALK THE DIRECT AUDIT
*HIT THE MECHANICAL COIN COUNTERS
MOVI ADJCNTR,A0
CALLA GET_ADJ
CMPI 1,A0
JRNE MECH20
*MULTIPLE OF LEAST VALUE COIN MODE
CALLA GET_CSPT ;POINT TO COIN TABLE A6
MOVK 4,A1 ;CHECK ALL CHUTES
ADDI CS_LVAL,A6 ;ADD IN OFFSET TO CHUTE VALUES
MOVE A6,A5 ;SAVE A6
MECH1L
MOVE *A5+,A0,W ;NUMBERS UNDER 10?
CMPI 10,A0
JRHI MECH10 ;NO, JUST ONE CLICK
DSJS A1,MECH1L
MECH11
DEC A11 ;GET YOUR CLICK COUNT
SLL 4,A11 ;OFFSET FOR CHUTE, WORD CORRECT
ADD A11,A6
MOVE *A6,A2,W ;GET TOTAL COUNTS
MOVI COINCNT1,A1
JRUC MECH3B
MECH10
MOVK 2,A0 ;VALUE OVER 10, JUST GIVE ONE CLICK
MECH20
MOVI COINCNT1,A1
CMPI 2,A0
JREQ MECH3A ;CLICK COUNTER 1 MODE
CMPI AUDLCOIN,A11
JREQ MECH3A
CMPI AUDRCOIN,A11
JRNE MECH4
ADDK 8,A1
MECH3A
MOVK 1,A2
MECH3B
DINT
MOVB *A1,A0
ADD A2,A0
MOVB A0,*A1
EINT
MECH4
MOVE A8,A8 ;NO CREDIT UNITS?
JRZ CRX ;THEN NO MORE WORK TO DO.
CALLR ADJUST_CREDITS ;GIVE CREDIT FOR THE MONEY.
CALLR DEF_PAGE ;POINT PAGE AWAY!
;
; SET-UP CREDITS MSG IN GAME SCREEN AND INDICATE 'INSERT COIN' IF NOT ENOUGH
; HAVE BEEN DROPPED
;
; CALLA G_MSG ;PLOT MESSAGE FOR GAME PLAY SCREEN
CREDSP:
MOVE @STATUS,A0
JRNZ CRX
MOVE @GAMSTATE,A0,W
CMPI INAMODE,A0 ;A DISPLAY IN AMODE ONLY!
JRNZ CRX ;BR=GAME DEMO MODE IN PROGRESS
MOVI CP_PID1,A0 ;CHANGE TO "CREDIT PAGE" ID 1
MOVE A0,*A13(PROCID),W
MOVI 0FFFFH,A1 ;CHECK TO SEE IF CREDIT PAGE IS UP
CALLA EXISTP
JRZ CRY ;BR=NO CREDIT PAGE PUT HER UP!
JRUC CRX ;OTHERWISE DON'T RE-DISPLAY IT
CRY:
JSRP CRD_SCRN ;PUT UP THE CREDITS SCREEN
CLR A0
MOVE A0,@ENTERON
MOVB A0,@CANT
SLEEP 5*60 ;SLEEP FOR 5 SECONDS
;
; NOW THAT CREDITS HAS BEEN ADJUSTED.....WE NEED TO
; START ATTRACT MODE
;
CALLR KILL_CRD
CALLA ATSTRT
CRX:
JAUC SUCIDE
KILL_CRD:
MOVI DUM_ID,A0
MOVE A0,*A13(PROCID),W
MOVI CP_PID2,A0
CLR A1
NOT A1
CALLA KILALL ;ITS DEAD!
MOVK 1,A0
MOVE A0,@GAMERASE
CALLA AUTOEON
CALLA DMAQWAIT ; WAIT FOR DMA TO BE DONE (IF IN MOTION)
RETS
DOCNT
MOVB @CNTDIG1,A1
JRZ SKIP1
MOVB A0,@CNTDIG1
SKIP1 MOVB @CNTDIG2,A1
JRZ SKIP1A
MOVB A0,@CNTDIG2
SKIP1A
RETS
;
DUMDIE:
SLEEP 1
DIE
;
;MAKE ALL SWITCH PROCESS DUMDIE ENTRIES
;
CLRSWPRC:
MMTM SP,A0,A1,A3
CLR A1 ;USE SWTAB ENTRY 0 FOR DUMDIE PROC
MOVE @SWSTACK,A3,L
CLRSTKL CMPI SWSTST,A3,L ;STACK AT START?
JREQ CLRSTKX ;YES, EXIT
MOVE *A3+,A0,W
CMPI 31,A0
JRLS CLRSTKL ;THIS ENTRY IS A REAL SWITCH
MOVE A1,*A3(-10H),W ;STORE THE DUMDIE CALL
JRUC CLRSTKL
CLRSTKX
MMFM SP,A0,A1,A3
RETS
*
* CR_STRTP - ARE THERE ENOUGH CREDITS TO START
* CR_CONTP - ARE THERE ENOUGH CREDITS TO CONTINUE
* P_START - PLAYER STARTED...DEDUCT CREDITS
* P_CONT - PLAYER CONTINUED...DEDUCT CREDITS
* CRED_P - HOW MANY CREDITS
*
* JRHS FOR OK TO START!
*
CR_STRTP:
MMTM SP,A0,A1
MOVI ADJFREPL,A0
CALLR GET_ADJ ;ARE WE IN FREE PLAY?
CMPI 1,A0 ;WE ARE IF ITS NOT ZERO.
JRHS CR_STX
CALLR CCCC ;MAKE SURE THINGS ARE IN TACT
CALLR COIN_PAG
CALLR GET_CREDITS ;GET CURRENT CREDITS
MOVE A0,A1
MOVI ADJCSTRT,A0
CALLR GET_ADJ ;GET NUMBER NEEDED
CMP A0,A1 ;DO WE HAVE ENOUGH TO START?
CR_STX:
MMFM SP,A0,A1
RETS
CR_CONTP:
MMTM SP,A0,A1
MOVI ADJFREPL,A0
CALLR GET_ADJ ;ARE WE IN FREE PLAY?
CMPI 1,A0 ;WE ARE IF ITS NOT ZERO.
JRHS CR_STX1
CALLR CCCC ;MAKE SURE THINGS ARE IN TACT
CALLR COIN_PAG
CALLR GET_CREDITS ;GET CURRENT CREDITS
MOVE A0,A1
MOVI ADJCCONT,A0
CALLR GET_ADJ ;GET NUMBER NEEDED
CMP A0,A1 ;DO WE HAVE ENOUGH TO START?
CR_STX1:
MMFM SP,A0,A1
RETS
P_START:
MMTM SP,A0,A1
CALLR CRED_P
MOVE A0,A1
MOVI ADJCSTRT,A0
CALLR GET_ADJ ;GET NUMBER NEEDED
CALLR REMOVE_CREDITS
CALLA DEC_HSR ;TAKE 1 FROM HIGH SCORE RESET COUNTER
MMFM SP,A0,A1
RETS
P_CONT:
MMTM SP,A0,A1
CALLR CRED_P
MOVE A0,A1
MOVI ADJCCONT,A0
CALLR GET_ADJ ;GET NUMBER NEEDED
CALLR REMOVE_CREDITS
CALLA DEC_HSR ;TAKE 1 FROM HIGH SCORE RESET COUNTER
MMFM SP,A0,A1
RETS
REMOVE_CREDITS:
SUB A0,A1 ;REMOVE START AMOUNT FROM WHAT WE HAVE
JRHS PS1 ;WE'RE OK.
CLR A1 ;IT WENT NEGATIVE....MAKE ZERO.
PS1:
CALLR COIN_PAG
MOVI CREDITS,A7
MOVE A1,A0 ;PUT WHATS LEFT OUT TO WRITE
CALLA WC_BYTE ;WRITE THE NEW AMOUNT
CALLR FORM_COIN_CKSUM_AND_STORE
CALLR DEF_PAGE ;POINT AT DEFAULT PAGE.
RETS
**************************************************************************
* *
* NO_CREDS *
* *
* THIS IS CALLED TO REMOVE CREDITS AND CREDIT FRACTIONS *
* FROM THE MACHINE. *
* *
**************************************************************************
NO_CREDS:
MMTM SP,A0,A1,A7
CALLR FORM_COIN_CKSUM ;MAKE THE REAL CKSUM
MOVI COIN_CKSUM,A7
MOVE A1,A0
INC A0 ;MAKE THE CKSUM BAD!
CALLA WC_BYTE
MMFM SP,A0,A1,A7
RETS
**************************************************************************
* *
* CHALK_COIN *
* *
* A11 contains the base audit number. Chalk the audit for *
* 1 more coin hit there! *
* *
* 3 away from the base is the "door-closed" counter *
* *
* 3 away from that is the "sub-total". *
* *
* 3 away from that is the "door-closed" sub-total. *
* *
* *
**************************************************************************
;CHALK_COIN:
; MMTM SP,A0
; MOVE A11,A0
;*
;* READY TO CHALK THE AUDIT......ZERO MEANS "EXTRA SLOT"
;*
;
;CCC01:
; CALLR CHALK_FOR_A0 ;CHALK RELEVANT COUNTERS
; MMFM SP,A0
; RETS
**************************************************************************
* *
* CHALK_FOR_A0 *
* *
* THIS IS CALLED TO CHALK THE AUDITS FOR A COIN SWITCH. *
* A0 HAS THE BASE AUDIT FOR THE COIN SWITCH. *
* *
**************************************************************************
;CHALK_FOR_A0:
; MMTM SP,A0
; CALLR AUD1 ;CHALK THE DIRECT AUDIT
; ADDI 2*CHUTES,A0 ;AND THE "SUB-TOTAL"
; CALLR AUD1
; SUBI CHUTES,A0 ;MOVE TO DOOR OPEN TOTAL
; CALLR AUD1
;
; ADDI 2*CHUTES,A0 ;AND DOOR OPEN SUB-TOTAL
; CALLR AUD1
;CKCN1:
; MMFM SP,A0
; RETS
**************************************************************************
* *
* ADJUST_CREDITS *
* *
* This is the routine that turns the coin switch hit *
* into a tangable (if you could say that) reward. *
* *
* The coin chute multiplier is in A8. *
* *
**************************************************************************
ADJUST_CREDITS:
MMTM SP,A0,A1,A2,A3,A4,A5,A6,A7,A8,A9,A10,A11
CALLR CK_MAX ;ARE WE AT MAXIMUM CREDITS?
JRHS ADCRXX ;YEP.....DON'T ROCK THE BOAT!
*
CALLR CCCC ;VALIDATE THE CURRENT TOTALS (OR CLEAR!)
CALLR FETCH_REQ ;GET THE REQUIRED FOR CREDIT, BONUS AND MINIMUM
*
* A2 = REQUIRED FOR CREDIT
* A3 = FOR BONUS
* A4 = MINIMUM
*
CALLR ADD_TO_CUNITS ;ADD TO OUR CUNITS
MOVE A3,A3 ;BONUS EFFECTIVE?
JRZ NO_BUNITS ;NOPE....DON'T RUN UP THE COUNTER!
CALLR ADD_TO_BUNITS ;ADD TO BONUS UNITS
NO_BUNITS:
MOVE A4,A4 ;MINIMUM REQUIRED?
JRZ NO_MINIMUM ;NOPE.....LEAVE ALONE.
MOVI MINUNITS,A7 ;POINT AT MINIMUM
CALLA RC_WORD ;GET THE AMOUNT ACCUMULATED
ADD A8,A0 ;ADD AMOUNT RECEIVED
CALLA WC_WORD ;WRITE THE MINUNITS BACK IN CASE NOT ENOUGH.
SUB A4,A0 ;DO WE HAVE ENOUGH TO ACT?
JRLO ADCRX ;NOPE....NO CREDITS YET!
CLR A0 ;CLEAR OUT MINIMUM FOR NEXT SHOT!
CALLA WC_WORD ;REMOVE ACCUMULATED MINIMUM.
NO_MINIMUM:
CLR A6 ;COUNT ACCUMULATED CREDITS IN A6
CLR A10 ;IN CASE NO BONUS!
CLR A8
MOVI BUNITS,A7
CALLA RC_WORD ;GET THE NUMBER OF BUNITS
MOVE A0,A9 ;INTO A9
MOVE A3,A3 ;DON'T DIVIDE BY ZERO!
JRZ NO_BU_BU
DIVU A3,A8 ;DIVIDE BUNITS BY NUMBER NEEDED FOR BONUS
MOVE A9,A0 ;WRITE REMAINDER BACK
CALLA WC_WORD
MOVE A8,A6 ;NUMBER OF BONUS CREDITS EARNED.
MOVE A8,A10 ;REMEMBER IF ANY BONUS CREDITS WERE EARNED!
NO_BU_BU:
CLR A8
CALLR GET_CUNITS ;READ IN THE CUNITS
MOVE A0,A9
MOVE A2,A2 ;DON'T DIVIDE BY ZERO.
JRZ NO_CR
DIVU A2,A8 ;GET CREDITS!
MOVE A9,A0 ;REMAINDER IS LEFTOVER CUNITS
CALLR PUT_CUNITS
ADD A8,A6 ;A6 HAS WHAT WE'VE WON!
NO_CR:
MOVE A6,A1
MOVI AUDPAIDC,A0
CALLA AUD ;CHALK UP THE EARNED CREDITS!
CALLR GET_CREDITS
ADD A6,A0 ;ADD IN THE NEW ONES.
CALLR PUT_CREDITS ;NOW STORE EM BACK (ENFORCE MAX)
MOVE A10,A10 ;WAS THE BONUS EARNED?
JRZ ADCRX ;NOPE...EXIT!
*
* WHEN BONUS EARNED...WE START THE WHOLE SYSTEM OVER!
*
CALLR CLEAR_UNITS
ADCRX:
CALLR FORM_COIN_CKSUM_AND_STORE
ADCRXX:
MMFM SP,A0,A1,A2,A3,A4,A5,A6,A7,A8,A9,A10,A11
RETS
**************************************************************************
* *
* PUT_CREDITS *
* *
* STORE CREDIT COUNT IN A0 TO CMOS....ENFORCING *
* MAXIMUM CREDITS. *
* *
**************************************************************************
PUT_CREDITS:
MMTM SP,A0,A6,A7
CALLR GET_MAX ;GET MAX CREDS IN A1....BE ON COIN PAGE
CMP A1,A0 ;SEE HOW WE STACK UP.
JRLO USE_A0 ;WE'RE LOWER...JUST STORE.
*
* WE'RE AT (OR OVER) MAXIMUM CREDITS
*
CALLR CLEAR_UNITS ;CLEAR OUT THE UNIT FRACTIONS.
MOVE A1,A0 ;USE MAXIMUM
USE_A0:
MOVI CREDITS,A7
CALLA WC_BYTE ;WRITE THE CREDITS OUT.
MMFM SP,A0,A6,A7
RETS
**************************************************************************
* *
* GET_MAX *
* *
* GET MAXIMUM CREDITS IN A1. *
* *
* THIS LEAVES YOU ON COIN PAGE. *
* *
**************************************************************************
GET_MAX:
MMTM SP,A0
MOVI ADJMAXC,A0
CALLA GET_ADJ_FOR_COIN ;FETCH MAXIMUM CREDITS (PUT US ON COIN PAGE)
MOVE A0,A1
MMFM SP,A0
RETS
**************************************************************************
* *
* CK_MAX *
* *
* THIS IS CALLED TO SEE IF WE ARE AT MAXIMUM CREDITS. *
* .HS. MEANS WE ARE AT MAXIMUM CREDITS. *
* *
**************************************************************************
CK_MAX:
MMTM SP,A0,A1
CALLR GET_MAX ;GET MAXIMUM IN A1
CALLR CRED_P ;GET CREDITS IN A0 (AND FLIP PAGE AWAY)
CMP A1,A0 ;JRHS FOR MAXIMUM CREDITS!
MMFM SP,A0,A1
RETS
**************************************************************************
* *
* UNIT_CLR *
* *
* THIS IS CALLED AT GAME OVER. IT CLEARS *
* OUT ANY COIN FRACTIONS THAT WERE NOT USED BY THE *
* CURRENT PLAYER(S). THIS ALLOWS ALL BUY-IN TO *
* TAKE ADVANTAGE OF MULTIPLE COIN BONUSES. *
* *
* ANYTIME A COIN IS INSERTED, C_FRAC IS SET TO ABOUT *
* 10 SECONDS. MY TIMING INTERFACE COUNTS C_FRAC DOWN *
* TO ZERO. IF C_FRAC IS NON ZERO WHEN THIS ROUTINE IS *
* CALLED, THEN SOMEONE PUT A COIN IN NOT TOO LONG BEFORE *
* GAME OVER. DON'T SCREW HIM OUT OF HIS FRACTIONS. *
* *
**************************************************************************
UNIT_CLR:
MMTM SP,A0
MOVE @C_FRAC,A0,W ;DO WE GIVE HIM A REPRIEVE?
JRNZ UC1 ;YEP!
CALLR CCCC ;VALIDATE COINAGE
CALLR CLEAR_UNITS ;CLEAR OUT FRACTIONAL UNITS
CALLR FORM_COIN_CKSUM_AND_STORE ;MAKE ALL GOOD.
UC1:
MMFM SP,A0
RETS
CLEAR_UNITS:
MMTM SP,A0,A7
CLR A0
MOVI CUNITS,A7 ;3 CONSECUTIVE WORDS OF CMOS
CALLA WC_WORDI
CALLA WC_WORDI
CALLA WC_WORD
MMFM SP,A0,A7
RETS
*
* RETURN CREDITS IN A0.........AND Z BIT CLEAR IF
* CREDITS EXIST OR IN FREE PLAY.
*
CRED_P:
CALLR CCCC ;CHECK TO SEE IF DATA IS OK.
GET_CREDITS:
MMTM SP,A7
CALLR COIN_PAG
MOVI CREDITS,A7 ;
CALLA RC_BYTE ;READ CURRENT CREDITS
JRNZ GC1 ;WE GOT SOME!
MMTM SP,A0 ;PUSH THE ZERO!
MOVI ADJFREPL,A0
CALLR GET_ADJ ;SEE IF FREEPLAY......(Z BIT CLEAR IF SO!)
MMFM SP,A0 ;RESTORE A0
GC1:
CALLR DEF_PAGE ;FLIP CMOS AWAY
MMFM SP,A7
RETS
ADD_TO_CUNITS:
MMTM SP,A0,A7
CALLR GET_CUNITS
ADD A8,A0
CALLR PUT_CUNITS
MMFM SP,A0,A7
RETS
GET_CUNITS:
MMTM SP,A7
MOVI CUNITS,A7
CALLA RC_WORD
MMFM SP,A7
RETS
PUT_CUNITS:
MMTM SP,A7
MOVI CUNITS,A7
CALLA WC_WORD
MMFM SP,A7
RETS
ADD_TO_BUNITS:
MMTM SP,A7,A0
MOVI BUNITS,A7
CALLA RC_WORD
ADD A8,A0
CALLA WC_WORD
MMFM SP,A7,A0
RETS
CRD_SCRN:
MOVI CP_PID1,A0 ;CHANGE OUR ID TO CREDIT 1
MOVE A0,*A13(PROCID),W
MOVI CP_PID2,A0 ;ARE WE SHOWING THE CREDIT PAGE?
CLR A1
NOT A1
CALLA EXISTP
JRZ NOT_CREDIT ;ITS NOT THE CREDIT PAGE...TRASH IT.
*
* CREDIT PAGE IS RUNNING....KILL IT!
*
MOVI CP_PID2,A0
CALLA KILALL
CALLA DMAQWAIT
*
* NOW BLANK THE AREA OF OUR INTEREST
*
* A3 = DAG OF AREA [YPOS,XPOS] *
* A4 = [Y,X] SIZE OF AREA *
MOVI 0680000H,A3 ;CORNER OF REGION
MOVI 0D80190H,A4
CALLA BLNKAREA ;BLANK IT OUT!
JRUC BLANKED_NOW_GO
NOT_CREDIT:
CALLA WIPEOUT ;TAKE DOWN WHATEVER'S RUNNING.
CALLA CLR_SCRN
SLEEP 1
MOVI 1,A0
MOVE A0,@DISPLAYON,W ;TURN THE DISPLAY PROCESSOR BACK ON!
SLEEP 1
CALLA COLRSTRT ;RESTART THE COLORS JACK
BLANKED_NOW_GO:
MOVI CPYR_MES,A8 ;COPYRIGHT MESSAGE
JSRP L_MESS
MOVI CP_PID2,A0 ;SET OUR ID BACK TO "CREDITS PAGE"
MOVE A0,*A13(PROCID),W ;SET OUR ID (IN CASE TABLE IS WRONG)
*
* BEWARE.....GET_CSTR SMASHES A LONG WORD IN THE PDATA AREA
* AT: AT PDATA + 3*LONG_SIZE
*
CALLR GET_CSTR ;GET THE CREDITS STRING
MOVE A8,A2 ;PUT IT IN NON-VOLITILE REGGIE!
CALLR SELECT_SETUP ;POINT AT PLACE BASED ON PROMPTING
CALLR LM_SETUP