forked from historicalsource/smashtv
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathTEST.ASM
2480 lines (2235 loc) · 104 KB
/
TEST.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 "TEST.ASM"
.TITLE "ROBO TEST PROGRAM"
.WIDTH 132
.OPTION B,D,L,T
.MNOLIST
;
;
; 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 "LINK.EQU" ;LINKY EQUATES
.INCLUDE "MENU.EQU" ;MENU EQUATES
.TEXT
*
* IN THIS MODULE
*
.DEF DIAG,CHK_CMOS
.DEF GEN_MENU,B_MENU
.DEF TOP_BOX ;,WT_ADV
; .DEF WW_ADV
.DEF MAIN_RET,GMENULEV
; .DEF CK_DOOR
.DEF AREUSURE
.DEF F_TITLE
.DEF ST_STICK
.DEF GETSTICK
.DEF SUR_MESS
.DEF SURE_BOX
.DEF RT_RET,ROM_RET
.DEF GET_FAC
.DEF MENU_TOP
.DEF CYAN_BOX
.DEF BLNKHELP,H_SLAVE
.DEF DOBORDER
.DEF COL_INST
.DEF STD_BORD
.DEF DIAG_EX
.DEF WAIT_BUT
.DEF DIGSRT
; .DEF GET_ADV
.DEF SND_MADE
.DEF NO_CLEAR
.DEF LAST_BUT
.DEF G_BORDER
.DEF FORM_SWS
; .DEF LINKY
*
* IN AUDIT.ASM
*
.REF CMOS_VAL,L_MESS,DISPDUMP
.REF LM_SETUP,LM_FINIS
.REF FORM_ADC
.REF F_ADC_S
.REF GET_AUD
.REF FAC_SET
.REF CRED_P
.REF BAD_AUD
.REF CLR_AUD
.REF ADJ_PAGE
.REF COIN_PAG
.REF ROM_NAME
.REF STORE_AUDIT
*
* IN HSTD.ASM
*
.REF ALL_TAB,INIT_TB,TOD_TAB
.REF INIT_TAB
.REF VAL_TAB
.REF P_FORK
.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 MEN_MAIN,ANY_BUT,MEN_YN
.REF MESS_FAC
.REF GO_DIAG ;ROUTINE FOR DIAGNOSTIC MENU
.REF RTR_LEV,ROM_LEV
.REF FAC_STUF
.REF SCODE ;SYNTH CODE CURRENTLY BEING MADE
.REF DCODE ;DIG CODE CURRENTLY BEING MADE
*
* IN ADJUST.ASM
*
.REF DO_ADJH
;
; IN ROBOATT.ASM
;
.REF WIPEOUT
.REF COLRSTRT
*
* OTHERS
*
.REF WARMSET
.REF QSNDRST
.REF FILLAREA
.REF STRNGLEN
.REF RD15FONT,RD7FONT,STRCNRM,GAMSTATE
.REF IRQSKYE,BLNKAREA,STRLNRM,CLR_SCRN
.REF DMAQWAIT,P1DATA,P2DATA
.REF WDOGDIS
*
* MAIN_RET
*
* POSITIVE NUMBER HERE SAYS RETURN (UPWARD) TO MAIN MENU (GEN_MENU ONLY)
* NEGATIVE NUMBER HERE SAYS SETUP RESTORE AFTER RAM TEST. (GEN_MENU)
*
.BSS MAIN_RET,16 ;FLAG SAYS RETURN TO MAIN MENU
.BSS GMENULEV,16 ;HOW DEEP INTO GEN_MENU WE ARE
.BSS SND_MADE,16 ;SOUND TEST FLAG
.BSS NO_CLEAR,16 ;FLAG TELLS GET_MENU NOT TO CLEAR!
.BSS LAST_BUT,32
.BSS SPTEMP,32 ;STACK POINTER TEMP
.TEXT
**************************************************************************
* *
* RT_RET *
* *
* THIS IS THE RETURN POINT FROM THE RAM TEST. *
* *
* SINCE RAM TEST SMASHES RAM, THE MENU "JSRP" *
* GEN_MENU TREE HAS BEEN SMASHED. *
* THIS PROCESS IS CALLED AFTER RAM TEST WHICH MUST GET THE * *
* "MONITOR PATTERN" PART OF THE DIAGNOSTIC TEST *
* UP TO BE SELECTED. *
* *
**************************************************************************
RT_RET:
CALLR DIAG_STATE ;GET THE STATE RIGHT.....BUT DON'T MESS UP TILL BUTTON
JSRP WAIT_BUT ;NOW WAIT FOR ANY BUTTON.
CALLR DIGSRT ;MAKE SURE WE'RE IN TEST MODE
CLR A0
MOVE A0,@GMENULEV,W ;INDICATE WE'RE AT LEVEL ZERO.
MOVI RTR_LEV,A0 ;THIS IS THE LEVEL TO DIVE TO
NEG A0 ;NEGATE IT AS FLAG TO DIVE.
MOVE A0,@MAIN_RET,W ;INDICATE
JAUC DIAG_RESTART ;NOW START IT UP....
**************************************************************************
* *
* ROM_RET *
* *
* THIS IS RETURN FROM ROM TEST. SINCE WE NEED TO TEST *
* RAM BEFORE ROM, OUR STATE IS ALSO SMASHED FROM ROM TEST. *
* *
**************************************************************************
ROM_RET:
CALLR DIAG_STATE ;GET THE STATE RIGHT.....BUT DON'T MESS UP TILL BUTTON
JSRP WAIT_BUT ;NOW WAIT FOR ANY BUTTON.
CALLR DIGSRT ;MAKE SURE WE'RE IN TEST MODE
CLR A0
MOVE A0,@GMENULEV,W ;INDICATE WE'RE AT LEVEL ZERO.
MOVI ROM_LEV,A0 ;THIS IS THE LEVEL TO DIVE TO
NEG A0 ;NEGATE IT AS FLAG TO DIVE.
MOVE A0,@MAIN_RET,W ;INDICATE
JAUC DIAG_RESTART ;NOW START IT UP....
**************************************************************************
* *
* WAIT_BUT *
* *
* THIS IS CALLED ON RETURN FROM MANY OF THE "HARD" *
* DIAGNOSTIC TESTS TO HOLD CONTROL TILL ANY BUTTON IS *
* HIT. *
* *
**************************************************************************
WAIT_BUT:
CALLR FORM_SWS ;1ST STATE DOESN'T COUNT
*
* RETURN CURRENT STATE IN A0..PREVIOUS STATE IN A1.
*
WB1:
SLEEP 1
CALLR FORM_SWS
NOT A1 ;LAST = 0 AND NOW = 1 MEANS EDGE!
AND A1,A0 ;1'S WHERE WE HAVE POSITIVE EDGE.
ANDI BUTTONS,A0 ;IS IT A BUTTON?
JRZ WB1
SOUND1 BEEP_1 ;MAKE A BEEP
RETP
**************************************************************************
* *
* DIAG *
* *
* THIS IS THE ENTRY TO THE MAIN DIAGNOSTIC MENU. *
* *
**************************************************************************
DIAG:
MOVI AUDSTAT,A0
CLR A1
CALLA STORE_AUDIT
MOVE @GAMSTATE,A0,W
CMPI INDIAG,A0
JRNZ DIAG_JUMP
JAUC SUCIDE
DIAG_JUMP:
CALLR DIGSRT ;MAKE SURE WE'RE IN TEST MODE
; JSRP WW_ADV ;HOLD UNTIL HE LETS GO!
CLR A0
MOVE A0,@MAIN_RET,W ;CLEAR THE FLOAT TO TOP FLAG.
MOVE A0,@GMENULEV,W ;INDICATE WE'RE AT LEVEL ZERO.
DIAG_RESTART:
MOVI MEN_MAIN,A8
JSRP GEN_MENU ;PROCESS THIS MENU!
*
* HE (FINALLY) PICKED EXIT....RETURN!
*
DIAG_EX:
SLEEP 2 ;LET DMA EMPTY OUT IF NECESSARY
CALLA CMOS_VAL ;IF SETTINGS SMASHED....FIX EM.
; JANZ SETUP
JAUC WARMSET
**************************************************************************
* *
* GEN_MENU *
* *
* THIS IS A GENERAL MENU HANDLER. IT POSTS THE MENU *
* WITH SELECTION 1 AVAILABLE. AFTER A SELECTION IS *
* MADE, IF IT HAS A ROUTINE CODE OF ZERO, (EXIT) *
* IT RETURNS TO THE LEVEL ABOVE IT. ELSE, IT *
* JSRP'S THE NEW ROUTINE. WHEN THE NEW ROUTINE *
* RETURNS, WE RE-POST THE SAME MENU WITH THE *
* BAR ON THE FOLLOWING ENTRY. *
* *
* A8 = MENU DESCRIPTOR *
* *
**************************************************************************
*
* MENU ROM OFFSETS
*
MR_FONT EQU 0
MR_TCAL EQU MR_FONT+LONG_SIZE
MR_TITLE EQU MR_TCAL+LONG_SIZE ;POINTER TO TITLE FOR TILE BOX (IF NEC)
MR_TCLR EQU MR_TITLE+LONG_SIZE ;COLOR OF TITLE
MR_WORDS EQU MR_TCLR+WORD_SIZE ;STREAM OF WORDS TO COPY TO PDATA STARTS HERE
MR_X EQU MR_WORDS
MR_Y EQU MR_X+WORD_SIZE
MR_DY EQU MR_Y+WORD_SIZE
MR_COL EQU MR_DY+WORD_SIZE
MR_HITE EQU MR_COL+WORD_SIZE
MR_BDY EQU MR_HITE+WORD_SIZE
MR_DX EQU MR_BDY+WORD_SIZE
MR_WID EQU MR_DX+WORD_SIZE
GEN_MENU:
MOVE @GMENULEV,A0,W ;KICK LEVEL POINTER
INC A0
MOVE A0,@GMENULEV,W
*
MOVE A8,-*A12,L ;SAVE MENU PTR
MOVI 1,A8 ;START WITH "FIRST" ENTRY
MOVE A8,-*A12,W ;PUT MENU NUMBER AS A WORD
*
* IF WE GET HERE AND MAIN_RET IS NOT ZERO, THE WE MUST
* RETURN TO LEVEL ABOVE US IF WE'RE NOT THE MAIN
* MENU.
*
GEN_LOOP:
MOVE @MAIN_RET,A0,W ;ARE WE IN "EXIT" MODE?
JRZ NO_EXIT ;NO
JRN DIVE_TO_MONITOR ;WE'RE DIVING TO MONITOR PATTERNS.
MOVE @GMENULEV,A0,W ;CHECK LEVEL
CMPI 1,A0 ;ARE WE AT LEVEL 1
JRNZ GEN_EXIT ;NOPE.....POP UP A LEVEL.
*
* WE'RE AT LEVEL 1....CLEAR OUT THE FLAG THAT
* GOT US HERE.
*
DIVE_COMPLETE:
CLR A0
MOVE A0,@MAIN_RET,W ;NOW WE MAY PROCEED!
NO_EXIT:
MOVE @NO_CLEAR,A0,W ;INHIBIT CLEAR?
JRNZ SKIP_CLR
CLR B13
CALLA CLR_SCRN ;CLEAR THE SCREEN
SKIP_CLR:
CLR A0
MOVE A0,@NO_CLEAR,W ;AND RE-SET IT!
MOVE *A12(WORD_SIZE),A8,L ;GET MENU DESCRIPTOR
JSRP MENU_TOP
JSRP CYAN_BOX ;PUT UP MAIN MENU INSTRUCTIONS
MOVE *A12,A9,W ;GET MENU NUMBER TO USE
JSRP B_MENU ;GET RESULT
PHONEY_MENU_RET:
MOVE A10,A10 ;WAS IT ADVANCE?
JRZ NO_KICK ;NOPE....LEAVE WHERE HE CAME FROM
INC A8 ;KICK INDEX BY 1 FOR NEXT TIME
NO_KICK:
MOVE A8,*A12,W ;AND LEAVE ON THE STACK
MOVE A9,A9 ;NOW JSRP THE ROUTINE
JRZ GEN_EXIT ;NONE THERE....ITS "EXIT"
*
* JSRP TO A9
*
MOVI GEN_LOOP,A7
MOVE A7,-*A12,L ;PUSH RET ADDR
JUMP A9
GEN_EXIT:
ADDI WORD_SIZE+LONG_SIZE,A12 ;POP THE ARGUMENTS
MOVE @GMENULEV,A0,W ;KICK LEVEL POINTER
DEC A0
MOVE A0,@GMENULEV,W
RETP
**************************************************************************
* *
* DIVE_TO_MONITOR *
* *
* WE GET CONTROL HERE WHEN WE ARE KLUDGING THE RETURN *
* FROM "CPU" TEST (WHICH BLOWS AWAY RAM!) *
* *
**************************************************************************
DIVE_TO_MONITOR:
MOVE @GMENULEV,A0,W ;CHECK LEVEL
CMPI 1,A0 ;ARE WE AT LEVEL 1
JRNZ DTM1 ;NOPE....SET "MONITOR" LEVEL
*
* WE'RE AT LEVEL 1......."SELECT" THE DIAGNOSTIC MENU
* A8 = 1.....A9 = ROUTINE FOR DIAGNOSTIC MENU
*
MOVK 1,A8
MOVI GO_DIAG,A9 ;ROUTINE FOR DIAGNOSTIC MENU
MOVK 1,A10 ;RETURN AS IF ADVANCE WAS PRESSED
JRUC PHONEY_MENU_RET ;WE'RE READY TO CALL DIAG MENU
*
* WE'RE IN DIAGNOSTIC MENU....NOW WE JUST NEED TO MAKE
* THE "CURRENT" SELECTION THE ONE AFTER CPU TEST
* (MONITOR PATTERNS)
*
DTM1:
MOVE @MAIN_RET,A8,W ;FLAG IS OPPOSITE OF ENTRY NUMBER
NEG A8 ;THIS IS RETURN LEVEL!
* MOVI RTR_LEV,A8 ;START WITH "RETURN" ENTRY NUMBER
MOVE A8,*A12,W ;PUT MENU NUMBER AS A WORD
JRUC DIVE_COMPLETE ;THIS COMPLETES THE DIVE!
**************************************************************************
*
* FOR DOBORDER
*
* A4 = UPPER LEFT Y,X
* A5 = LOWER RIGHT Y,X
* A0 = Y,X WIDTH OF BORDER
* A9 = COLOR OF BORDER.
**************************************************************************
* *
* TOP_BOX *
* *
* THIS DISPLAYS THE TEST BOX AT THE TOP. *
* *
* A2 POINTS AT THE STRING TO CENTER IN THE BOX. *
* A3 IS COLOR TO DO IT IN. *
* *
**************************************************************************
MENU_TOP:
MOVE *A8(MR_TITLE),A2,L ;GET TITLE INTO A2
MOVE *A8(MR_TCLR),A3,W ;AND COLOR INTO A3
TOP_BOX:
MOVE A8,-*A12,L ;PUSH MENU PTR
*
* FIRST MAKE THE BOX...IT BLACKS OUT THE REGION
*
CALLR SCR_BOX ;PUT UP THE TITLE BOX
MOVI MESS_TITLE,A8 ;SET PARAMETERS
CALLA LM_SETUP ;PUT IT OUT.
MOVE A2,A8 ;GET STRING IN THE CORRECT REGGIE
MOVE A3,A6 ;MOVE COLOR TO COLOR REGGIE
*
JSRP LM_FINIS ;AND PRINT IT!
JSRP SCR_REV ;NOW ADD THE REV.
MOVE *A12+,A8,L ;RESTORE THE MENU PTR
RETP
**************************************************************************
* *
* SCR_REV *
* *
* DISPLAY REV IN TITLE BOX. *
* *
**************************************************************************
SCR_REV:
MOVI MESS_REV,A8 ;GET READY FOR REV MESSAGE
CALLA LM_SETUP ;SETUP FOR REV MESSAGE
MOVI ROM_NAME,A8 ;USE ROM COPY OF REV.
JSRP LM_FINIS ;FINISH PRINTING MESSAGE
RETP
**************************************************************************
* *
* SCR_BOX *
* *
* THIS DISPLAYS THE TITLE BOX. *
* *
**************************************************************************
SCR_BOX:
MOVI TIT_ULX+(10000H*TIT_ULY),A4 ;UPPER LEFT
MOVI TIT_LRX+(10000H*TIT_LRY),A5 ;UPPER LEFT
MOVI ROBO_ORANGE,A9
CALLR STD_BORD
RETS
*
* THIS PRINTS THE "MOVE JOYSTICK" BOX.
*
* A8 = MENU DESCRIPTOR THAT WILL ACCOMPANY IT
* ON SCREEN. WE ADJUST THE BOX EDGES AND
* MESSAGE CENTER IN "X" ONLY TO CORRESPOND
* TO THE MENU BOX.
*
CYAN_BOX:
MOVE A8,-*A12,L ;PUSH THE MENU PTR
MOVI ROBO_CYAN,A9
CALLR COL_INST ;THIS PRINTS BOX AND STASHES
* ;CENTER X AT *A13(PDATA),W
MOVI MM_INST1,A8 ;POINT AT INSTRUCTIONS MESSAGE
JSRP C_PD_M
MOVI MM_INST2,A8 ;POINT AT INSTRUCTIONS MESSAGE
JSRP C_PD_M
MOVE *A12+,A8,L ;GET BACK MENU PTR.
RETP
**************************************************************************
* *
* COL_INST *
* *
* THIS PRINTS OUT THE "CYAN" INSTRUCTION BOX *
* IN THE COLOR SPECIFIED BY A9. *
* *
**************************************************************************
COL_INST:
*
* WE NEED TO DETERMINE LEFT AND RIGHT X
*
CALLR STUFF_MENU_PROCESS ;MOVE DATA INTO PDATA AREA
CALLR MEN_NUMS ;GET THE NUMBERS FOR THIS MENU
MOVE A6,*A13(PDATA),W ;STASH THE X CENTER
ADDI 10000H*INST_ULY,A4 ;UPPER LEFT Y
ADDI 10000H*INST_LRY,A5 ;UPPER LEFT X
CALLR STD_BORD
RETS
**************************************************************************
* *
* MEN_NUMS *
* *
* THIS IS CALLED TO GET SOME NUMBERS ASSOCIATED *
* WITH A MENU BOX. *
* *
* THIS RETURNS: *
* *
* A4 = LEFT X *
* A5 = RIGHT X *
* A6 = CENTER X *
* *
**************************************************************************
MEN_NUMS:
CALLR MENU_UL_A4_A5 ;LEFT X IN A4
CALLR MENU_LR_A6_A5 ;RIGHT X IN A6
MOVE A6,A5 ;COPY RIGHT X INTO A5
ADD A4,A6 ;FIND CENTER
SRL 1,A6 ;A6 NOW HAS CENTER X (FOR LATER)
RETS
**************************************************************************
* *
* C_PD_M *
* *
* THIS PRINTS A L_MESS MESSAGE PASSED IN A8, CENTERED *
* ON THE X STORED AT *A13(PDATA),W *
* *
**************************************************************************
C_PD_M:
CALLA LM_SETUP ;SETUP THE MESSAGE
ANDI 0FFFF0000H,A9 ;REMOVE X
MOVE *A13(PDATA),A3,W ;GET THE X
ADD A3,A9 ;PUT OUR X IN
JUMP A1 ;AND "CALL" THE ROUTINE
**************************************************************************
* *
* DIGSRT *
* *
* THIS IS CALLED ON ENTRY TO DIAGNOSTICS. *
* *
**************************************************************************
DIGSRT:
CALLR DIAG_STATE
CALLA WIPEOUT ;INITIALIZE THE OBJECT LIST
CALLA COLRSTRT ;RESTART THE COLOR PROCESSES.
CALLA QSNDRST ;kill any sounds in progress
MOVK 1,A0
MOVE A0,@DISPLAYON,W ;WE NEED TO SEE THE STUFF JACK
CALLA CLR_SCRN ;CLEAR THE SCREEN!
RETS
DIAG_STATE:
CLR A1
CALLA KILALL ;KILL ABSOLUTELY EVERYONE!
MOVI DIAG_PID,A1 ;SET OUR ID TO DIAGNOSTICS MAN
MOVE A1,*A13(PROCID),W ;PASS OUR ID TO FORKED PROCESS
MOVI INDIAG,A0
MOVE A0,@GAMSTATE,W ;PUT US IN TEST MODE!
RETS
**************************************************************************
* *
* CHK_CMOS *
* *
* This is the routine that is called at power up. *
* *
* It checks to see if CMOS adjustments are in tact. *
* IF THE ADJUSTMENTS ARE BAD, OR SET FOR A DIFFERENT *
* GAME OR REVISION, we cause a factory setting to *
* occur. We then try and validate the all time *
* HSTD table. If this is bad we then zero audits. *
* If HSTD table is ok, then we leave audits alone. *
* *
**************************************************************************
CHK_CMOS:
CALLR DIGSRT ;CLEAR OUT THE SCREEN...(MESSAGE WILL FOLLOW!)
CALLA CMOS_VAL
JRNZ FAC_TIME
MOVI MESS_BITCHIN,A2 ;POINT AT DATA
MOVI ROBO_WHITE,A3
JSRP TOP_BOX
SLEEP 18H
RETP
; JAUC WARMSET ;CMOS IS OK....RETURN!
*
* WE NEED TO FACTORY SET THIS THING (DUE TO BAD SETTINGS.)
*
FAC_TIME:
JSRP GET_FAC ;GET THE GAME TO FACTORY SETTINGS!
; JSRP WW_ADV ;WAIT WHILE ADVANCE IS PRESSED
;
; JSRP WT_ADV ;NOW WAIT TILL ADVANCE IS PRESSED
;
CALLA CLR_SCRN ;PRESSED....BLANK THE SCREEN AND
;HOLD TILL HE LETS GO.
;
; JSRP WW_ADV ;HOLD CONTROL HERE TILL HE LETS GO
JAUC WARMSET ;CMOS IS OK....RETURN!
; JRUC DIAG_JUMP ;NOW INTO TEST MODE FOR ADV. BUTTON.
**************************************************************************
* *
* GET_FAC *
* *
* THIS IS CALLED TO BRING THE GAME TO A FACTORY SETTINGS *
* STATE. IT WILL STORE THE FACTORY SETTINGS OR WAIT *
* UNTIL THE DOOR IS OPEN. IF IT CAN'T GET FACTORY SETTINGS *
* IT WILL PRINT A FAILURE MESSAGE. *
* *
**************************************************************************
GET_FAC:
*
FAC_LOOP:
CALLA CLR_SCRN ;CLEAR SCREEN IN ANTICIPATION OF MESSAGE
CALLA FAC_SET ;THIS DOES THE DEED!
CALLA CMOS_VAL ;IS IT OK NOW?
JRZ CMOS_FIXED ;YEP....FINISH CLEANUP!
MOVI MESS_FAIL,A8 ;POINT AT DATA
JSRP L_MESS ;DISPLAY LARRY MESSAGE
JRUC WAIT_POINT ;WE'RE DEAD.....ADVANCE TAKES US TO TEST MODE!
CMOS_FIXED:
*
* THIS IS WHERE WE ARE ONCE WE HAVE FACTORY SET....
* MESSAGE WOULD GO HERE.
*
CALLR CENT_BOX ;PUT A BOX AROUND IT
*
MOVI MESS_FAC,A8 ;POINT AT DATA
JSRP L_MESS ;DISPLAY LARRY MESSAGE
*
* NOW.....CLEAR HIGH SCORE TABLE
* CLEAR OUT THE AUDITS.
*
CALLA FAC_STUF ;DO REST OF FULL FACTORY STUFF!
*
* AT THIS POINT WE HANG WAITING FOR THE ADVANCE SWITCH.
*
WAIT_POINT:
RETP ;NOW LET CALLER TAKE OVER.
**************************************************************************
* *
* WT_ADV *
* *
* WAIT TILL ADVANCE. THIS HOLDS CONTROL UNTIL ADVANCE *
* BUTTON IS PRESSED. *
* *
**************************************************************************
;WT_ADV:
; SLEEP 2
;
;WT_A6:
; CALLR GET_ADV ;SCAN THE BUTTON
; JRNZ WT_ADV ;NOT PRESSED.
; RETP
;
;COINSND .WORD 0F3DFH,010H,08085H,0 ;"COIN" SOUND
BEEP_1 .WORD 0F3DFH,010H,080A2H,0 ;LOW BEEP
;BEEP_2 .WORD 0F3DFH,010H,080A3H,0
;BEEP_3 .WORD 0F3DFH,010H,080A4H,0
;BEEP_4 .WORD 0F3DFH,010H,080A5H,0 ;HIGH BEEP
;
;;**************************************************************************
;* *
;;* WW_ADV *
;* *
;* WAIT WHILE ADVANCE. THIS HOLDS CONTROL WHILE ADVANCE *
;* BUTTON IS HELD (OR STUCK). *
;* *
;**************************************************************************
;WW_ADV:
; SLEEP 2
; CALLR GET_ADV
; JRZ WW_ADV
; RETP
;
;**************************************************************************
;* *
;* GET_ADV *
;* *
;* THIS GETS PHYSICAL STATE OF ADVANCE BUTTON. *
;* *
;* .EQ. PRESSED *
;* .NE. OPEN *
;* *
;**************************************************************************
;GET_ADV:
; MMTM SP,A0
; MOVE @COINS,A0,W ;FETCH COIN SWITCHES (LOOKING FOR ADVANCE)
; ANDI ADV_BIT,A0 ;KEEP ADVANCE BIT.
; MMFM SP,A0
; RETS
;
;**************************************************************************
;* *
;* CK_DOOR *
;* *
;* THIS IS CALLED TO SEE IF THE FRONT DOOR (MEMORY *
;* PROTECT SWITCH IS OPEN. *
;* *
;* .NE. OPEN (OK TO WRITE CMOS) *
;* .EQ. CLOSED (CAN'T WRITE CMOS) *
;* *
;**************************************************************************
;CK_DOOR:
; MMTM SP,A0
; MOVE @COINS,A0,W ;FETCH COIN SWITCHES (LOOKING FOR ADVANCE)
; ANDI DOOR_BIT,A0 ;KEEP COIN DOOR MEMORY PROTECT.
; MMFM SP,A0
; RETS
;
**************************************************************************
* *
* GET_MENU *
* *
* This routine is called (via JSRP) to display a menu on *
* screen and receive a selection from the operator. *
* *
* The menu descriptor is passed in A8. *
* *
* The selection number is returned in a8. (line 1 = 1) *
* The routine address is returned in a9. *
* A10 is returned non-zero if advance was the button used *
* *
* A menu (pointed to by A8) is defined as follows: *
* *
* FONT TO BE USED (LONG) *
* X FOR LEFT MARGIN (WORD) *
* Y FOR TOP LINE (WORD) *
* DY PER ENTRY (WORD) *
* TEXT_COLOR (WORD) *
* HEIGHT OF SELECTION BAR (WORD) *
* DX FROM TOP OF TEXT TO SEL. BAR (WORD) *
* *
* A9 POINTS AT ENTRY TO START WITH *
* *
* Then for each entry: *
* *
* TEXT POINTER (LONG) *
* ACTIVATION ROUTINE (LONG) *
* *
* The list is terminated by a zero. *
* *
* This routine forks a separate process to do the work *
* for it. Therefore the caller has full use of *
* the PDATA area. *
* *
**************************************************************************
*
* Equates for GET_MENU slave process.
*
MEN_OFF EQU PDATA ;WORD-OFFSET INTO MENU OF SELECTION
MEN_ROUT EQU MEN_OFF+WORD_SIZE ;LONG-ROUTINE FOR SELECTION
MEN_ROM EQU MEN_ROUT+LONG_SIZE ;LONG-POINTER TO ROM STRUCTURE
MEN_ULX EQU MEN_ROM+LONG_SIZE ;WORD-LEFT X (CENTER X WHEN CENTERING)
MEN_ULY EQU MEN_ULX+WORD_SIZE ;WORD-TOP Y
MEN_DY EQU MEN_ULY+WORD_SIZE ;WORD-Y UNITS PER ENTRY
MEN_COLR EQU MEN_DY+WORD_SIZE ;WORD-COLOR FOR ENTRIES
MEN_BAR EQU MEN_COLR+WORD_SIZE ;WORD-HEIGHT OF SELECTION BAR
MEN_BDY EQU MEN_BAR+WORD_SIZE ;WORD-DY FROM TOP OF TEXT TO TOP OF BAR.
MEN_BDX EQU MEN_BDY+WORD_SIZE ;WORD-DX FROM LEFT OF WORD TO LEFT OF BAR
MEN_BWID EQU MEN_BDX+WORD_SIZE ;WORD-WIDTH OF BAR
MEN_SCOL EQU MEN_BWID+WORD_SIZE ;WORD-COLOR OF SELECTED TEXT
MEN_TPTR EQU MEN_SCOL+WORD_SIZE ;LONG-POINTER TO BEGINNING OF TEXT ENTRIES.
MEN_ENTS EQU MEN_TPTR+LONG_SIZE ;WORD-NUMBER OF ENTRIES IN MENU
MEN_CUR EQU MEN_ENTS+WORD_SIZE ;WORD-CURRENT SELECTION (1ST IS 1)
MEN_WALK EQU MEN_CUR+WORD_SIZE ;WORD-NUMBER OF ENTRY WE'RE ON AS WE WALK
MEN_STIK EQU MEN_WALK+WORD_SIZE ;LONG-"STUCK" STATE OF SWITCHES
MEN_ACT EQU MEN_STIK+LONG_SIZE ;LONG-SWITCH WE'RE ACTING ON. (BIT)
MEN_TYPO EQU MEN_ACT+LONG_SIZE ;WORD-TYPOMATIC COUNTER
MEN_HITS EQU MEN_TYPO+WORD_SIZE ;WORD-CONSECUTIVE TYPOMATIC HITS
MEN_ADV EQU MEN_HITS+WORD_SIZE ;WORD-NON-ZERO IF ADVANCE WAS BUTTON USED
WORD_ENTS EQU (MEN_TPTR-MEN_ULX)/WORD_SIZE ;NUMBER OF WORD ENTRIES
B_MENU:
MOVI BD_SLAVE,A7
JRUC GMJMP
GET_MENU:
MOVI GM_SLAVE,A7 ;THIS IS ROUTINE
GMJMP:
MOVI MENU_PID,A1 ;THIS IS ID
CALLA GETPRC ;CREATE IT
MOVE A0,A10 ;SAVE HIS POINTER
GM1:
SLEEP 2
MOVI MDUN_PID,A0
MOVI 0FFFFH,A1
CALLA EXISTP ;WAIT FOR ID TO CHANGE TO THIS!
JRZ GM1 ;LOOP UNTIL IT EXISTS!
MOVE *A10(MEN_OFF),A8,W ;RETURN OFFSET OF SELECTION
MOVE *A10(MEN_ROUT),A9,L ;AND ROUTINE THAT WAS SELECTED.
MOVE *A10(MEN_ADV),A10,W ;INDICATE WHETHER ADVANCE WAS USED
MOVI MDUN_PID,A0
MOVI 0FFFFH,A1
CALLA KILALL ;KILL THE HANGING MENU GETTER!
RETP ;AND RETURN
**************************************************************************
* *
* GM_SLAVE *
* *
* This displays the menu.......moves the selection bar *
* and returns the selection information by stuffing *
* it in its process area and changing its ID to *
* MDUN_PID once selection is made. *
* *
* On entry....A8 points at the GET_MENU data structure. *
* A9 is which entry to start with selected. *
* *
**************************************************************************
BD_SLAVE:
CALLR MENU_BORDER ;DRAW THE BORDER FOR SELCTIONS.
GM_SLAVE:
JSRP ST_STICK ;TELL STICK(S) AND BUTTONS WE'RE STARTING.
CALLR STUFF_MENU_PROCESS ;MOVE DATA INTO PDATA AREA
*
* PLOT ENTIRE MENU
*
* DO_MENU_LINE WILL RETURN CARRY SET
* WHEN WE GET BEYOND THE END.
*
MOVK 1,A0 ;SETUP FOR LINE 1.
*
DO_ANOTHER_LINE:
;
MOVE A0,*A13(MEN_WALK),W ;WALK THROUGH.
JSRP DO_MENU_LINE ;PUT OUT LINE IN A0.
MOVE *A13(MEN_WALK),A0,W ;GET BACK THE COUNTER
INC A0 ;MOVE TO NEXT ENTRY.
MOVE *A13(MEN_ENTS),A1,W ;SEE IF WE'RE DONE.
CMP A1,A0
JRLS DO_ANOTHER_LINE
*
* MAIN MENU PLOTTED......NOW LET THE DMA UN-LOAD BEFORE PLOTTING HELP
*
CALLR PLOT_HELP ;PLOT HELP FOR 1ST IF NECESSARY
* SLEEP 2 ;NOW MAKE SURE THE HELP GETS PLOTTED
*
* NOW WE JUST WANT TO UPDATE BASED ON STICK...ACT
* ON BUTTONS!
*
* RESPONSES: UP....DOWN....BUTTON....NOTHING....
*
* NOTHING = 0
* UP = 1
* DOWN = 2
* BUTTON = 3
*
* A0 = RESPONSE
* A1 = MEN_CUR VALUE.
*
MENU_LOOP:
SLEEP 1
MOVI MENU_TYPO,A5
JSRP GETSTICK ;ASK THE STICK HANDLER.......
MOVE A0,A0 ;SEE WHAT GET_STICK RETURNED.
JRZ MENU_LOOP ;MENU...(PAUSE) NOTHING.
MOVE *A13(MEN_CUR),A1,W ;GET CURRENT ENTRY...IN A1
CMPI 3,A0 ;BUTTON?
JRZ MENU_BUTTON ;YEP....WE'RE OUT OF HERE.
CMPI 2,A0
JRZ MENU_DOWN ;ITS DOWN....
*
* REQUEST TO GO UP....ARE WE AT #1
*
CMPI 1,A1 ;WELL?
JRLS MENU_LOOP ;YEP....IGNORE
JSRP UN_SELECT ;PUT BACK THE OLD "CURRENT ONE
MOVE *A13(MEN_CUR),A0,W ;GET CURRENT ENTRY
DEC A0 ;MAKE ONE LESS.
JRUC JOIN_DOWN ;NOW PLOT THE NEW ONE.
MENU_DOWN:
MOVE *A13(MEN_ENTS),A2,W ;GET NUMBER IN MENU
CMP A2,A1 ;ARE WE AT MAX
JRHS MENU_LOOP ;YEP...NO ACTION
JSRP UN_SELECT ;PUT BACK THE OLD "CURRENT ONE
MOVE *A13(MEN_CUR),A0,W ;GET CURRENT ENTRY
INC A0 ;MAKE THIS THE NEXT.
JOIN_DOWN:
MOVE A0,*A13(MEN_CUR),W ;PUT BACK
JSRP DO_MENU_LINE ;PUT OUT LINE IN A0.
*
* MAKE THE "DINK" SOUND HERE FOR ENTRY TO ENTRY MOVEMENT
*
CALLR PLOT_HELP ;PLOT HELP NEW ONE
SLEEP 1 ;DELAY BEEP 1 FRAME
SOUND1 BEEP_1 ;MAKE A BEEP.
JRUC MENU_LOOP ;AND WAIT FOR NEXT RESPONSE.
*
* CONTROL COMES HERE WHEN A BUTTON IS PRESSED
*
* The selection number is returned in a8. (line 1 = 1)
* The routine address is returned in a9.
MENU_BUTTON:
*
* A0 HAS A 3.
* A2 HAS THE BUTTON BIT.....IS IT ADVANCE?
*
; CMPI ADV_HIGH,A2 ;WAS IT ADVANCE?
; JRZ IS_ADV ;YEP....USE THE 3
CLR A0 ;NOT ADVANCE
IS_ADV:
MOVE A0,*A13(MEN_ADV),W ;NON ZERO IF IT WAS ADVANCE
JSRP BUTTON_STALL ;HIGHLIGHT SELECTION AND HANG ON BUTTON
MOVE *A13(MEN_CUR),A0,W ;GET "CURRENT" ENTRY.
CALLR GET_MENU_DATA ;A1=CURRENT_OFFSET A2=TEXT A3=ROUTINE
MOVE A0,*A13(MEN_OFF),W ;STORE THE OFFSET (CHOICE NUM)
MOVE A3,*A13(MEN_ROUT),L ;AND THE ROUTINE POINTER
MOVI MDUN_PID,A0
MOVE A0,*A13(PROCID),W ;CHANGE OUR ID.
MENU_DONE:
SLEEP 20
JRUC MENU_DONE ;NOW HANG TILL DISPATCHER SEES ID.
**************************************************************************
* *
* MENU UTILITIES *
* *
**************************************************************************
**************************************************************************
* *
* BUTTON_STALL *
* *
* THIS IS CALLED WHEN THE MENU GETS A BUTTON HIT. *
* A1 HAS THE BIT OF THE BUTTON. *
* *
* WE PAINT THE MENU SQUARE TO FEEDBACK THE HIT. *
* *
* THEN WE HANG ON THE BUTTON UNTIL ITS LET GO. *
* *
**************************************************************************
BUTTON_STALL:
MOVE A2,@LAST_BUT,L ;PUSH THE BUTTON STATE
MOVE @SCODE,A0,W ;NO CASH FOR REPEAT SOUND CODES
MOVE @DCODE,A1,W
OR A0,A1
JRNZ DONT_WAIT ;ITS A SOUND REPEAT....DON'T HOLD EITHER!
; SOUND1 DOOROSND ;MAKE SELECT SOUND
MOVE *A13(MEN_CUR),A0,W ;GET CURRENT SELECTION
MOVI ROBO_ORANGE,A1
CALLR MENU_BAR ;CHANGE THE BAR COLOR.
CALLR GET_MENU_DATA ;GET OUR TEXT POINTER BACK
MOVI ROBO_WHITE,A1 ;WHITE ON ORANGE DURING HOT MOMENT
JSRP MENU_TEXT ;AND WRITE INVERTED TEXT
MOVE @LAST_BUT,A8,L ;GET BUTTON BACK
MOVI 08H,A9 ;MINIMUM TIME FOR BUTTON HIGHLITE
; MOVI 2AH,A10 ;.5 SECONDS OF ADVANCE HOLD-DOWN
* ;WILL EXIT TEST MODE.
WAIT_FOR_RELEASE:
; CMPI ADV_HIGH,A8 ;IS IT ADVANCE BUTTON?
; JRNZ NOT_ADV ;NOPE.....NEVER MIND
; DEC A10 ;1 LESS TIME UNIT
; JRZ DIAG_EX ;IF HE HOLDS ADVANCE...WE'RE GONE!
;NOT_ADV:
SLEEP 1
MOVE A9,A9 ;REDUCE FOR HELD TIME
JRZ WAIT_1 ;ZEROED OUT ALREADY.