forked from historicalsource/wwf-wrestlemania
-
Notifications
You must be signed in to change notification settings - Fork 0
/
AUDIT.axx
3420 lines (2881 loc) · 71 KB
/
AUDIT.axx
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
**************************************************************
*
* Software: LARRY DEMAR and DR. J
* Initiated: ?
*
* Modified: Shawn Liptak, 9/6/91 -SLEEPK (Total carnage)
* Shawn Liptak, 11/1/91 -Clean up
* Shawn Liptak, 2/11/91 -Started basketball
* Shawn Liptak, 11/6/92 -L_TIMER clean up
* Jason Skiles, 12/3/93 -Started WWF
*
* COPYRIGHT (C) 1992 WILLIAMS ELECTRONICS GAMES, INC.
*
*.Last mod - 12/3/93 9:52
**************************************************************
.file "audit.asm"
.title "audits and ajustments handling"
.width 132
.option b,d,l,t
.mnolist
.include "mproc.equ" ;mproc equates
.include "display.equ" ;display proc. equates
.include "sys.equ" ;z unit system equates
.include "gsp.equ"
.include "game.equ"
.include "link.equ" ;link equates
.include "menu.equ" ;menu equates
.include "audit.equ"
.include "macros.h"
.include "sound.h"
.include "fontsimg.glo"
.include "miscimg.glo"
.include "bgndtbl.glo"
.include "imgtbl.glo"
* 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 playtimer ,16 ;timer units for game
.BSS C_FRAC ,16 ;TIME 10 SECONDS TO
;INDICATE COIN ACTIVITY
.BSS C_FLAGS ,5*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 ;!0=Did 1st part
BSSX THIS_GAME_TIME,16
BSSX audit_ud_flag,16 ;audit_ud process active (EXISTP is
; too slow and we check this often.)
* IN THIS MODULE
; .def ADD_DUMP
.def ADJ_PAGE
.def BAD_AUD
.def C_FRAC,COINCNTR
.def C_FLAGS
.def L_MESS,AUD,AUD1,GET_ADJ
.def GET_AUD,SLAM_SW,STORE_AUDIT
.def CAT_A0
.def CCCC
.def CK_MAX
; .def CLRSWPRC
.def CLR_AUD,FAC_SET
.def CLR_AUDR
; .def CLR_SUBS
.def CMOS_VAL
.def COIN_PAG
; .def COINIRQ
.def CR_STRTP
.def CR_CONTP
.def CRD_SCRN
.def CRED_P
.def DEF_PAGE
; .def DUMP_FS
.def FORM_ADC
.def F_ADC_S
.def GET_CREDITS
.def GET_CSTR
.def HTOHXASC
; .def KILL_CRD
.def L_TIMER
.def LD_CTAB
.def LM_SETUP
.def LM_FINIS
.def NO_CREDS
.def P_START
.def P_CONT
.def PUT_ADJ
.def ROM_NAME
.def STRCAT
.def UNIT_CLR
.def WAIT_MUT
.DEF KILL_AUD
.ref PCNT
.def CCOIN,RCOIN,SERVICE,XCOIN,LCOIN
.DEF DBV
; .ref osgemd_ascii,sgmd8_ascii,ogmd10_ascii,lgmd_ascii
; .ref osgemd_ascii,sgmd8_ascii,ogmd10_ascii,wgsf24_ascii
.ref osgemd_ascii,ogmd10_ascii,wgsf24_ascii
.ref mess_cursy
.ref mess_line_spacing
.ref print_message,setup_message
.ref print_string_C,print_string_C2
.ref dec_to_asc
.ref copy_string,copy_rom_string
.ref concat_string,concat_rom_string
.ref BAKMODS
.ref BGND_UD1
.ref COUNTER_MODE
.GLOBAL SYNCHALF,WDOGDIS,GAMSTATE
.ref IRQSKYE
.ref PSTATUS
.ref attract_mode
.ref _coin_addr
.ref _dipswitch_addr
;from DCSSOUND.ASM
.ref triple_sound
.REF PSTARTS
* IN HSTD.ASM
.ref SET_PAGE
.ref P_FORK
.ref DEC_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
* IN ROBOATT.ASM
.ref WIPEOUT
* IN TEST.ASM
; .ref CK_DOOR
; .ref WT_ADV,WW_ADV
.ref FORM_SWS
.ref opmsg_clr
* OTHERS
; .ref plyr_strtb1,plyr_strtb2
.ref dirqtimer
.ref SOUNDSUP
.ref RD15FONT,RD7FONT,STRCNRM
.ref STRNGRAM,STRLNRM,HEXTOASC
.ref CLR_SCRN
.ref KILALL
.ref SUCIDE
.ref dpageflip
.ref TAMPEREDP
.ref _switch_addr
.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.
*
**************************************************************************
L_TIMER
move @GAMSTATE,a0
cmpi INAMODE,a0
jrne arjtNO_CK_OCTO ;ATTRACT MODE..CHECK OCTOPUS!
; move @SWITCH,a0
move @_switch_addr,a0,L
move *a0,a0
not a0
andi 07f7fH,a0 ;Get sticks 'n starts
move @OCT_FLG,a1
jrgt arjtp2 ;Got part one?
cmpi 07171H,a0 ;P1&P2 all buts down & both sticks up
jrne arjtNO_CK_OCTO ;Wrong?
movi TSEC,a1 ;One sec to get part two
arjtp2
subk 1,a1
move a1,@OCT_FLG
jrgt arjtNO_CK_OCTO ;Still counting?
cmpi 0202H,a0
jrne arjtNO_CK_OCTO ;Wrong?
movi ACTIVE,a13
; movi HID_P,a7 ;Start the process!
; movi DIAG_PID,a1
movi AMODE_PID,a1
.ref octopus_page
movi octopus_page,a7
calla GETPRC
arjtNO_CK_OCTO ;ATTRACT MODE..CHECK OCTOPUS!
move @dirqtimer,a1 ;get elapsed time
move @playtimer,a0 ;get play timer
sub a1,a0 ;add elapsed time
move a0,@playtimer
jrgt arjtnot5 ;Under 5 seconds?
CREATE AUDIT_UD_PID,audit_ud
movi TSEC*5,a0 ;reset the countdown
arjtnot5
move a0,@playtimer
rets
;each call to AUD1 takes 2 days to execute
;so it's now split over 3 frames
SUBRP audit_ud
movi 1,a14
move a14,@audit_ud_flag
move @GAMSTATE,a14
jrn arjtskip ;in diagnostics
move @PSTATUS,a14
jrz arjtskip ;no players
;oops ! wrong order
movi AUD_1PLAYTIME,a0 ;update the 1/2P time
cmpi 3,a14
jrne arjt1pmode
movi AUD_2PLAYTIME,a0
arjt1pmode
callr AUD1
MOVE @PSTATUS,A14
JRZ NO_NEED_TO_DO_ANYTHING
CMPI 3,A14
JREQ BETTER_STOP_THIS
MOVE @PSTARTS,A0
JRZ NO_NEED_TO_DO_ANYTHING
MOVE @THIS_GAME_TIME,A0
INC A0
MOVE A0,@THIS_GAME_TIME
JRUC NO_NEED_TO_DO_ANYTHING
BETTER_STOP_THIS
CLR A0
MOVE A0,@PSTARTS
MOVE A0,@THIS_GAME_TIME
NO_NEED_TO_DO_ANYTHING
SLEEPK 1
movi AUD_PLTIME,a0
callr AUD1
SLEEPK 1
arjtskip
movi AUD_UPTIME,a0 ;update the total uptime
callr AUD1
clr a14
move a14,@audit_ud_flag
DIE
.if 0
move @PSTATUS,a2
jrz arjtaudup
move @GAMSTATE,a2
jrn arjtaudup
movi AUD_1PLAYTIME,a0 ;update the 1/2P time
cmpi 3,a2
jrne arjt1pmode
movi AUD_2PLAYTIME,a0
arjt1pmode
callr AUD1
movi AUD_PLTIME,a0
callr AUD1
arjtaudup
movi AUD_UPTIME,a0 ;update the total uptime
callr AUD1
movi TSEC*5,a0 ;reset the countdown
arjtnot5
rets
.endif
*******************************
* Give him a service credit
SERVICE
move @GAMSTATE,a0
jrn gebkx ;In diagnostics?
move @_coin_addr,a0,L ;Get COIN inputs
move *a0,a0
btst CDI_BIT,a0 ;Coin Door Closed ?
jrz gebkx ;Yes - Then NO Service Credits Allowed
callr CCCC ;MAKE SURE THINGS ARE IN TACT
movk AUDSERV,a0
callr AUD1 ;CHALK UP A SERVICE CREDITS!
callr getcoin
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
;Update little credit message
.ref update_credit_msg
calla update_credit_msg
jruc CREDSP
gebkx DIE
********************************
* THE FOLLOWING COIN ROUTINES ARE PROCESSES!
LCOIN MOVK ADJLMULT,A8 ;CMOS RAM ADJUST
MOVI LC_FLAG,A10 ;LEFT COIN FLAG
MOVI AUDLCOIN,A11 ;AUDIT NUMBER
JRUC VALID_COIN
CCOIN MOVK ADJCMULT,A8
MOVI CC_FLAG,A10 ;CENTER COIN FLAG
MOVI AUDCCOIN,A11
JRUC VALID_COIN
RCOIN MOVK ADJRMULT,A8
MOVI RC_FLAG,A10 ;RYTE COIN FLAG
MOVI AUDRCOIN,A11
JRUC VALID_COIN
XCOIN MOVK ADJXMULT,A8
MOVI XC_FLAG,A10 ;XTRA (FOURTH) COIN FLAG
MOVI AUDXCOIN,A11
JRUC VALID_COIN
DBV MOVK ADJDBVMULT,A8
MOVI DBV_FLAG,A10 ;XTRA (FOURTH) COIN FLAG
MOVI AUD_DBV,A11
JRUC VALID_COIN
;
; COIN CONTROL EQUATES
;
LC_FLAG .EQU C_FLAGS ;UHB LEFT COIN
RC_FLAG .EQU C_FLAGS+8 ;UHB RGT "
CC_FLAG .EQU C_FLAGS+16 ;UHB CNTR "
XC_FLAG .EQU C_FLAGS+24 ;UHB XTRA "
DBV_FLAG .EQU C_FLAGS+32 ;UHB DOLLAR BILL VALIDATOR
;
; 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
jrn CRX ;In diagnostics?
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 4 SLOTS USE THIS ID NOW
MOVE A0,*A13(PROCID) ;SET OUR ID (IN CASE TABLE IS WRONG)
; movb *a10,a0 ;get flag byte
; jrz gebkfok
; LOCKUP
;gebkfok
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 5,a0 ;Wait a few ticks
movb a0,*a10
COIN_LOOP
SLEEPK 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 ;TURN SOUNDS ON. (A-MODE SOUND SUPRESSOR)
callr getcoin
MOVI 15*40H/8,A0 ;DON'T WIPE ON GAME OVER IF ITS WITHIN
MOVE A0,@C_FRAC ;15 SECONDS (THIS TIMES OUT TO OVER 20)
MOVE A11,A0
CALLR AUD1 ;CHALK THE DIRECT AUDIT
*HIT THE MECHANICAL COIN COUNTERS
MOVE @COUNTER_MODE,A0,W
CMPI 1,A0
JRNE MECH20
MOVI ADJTOTALIZER,A0
CALLA GET_ADJ
JRZ NORMAL_TOTALIZER
MOVI ADJTOTALIZER,A0
ADD A11,A0
CALLA GET_ADJ
MOVE A0,A2
MOVI COINCNT1,A1
JRUC RE_ENTER_FROM_CUST_TOTALIZER
NORMAL_TOTALIZER
*MULTIPLE OF LEAST VALUE COIN MODE
CALLA GET_CSPT ;POINT TO COIN TABLE A6
; MOVK 5,A1 ;CHECK ALL CHUTES
; ADDI CS_LVAL,A6 ;ADD IN OFFSET TO CHUTE VALUES
; MOVE A6,A5 ;SAVE A6
; CLR A2
; NOT A2
;MECH1L
; MOVE *A5+,A0 ;FIND LOWEST NON-ZERO NUMBER IN LIST
; JRZ MECH_SKIPZ
; CMP A2,A0
; JRHI MECH_SKIPZ
; MOVE A0,A2 ;A NEW LOW!
;MECH_SKIPZ
; DSJS A1,MECH1L
ADDI CS_LVAL,A6 ;ADD IN OFFSET TO CHUTE VALUES
DEC A11 ;GET YOUR CLICK COUNT
SLL 4,A11 ;OFFSET FOR CHUTE, WORD CORRECT
ADD A11,A6
MOVE *A6,A2 ;GET MONEY VALUE
MOVE A2,A2
JRZ MECH10 ;SOMETHING ILLEGAL HAPPENED, JUST ONE
RE_ENTER_FROM_CUST_TOTALIZER
; CALLA GET_CSPT ;POINT TO COIN TABLE A6
; DEC A11 ;GET YOUR CLICK COUNT
; SLL 4,A11 ;OFFSET FOR CHUTE, WORD CORRECT
; ADD A11,A6
; MOVE *A6,A1 ;GET MONEY VALUE
; JRZ MECH10 ;WIERDNESS, JUST ONE CLICK
; DIVU A2,A1 ;DIVIDE BY LOWEST COMMON DENOMINATOR
; MOVE A1,A2 ;RESULT TO KEEP COMPAT
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 @GAMSTATE,A0
; CMPI INAMODE,A0
; JRNZ NOZERO
;NOZERO
; move @GAMSTATE,a0
; cmpi INGAME,a0
; jrne gebknot_ingame
calla update_credit_msg
;gebknot_ingame
MOVE @PSTATUS,A0
JRNZ CRX
move @GAMSTATE,a0
subk INAMODE,a0 ;A DISPLAY IN AMODE ONLY!
jrne CRX
CRY jruc CRD_SCRN ;PUT UP THE CREDITS SCREEN
CRX JAUC SUCIDE
********************************
* 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
; CMPI 31,A0
; JRLS CLRSTKL ;THIS ENTRY IS A REAL SWITCH
; MOVE A1,*A3(-10H) ;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
PUSH a0,a1
MOVK 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
MOVK 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
PUSH a0,a1
MOVK 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
MOVK 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
MOVK ADJCSTRT,A0
CALLR GET_ADJ ;GET NUMBER NEEDED
CALLR REMOVE_CREDITS
CALLA DEC_HSR ;TAKE 1 FROM HIGH SCORE RESET COUNTER
calla update_credit_msg
MMFM SP,A0,A1
RETS
P_CONT
MMTM SP,A0,A1
CALLR CRED_P
MOVE A0,A1
MOVK ADJCCONT,A0
CALLR GET_ADJ ;GET NUMBER NEEDED
CALLR REMOVE_CREDITS
CALLA DEC_HSR ;TAKE 1 FROM HIGH SCORE RESET COUNTER
calla update_credit_msg
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
PUSH a0
MOVK 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
PUSH a0
MOVE @C_FRAC,A0 ;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
PUSH a7
CALLR COIN_PAG
MOVI CREDITS,A7 ;
CALLA RC_BYTE ;READ CURRENT CREDITS
JRNZ GC1 ;WE GOT SOME!
;PUSH THE ZERO!
PUSH a0
MOVK 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
PUSH a7
MOVI CUNITS,A7
CALLA RC_WORD
MMFM SP,A7
RETS
PUT_CUNITS
PUSH 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
CLR a10 ;Sleep 7 secs
SUBR CRD_SCRN2 ;Entry pnt for shorter sleep
clr a0