-
Notifications
You must be signed in to change notification settings - Fork 4
/
DIAG.ASM
executable file
·5503 lines (4813 loc) · 114 KB
/
DIAG.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
**************************************************************
*
* Software: JAMIE BEGELMAN, KURT MAHAN, EUGENE P. JARVIS
* Initiated: ?
*
* Modified: Shawn Liptak, 11/14/91 -Total carnage clean up
* Shawn Liptak, 1/20/92 -DIP switch test
* Shawn Liptak, 1/24/92 -Added line_draw
* Shawn Liptak, 2/20/92 -Basketball cleanup
* GEORGE PETRO, 1/17/93 -NBA JAM
*
* COPYRIGHT (C) 1992 WILLIAMS ELECTRONICS GAMES, INC.
*
*.Last mod - 3/24/93 16:48
**************************************************************
.width 132
.option b,d,l,t
.mnolist
.include "gsp.equ"
.include "sys.equ"
.include mproc.equ
.include link.equ
.include imgtbl.glo
.include "macros.h"
.INCLUDE GAME.EQU
.INCLUDE DIP.EQU
;from DCSSOUND.ASM
.ref SNDSND
.ref _tseconds
.ref _switch_map_mode
.ref _coin_addr
.ref _switch_addr
.ref _switch2_addr
.ref _watchdog_addr
.ref _dipswitch_addr
.ref _sound_addr
.ref _soundirq_addr
.ref _coin_counter_addr
.ref InitAddresses
.ref dec_to_asc
.ref copy_string,copy_rom_string
.ref concat_string
.ref message_buffer
.ref SOUNDSUP
.ref _rtc_seconds
.ref _rtc_minutes
.ref _rtc_hours
.ref _rtc_day
.ref _rtc_date
.ref _rtc_month
.ref _rtc_year
.ref _year
.ref _month
.ref _day
.ref _serial_number
.ref _man_date
.globl _get_time
.globl _set_time
.globl _aquire_time
.globl SNDPROTOPROMPT
.globl SNDRELEASEPROMPT
.globl SNDTIMEOUT
SCRXFUDGE equ 56
**************************************************************************
* *
* DEFS AND REFS *
* *
**************************************************************************
.ref fudge_switches, fudge_switches_diag, CPU_RET
.REF SNDSND,INTIO,WARMSET,GET_AUD,STORE_AUDIT,WDOGDIS
.ref AUD1, GAMSTATE, KILL_AUD, PCMOSRET
.ref CLR_AUD, FAC_SET, CMOS_VAL, ROM_NAME
.DEF POWERTST, DIAGCPUTEST, POWERCMOS
.def SWITCHTEST, SWSET1, SWSET2
.DEF CROSS_H,COL_BARS,BURN_IN,STRNEW1
.DEF CIRCLE,HVLINE,STRING,RECTANGLE,POINT,DSCRCLR,INITCOLR
.DEF READ_DIP
.REF SNDTST
.REF SYSCOPY
*SYMBOLS IN MENU.ASM
.REF USA_1, USA_2, USA_3, USA_4, USA_ELECTITLE
.REF GERMAN_1, GERMAN_2, GERMAN_3, GERMAN_4, GERMAN_ELECTITLE
.REF FRENCH_1, FRENCH_2, FRENCH_3, FRENCH_4, FRENCH_ELECTITLE
.REF DIPCOINTAB
.REF GET_ADJ, GET_CSPT, NO_CREDS
.REF PUT_ADJ, CRED_P, HEXTOASC, F_ADC_S, SET_COIN_ADJ
.REF init_all, mainlp, DIAG_COLORS
*
*DIAGNOSTIC SOUND EQUATES
*
CMOS_ERROR_SND .EQU 0203h
CPU_ERROR_SND .EQU 0203h
DIP_SND .EQU 0c8h
SWITCH_SND .EQU 0c8h
.BSS SWSET1,32 ; FOR SWITCH TEST
.BSS SWSET2,32
.BSS DIPVAL,16
.BSS DIP1ST,16
.BSS FORCEDIP,16 ; FOR FORCING THE USE OF THE DIP
.BSS CERRORS,32
.BSS CPASSES,32
.BSS SCHANGE,16
.bss _snd_status,32
.bss _b6_save,32 ; Temporary register fer me
.bss _temporary,32 ; Another temp fer me
.bss _snd_diag_code,16 ; Temporary storage for sound diag code
BSSX _snd_chip_count,16 ; Temporary register fer me
.bss _pic_raw,128 ; Stuff fer the PIC
.bss _pic_temp,64
**************************************************************************
* *
* USEFUL MACROS *
* *
**************************************************************************
*
* TIMED PAUSE
*
PAUSE .macro TIME, REG
MOVI :TIME:,:REG:,L
LABEL? NOP
DSJS :REG:,LABEL?
.endm
*BIT SET
* BSET BIT# 0-31(KONSTANT OR REGISTER),REGISTER TO SET BIT IN
* NOTE: A14 IS DESTROYED, 'A' FILE REGISTERS ONLY
BSET .macro P1,R1
MOVK 1,A14
SLL :P1:,A14
OR A14,:R1:
.endm
*
*RJST - RIGHT JUSTIFIES BITS IN A LONG WORD, I.E. RIGHTMOST BIT
* TO BIT POSITION 0
* RJST REG
RJST .macro REG
MOVE :REG:,:REG:
JRZ MX?
MLP?
SRL 1,:REG:
JRNC MLP?
SLL 1,:REG:
ADDK 1,:REG:
MX?
.endm
BUT_MAC .macro X,Y,RADIUS,COLOR,MASK,SHIFT,EXTEND
.WORD :X:
.WORD :Y:
.WORD :RADIUS:
.LONG :COLOR:
.LONG :MASK:
.WORD :SHIFT:
.WORD :EXTEND:
.endm
STR_MAC .macro X,Y,STRING,COLOR,DIR
.WORD :X:
.WORD :Y:
.LONG :STRING:
.WORD :COLOR:
.WORD :DIR:
.endm
VECMAC .macro COLOR,X1,Y1,X2,Y2
.WORD :COLOR:
.WORD :X1:
.WORD :Y1:
.WORD :X2:
.WORD :Y2:
.endm
DOTMAC .macro COLOR,X,Y
.WORD :COLOR:
.WORD :X:
.WORD :Y:
.endm
RECTMAC .macro COLOR,X,Y,W,H
.WORD :W:
.WORD :H:
.WORD :X:
.WORD :Y:
.WORD :COLOR:
.endm
CHIPMAC .macro NUM,X1,Y1,X2,Y2,X3,Y3,STRING,DIR,X4,Y4,STUFFED
.WORD :NUM:
.WORD :X1:
.WORD :Y1:
.WORD :X2:
.WORD :Y2:
.WORD :X3:
.WORD :Y3:
.LONG :STRING:
.WORD :DIR:
.WORD :X4:
.WORD :Y4:
.WORD :STUFFED:
.endm
CMNUM EQU 0
CMLOC EQU CMNUM+16
CMXLOC EQU CMLOC
CMYLOC EQU CMLOC+16
CMSIZE EQU CMLOC+32
CMXSIZE EQU CMSIZE
CMYSIZE EQU CMSIZE+16
CMOFFSET EQU CMSIZE+32
CMSTRING EQU CMOFFSET+32
CMDIR EQU CMSTRING+32
CMPINLOC EQU CMDIR+16
CMSTUFFED EQU CMPINLOC+32
CMEND EQU CMSTUFFED+16
**************************************************************************
* *
* RAM_CHIP: MACRO DEFINES A RAM CHIP RECORD. *
* *
* CHIP_NO -- CHIP NUMBER *
* WIDTH -- CHIP CELL SIZE IN BITS (MUST BE > 0) *
* INTERLEAVE -- DISTANCE BETWEEN ADJACENT CELLS ON CHIP (IN BITS) *
* START_ADDR -- ADDRESS OF FIRST CELL ON CHIP *
* END_ADDR -- ADDRESS OF LAST CELL ON CHIP *
* *
**************************************************************************
RAM_CHIP .macro TAB_LINK,CHIP_NO, WIDTH, INTERLEAVE, START_ADDR, END_ADDR
.WORD :WIDTH:
.WORD :INTERLEAVE:
.WORD :CHIP_NO:
.LONG :START_ADDR:
.LONG :END_ADDR:
.LONG :TAB_LINK:
.endm
RAM_WDTH EQU 000H ; OFFSETS INTO RAM CHIP RECORD
RAM_ITLV EQU 010H
RAM_NMBR EQU 020H
RAM_SADR EQU 030H
RAM_EADR EQU 050H
RAM_LINK EQU 070H
RAM_SIZE EQU 090H
ROM_CKSM EQU 000H
ROM_WDTH EQU 010H ; OFFSETS INTO ROM CHIP RECORD
ROM_ITLV EQU 020H
ROM_NMBR EQU 030H
ROM_SADR EQU 040H
ROM_EADR EQU 060H
ROM_LINK EQU 080H
ROM_SIZE EQU 0A0H
****************************************************************************
* ROM_CHIP: MACRO DEFINES A ROM CHIP RECORD. *
* *
* CHIP_NO -- CHIP NUMBER *
* WIDTH -- CHIP CELL SIZE IN BITS (MUST BE > 0) *
* INTERLEAVE -- DISTANCE BETWEEN ADJACENT CELLS ON CHIP (IN BITS) *
* START_ADDR -- ADDRESS OF FIRST CELL ON CHIP *
* END_ADDR -- ADDRESS OF LAST CELL ON CHIP *
* CHECK_SUM -- DATAIO CHECK SUM FOR CHIP *
****************************************************************************
ROM_CHIP .macro TAB_LINK,CHIP_NO, WIDTH, INTERLEAVE, START_ADDR, END_ADDR, CHECK_SUM
.WORD :CHECK_SUM:
.WORD :WIDTH:
.WORD :INTERLEAVE:
.WORD :CHIP_NO:
.LONG :START_ADDR:
.LONG :END_ADDR:
.LONG :TAB_LINK:
.endm
RANDOM_SEED EQU 5A5A5A5Ah ; RAM TESTS: PSEUDO-RANDOM SEQUENCE
ZERO_EXTEND EQU 1Fh ; PARAMETERS
SIGN_EXTEND EQU 20h
PAL_SELECT EQU 0FFDCH ; ENABLE VIDEO PALETTE MAP ACCESS
.text
.even
**************************************************************************
* *
* POWERTST *
* *
* POWERUP SELF TEST ROUTINES *
* *
* ENTRY *
* NOTHING *
* *
* EXIT *
* NOTHING *
* *
**************************************************************************
POWERTST
dint
setf 16,1,0
setf 32,0,1
MOVI STCKST,SP,L
move @_watchdog_addr,a0,L
move a0,*a0
; HALT DMA AND ENABLE CACHE
clr a14
move a14,@DMACTRL
move a14,@DMACTRL
FCALL INTIO,B6
; DISABLE VIDEO PALETTE RAMS, AUTOERASE AND ERROR LED
MOVI SYSCINIT,A13
MOVE A13,@SYSCTRL
FCALL CPUTEST,SP
JAUC WARMSET
****************************************************************************
* *
* PIC SECURITY STUFF *
* *
* Security source for WWF-UNIT's PIC *
* *
* Version 1.00 *
* Written by: Michael J. Lynch *
* Copyright (c) 1995 by Williams Electronics Games Inc. *
* All rights reserved *
* *
* TTTTT OOO PPPP SSS EEEEE CCC RRRR EEEEE TTTTT *
* T O O P P S S E C C R R E T *
* T O O P P S E C R R E T *
* T O O PPPP SSS EEEE C RRRR EEEE T *
* T O O P S E C R R E T *
* T O O P S S E C C R R E T *
* T OOO P SSS EEEEE CCC R R EEEEE T *
* *
* *
* Company Confidential Information *
* NEED TO KNOW BASIS ONLY *
* *
* USE OR DISCLOSURE STRICTLY PROHIBITED UNLESS APPROVED IN WRITING FROM *
* WILLIAMS ELECTRONICS GAMES INC. *
* *
* Unapproved use or disclosure will result in severe torture!!!!! *
* *
****************************************************************************
; _pic_bin2bcd Converts a hex number in a7 to BCD and puts it in A3
_pic_bin2bcd:
clr a3
movi 100000,a0
_bin2bcd_loop:
sll 4,a3
move a7,a1
divu a0,a1
or a1,a3
mpyu a0,a1
sub a1,a7
move a0,a1
movk 10,a0
divu a0,a1
move a1,a0
jrnz _bin2bcd_loop
FRET b6
******************************************************************************
* *
* _bcd2hex - Converts a 32 bit (8 digit) BCD Number to Hexidecimal *
* *
* ENTRY *
* A0 - BCD Number to be converted *
* B6 - Return Address *
* *
* EXIT *
* A2 - Converted Number (hex) *
* *
* USES *
* A1 - Multiplier *
* A3 - Temporary *
* A4 - Digit Counter *
* *
* Written by: Michael J. Lynch *
* *
******************************************************************************
_bcd2hex:
clr a2 ; Start with 0
movk 1,a1 ; Starting Multiplier
movk 8,a4 ; Number of BCD digits to convert
_b2h_loop: ; Main BCD to hex conversion loop
move a0,a3 ; Put BCD number in temporary register
andi 0fh,a3 ; get rid of bits not interested in
mpyu a1,a3 ; multiply by current multiplier
add a3,a2 ; Accumulate into final register
srl 4,a0 ; Shift to next BCD digit
movk 10,a3 ; Calculate next multiplier (mult = mult * 10)
mpyu a3,a1 ; New Multiplier
dsjs a4,_b2h_loop ; Keep going until 8 BCD digits are done
FRET b6 ; return
_read_pic_data:
setf 8,0
setf 32,0,1
movk 16,a9 ; Number of bytes of data to read
movi _pic_raw,a1 ; address at which to store raw data from PIC
movk 010h,a8 ; Send Request Serial Number Data Command
move a8,@PIC_COMMAND
_rp_data_loop:
setf 16,0
clr a8
move a8,@PIC_COMMAND
movi 1000000,a2 ; Wait for PIC to acknowledge
_rp_ack_loop:
move a2,a2 ; Check for command timeout
jrz gn_bad ; WOA PIC never acknowledged - ERROR!!!!
move @_watchdog_addr,a8,L
move a8,*a8
move @_soundirq_addr,a8,L
move *a8,a8
subi 1,a2
btst 12,a8 ; Data available ?
jrnz _rp_ack_loop ; NO
setf 8,0 ; YES
move @PIC_DATA,a0 ; read data
move a0,*a1+ ; write to temp holding area
movk 010h,a8 ; Acknowledge reciept of data
setf 16,0
move a8,@PIC_COMMAND
movi 1000000,a2 ; Wait for PIC n acknowlegde
_rp_nack_loop:
move a2,a2
jrz gn_bad
move @_watchdog_addr,a8,L
move a8,*a8
move @_soundirq_addr,a8,L
move *a8,a8
subi 1,a2
btst 12,a8
jrz _rp_nack_loop
dsj a9,_rp_data_loop
clr a4 ; Holding Register for X
clr a5 ; Holding Register for Y
setf 8,0
movi _pic_raw,a10
addi 060h,a10
move *a10+,a4 ; Get X
move *a10,a5 ; Get Y
setf 24,0
clr a7 ; Calculate B-3-5-9
movi _pic_raw,a10
move *a10,a7
subi 15732,a7
movi 581,a0
divu a0,a7
sub a4,a7 ; B359 (binary)
FCALL _pic_bin2bcd,b6 ; B359 (bcd) a1 = B359
setf 4,0
srl 4,a3
move a3,a0
andi 0fh,a0
movi _pic_temp,a10
addi 014h,a10
move a0,*a10 ; Stuff the 5
srl 4,a3
move a3,a0
andi 0fh,a0
movi _pic_temp,a10
addk 0ch,a10
move a0,*a10 ; Stuff the 3
movi _pic_raw,a10
addi 018h,a10
move *a10,a7,1 ; Calculate 2-A-0-8-6
subi 7463513,a7
movi 4223,a0
divu a0,a7
sub a5,a7
sub a5,a7
sub a4,a7 ; 2A086 (binary)
FCALL _pic_bin2bcd,b6 ; 2A086 (bcd)
move a3,a0
andi 0fh,a0
movi _pic_temp,a10
addk 018h,a10
move a0,*a10 ; Stuff the 6
srl 4,a3
move a3,a0
andi 0fh,a0
movi _pic_temp,a10
addi 020h,a10
move a0,*a10 ; Stuff the 8
srl 4,a3
move a3,a0
andi 0fh,a0
movi _pic_temp,a10
move a0,*a10 ; Stuff the 0
srl 8,a3
move a3,a0
andi 0fh,a0
movi _pic_temp,a10
addk 8,a10
move a0,*a10 ; Stuff the 2
setf 24,0 ; Calcuate 1-7-4
movi 038h,a10
addi _pic_raw,a10
move *a10,a7
subi 127984,a7
movi 7117,a0
divu a0,a7
sub a5,a7
sub a5,a7
sub a5,a7
sub a5,a7
sub a5,a7 ; 174 (binary)
FCALL _pic_bin2bcd,b6 ; 174 (bcd) a1 = 174
setf 4,0
move a3,a0
andi 0fh,a0
movi _pic_temp,a10
addk 010h,a10
move a0,*a10 ; Stuff the 4
srl 4,a3
move a3,a0
andi 0fh,a0
movi _pic_temp,a10
addk 01ch,a10
move a0,*a10 ; Stuff the 7
srl 4,a3
move a3,a0
andi 0fh,a0
movi _pic_temp,a10
addk 4,a10
move a0,*a10 ; Stuff the 1
setf 16,0
movi 050h,a10
addi _pic_raw,a10
move *a10,a0 ; This is a pointer to the date code
move *a10,a1
sll 8,a1
srl 8,a0
andi 0ffh,a0
andi 0ff00h,a1
or a1,a0
move a0,@_man_date,L
setf 4,0
movi _pic_temp,a10
addk 0ch,a10
move *a10+,a0 ; Most Significant Digit (serial number)
sll 4,a0
move *a10+,a1
or a1,a0
sll 4,a0
move *a10+,a1
or a1,a0
sll 4,a0
move *a10+,a1
or a1,a0
sll 4,a0
move *a10+,a1
or a1,a0
sll 4,a0
move *a10+,a1 ; Least Significant Digit (serial number)
or a1,a0
FCALL _bcd2hex,b6 ; Convert to hex (a2 = serial # hex)
move a2,@_serial_number,L
setf 4,0
movi _pic_temp,a10
move *a10+,a0 ; Most Significant Digit (game number)
sll 4,a0
move *a10+,a1
or a1,a0
sll 4,a0
move *a10+,a1 ; Least Significant Digit (game number)
or a1,a0
FCALL _bcd2hex,b6 ; Convert to hex
clr a1
cmpi 528,a2 ; Development PIC Game Number
jrz gn_good
cmpi 430,a2 ; Real Game Number (WrestleMania)
jrz gn_good
gn_bad:
movi SEC_MESS_2,a0 ; Level 2 Security Check failure
FCALL STRINGCENTER,b6
addi [220,0],a1
clr a2
movi COLOR_RED,a3
FCALL STRING,b6
LOCKUP
gn_good:
setf 8,0 ; Stomp on memory used to decode PIC
clr a0
movi 16,a1
movi _pic_raw,a2
_stomp_temp:
move a0,*a2+
dsjs a1,_stomp_temp
movi 8,a1
movi _pic_temp,a2
_stomp_temp1:
move a0,*a2+
dsjs a1,_stomp_temp1
setf 16,1,0 ;Field0 = Word sign extend
setf 32,0,1 ;Field1 = Long word
rets
**************************************************************************
* *
* POWERCMOS *
* *
* CHECK THE CMOS AND DO A LOT OF OTHER STUFF -- SHOW THE *
* POWER UP MESSAGES *
* *
* ENTRY NOTHING *
* EXIT NOTHING *
* *
**************************************************************************
POWERCMOS:
DINT
MOVI SYSCINIT,A1
MOVE A1,@SYSCTRL,W
CALLA WDOGDIS ; GET RID OF WATCH DOG
CLR A13 ; USED TO DECIDE WHETHER PAUSE OR NOT
MOVE A13,@DMACTRL,W
MOVE A13,@DMACTRL,W
FCALL INITCOLR,B5 ; FIX UP THE COLORS
FCALL INTIO,B6
FCALL DSCRCLR,B6 ; MAKE SURE OF SCREEN
MOVI ROM_NAME,A0
FCALL STRINGCENTER,B6 ; GET WIDTH OF STRING
ADDI [30,0],A1
CLR A2
MOVI COLOR_YELLOW,A3
FCALL STRING,B6
callr _read_pic_data
movi 05018h,a13 ; Palette 128 match color (BLACK)
move a13,@VMUX_BREG1,W
movi 08080h,a13 ; Set Palette # to 128
move a13,@DMACMAP,W
movi SEC_MESS_1,a0 ; Print the message (won't show up)
FCALL STRINGCENTER,b6 ; Note - only shows up on pirate
addi [210,0],a1 ; hardware
clr a2
movi COLOR_RED,a3
FCALL STRING,b6
clr a13 ; Set palette # back to 0
move a13,@DMACMAP,W
movi SNDREVPROMPT,a0 ; Sound Revision Prompt
FCALL STRINGCENTER,b6
addi [120,0],a1
clr a2
movi COLOR_PURPLE,a3
FCALL STRING,b6
move @_watchdog_addr,a0,L
move a0,*a0,W
move @_coin_counter_addr,a0,L
movi 030h,a1 ; Yank down the reset
move a1,*a0,W
movi 10000,a1 ; Hold it fer a while
dsjs a1,$
movi 020h,a1 ; Let it go
move a1,*a0,W
movi 10000,a1
dsjs a1,$
move @_sound_addr,a0,L ; Bypass the diags
movb a0,*a0
move @_watchdog_addr,a0,L ; Kill the dog
move a0,*a0,W
movi 500000,a1 ; Wait fer a while
_swait_lp
move @_watchdog_addr,a0,L
move *a0,a0,W
dsjs a1,_swait_lp
clr a3 ; Turn on the sounds
move a3,@SOUNDSUP,W
movi 999,a3 ; Send revision request sound call
calla SNDSND
movi 1000000,a2
_sndrev_loop
move @_watchdog_addr,a0,L
movb a0,*a0
move @_soundirq_addr,a0,L ; Wait fer a response
move *a0,a1,W
btst B_SDAV,a1 ; Got a response ?
jrz _snd_response ; BR = yes
dsjs a2,_sndrev_loop
_snd_timeout
movi SNDTIMEOUT,a0 ; If we get here we never got a response
FCALL STRINGCENTER,b6 ; Tell operator about it
addi [135,0],a1
clr a2
movi COLOR_RED,a3
FCALL STRING,b6
jruc _sndrev_done ; Then we be done
_snd_response
move @_sound_addr,a0,L ; Get sound revision data
move *a0,a0,W
move a0,@_snd_chip_count,W ; Put up sound revision
move a0,a1
andi 0ffh,a1
cmpi 0ffh,a1
jrz _snd_timeout
andi 0f0h,a1
cmpi 0d0h,a1
jrz _proto_version
movi SNDRELEASEPROMPT,a4
jruc _do_snd_version
_proto_version
movi SNDPROTOPROMPT,a4
_do_snd_version
calla copy_rom_string
move @_snd_chip_count,a0,W
andi 0fh,a0
movk 15,a1
calla dec_to_asc
calla concat_string
movi message_buffer,a0
FCALL STRINGCENTER,b6
addi [135,0],a1
clr a2
movi COLOR_WHITE,a3
FCALL STRING,b6
_sndrev_done
movi GAMESNPROMPT,a0 ; Put up Game Serial number
FCALL STRINGCENTER,b6
addi [160,0],a1
clr a2
movi COLOR_PURPLE,a3
FCALL STRING,b6
move @_serial_number,a0,L ; Serial number put here by _get_serial_number
movi 1000000,a1
calla dec_to_asc
calla copy_string
movi message_buffer,a0
FCALL STRINGCENTER,b6
addi [175,0],a1
clr a2
movi COLOR_WHITE,a3
FCALL STRING,b6
CALLA CMOS_VAL ; CHECKSUM AUDITS/ADJUSTMENTS
JREQ CMOSOK
*
* BAD CHECKSUM ON POWERUP ----> FACTORY SET
*
; CALLA RES_ALL ;ALL TIME TABLE
clr a0 ;Full
CALLA FAC_SET
CALLA CLR_AUD
MOVK 1,A13 ; FLAG ERROR
CALLA CMOS_VAL ; TRY AGAIN
JREQ CMOSB1 ; BR = OK WE'RE IN
MOVI CMOS_BAD,A0
FCALL STRINGCENTER,B6
ADDI [50,0],A1
CLR A2
MOVI COLOR_RED,A3
FCALL STRING,B6
MOVI CMOS_UNFAC,A0
FCALL STRINGCENTER,B6
ADDI [65,0],A1
CLR A2
MOVI COLOR_RED,A3
FCALL STRING,B6
JRUC CMOS1
CMOSB1
MOVI CMOS_FACRES,A0
FCALL STRINGCENTER,B6
ADDI [50,0],A1
CLR A2
MOVI COLOR_RED,A3
FCALL STRING,B6
JRUC CMOS1
CMOSOK
MOVI CMOS_OK,A0
FCALL STRINGCENTER,B6
ADDI [50,0],A1
CLR A2
MOVI COLOR_GREEN,A3
FCALL STRING,B6
CMOS1
CALLA CRED_P ;CHECK OUT CREDITS, THIS WILL CLEAR
;IF NECESSARY. THANX LINKY!
CALLR READ_DIP
ANDI DPUSECMOS,A0
JRNZ CMOS3 ; BR = USING CMOS COINAGE
MOVI CMOS_DIP,A0
FCALL STRINGCENTER,B6
ADDI [75,0],A1
CLR A2
MOVI COLOR_WHITE,A3
FCALL STRING,B6
CALLR SET_DIP_COINAGE
JRUC CMOS4
CMOS3
;
; USING CMOS HERE
;
MOVI CMOS_CMOS,A0
FCALL STRINGCENTER,B6
ADDI [75,0],A1
CLR A2
MOVI COLOR_WHITE,A3
FCALL STRING,B6
CMOS4
move @_coin_addr,a0,L
move *a0,a0,W
not a0
andi 8h,a0
JRZ CMOSRET
MOVI CMOS_TILT,A0
FCALL STRINGCENTER,B6
ADDI [205,0],A1
CLR A2
MOVI COLOR_RED,A3
FCALL STRING,B6
MOVK 1,A13 ; FLAG ERROR
CMOSRET
MOVE A13,A13
JRZ CTMP0
MOVI CMOS_ERROR_SND,A0
move @_sound_addr,a13,L
move a0,*a13,W
MOVI CMOS_WAIT,A0
FCALL STRINGCENTER,B6
ADDI [230,0],A1
CLR A2
MOVI COLOR_RED,A3
FCALL STRING,B6
CALLA WDOGDIS ; DISABLE WOOF WOOF
CALLA fudge_switches ;get fudged switches in a0
andi BUTTONS|START_BITS,a0
MOVE A0,@SWSET1,L
CTMP1
move @_watchdog_addr,a0,L
move a0,*a0
CALLA fudge_switches ;get fudged switches in a0
andi BUTTONS|START_BITS,a0
MOVE @SWSET1,A1,L
CMP A0,A1
JRZ CTMP1
JRUC CTMP2
CTMP0
MOVI 200H,A0
CTMP_WAIT
move @_watchdog_addr,a1,L
move a1,*a1
;FIX - Temp!!!!!
;FIX - Speed up warm reset - Replace when we ship!
; .if DEBUG
; .else
PAUSE 1000H,B6
PAUSE 2000h,B6 ;Go fast
DSJS A0,CTMP_WAIT
; .endif
CTMP2
move @_serial_number,b5,L
move @_man_date,b6,L
JAUC PCMOSRET
SNDREVPROMPT
.string "SOUND SYSTEM VERSION",0
.even
SNDPROTOPROMPT
.string "PROTO ",0
.even
SNDRELEASEPROMPT
.string "RELEASE ",0
.even
SNDTIMEOUT
.string "TIMEOUT ON RESPONSE FROM SOUND SECTION",0
.even
GAMESNPROMPT
.string "GAME SERIAL NUMBER",0
.even
CMOS_TILT
.STRING "WARNING -- SLAM SWITCH CLOSED",0
.EVEN
CMOS_DIP
.STRING "USING DIPSWITCH COINAGE",0
.EVEN
CMOS_CMOS
.STRING "USING CMOS COINAGE",0
.EVEN
CMOS_WAIT
.STRING "ERRORS DETECTED -- ANY BUTTON TO CONTINUE",0
.EVEN
CMOS_FACRES
.STRING "CMOS INVALID -- FACTORY SETTINGS RESTORED",0
.EVEN
CMOS_BAD
.string "CMOS CHIP U62 BAD",0
.EVEN
CMOS_UNFAC
.STRING "UNABLE TO RESTORE FACTORY SETTINGS",0
.EVEN
CMOS_OK
.STRING "CMOS OK",0
.EVEN
**************************************************************************
* *
* BURNIN *
* *
* FACTORY BURNIN TEST -- EXITS BY RESETING THE GAME *
* *
* ENTRY *
* NOTHING *
* *
* EXIT *
* NOTHING *
* *
* CALL *
* JAUC *
* *
**************************************************************************
BURN_IN:
DINT
MOVI AUDAUTO,A0 ;ZERO OUT BURNIN AUDIT
CALLA KILL_AUD
BURNLOOP
CALLA WDOGDIS ;MAKE SURE THE DOG IS ASLEEP
FCALL CPUTEST,SP
BURNSP:
setf 16,1,0
setf 32,0,1
MOVI STCKST,SP,L ;RESTORE THE STACK PTR
MOVI SYSCINIT,A0 ;RE-INITIALIZE SYSTEM CONTROL
MOVE A0,@SYSCTRL,W
MOVE A0,@SYSCOPY,W ;KEEP A COPY IN RAM
MOVI AUDAUTO,A0
CALLA AUD1 ;ANOTHER ONE WORKED
JRUC BURNLOOP