-
Notifications
You must be signed in to change notification settings - Fork 1
/
RBINT.MAC
919 lines (902 loc) · 16 KB
/
RBINT.MAC
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
.TITLE RBINT - RED BARON INTERRUPT (226XX)
.RADIX 16
.ENABL AMA
INITSTK =0FF
;
; INTERNAL ENTRY POINTS
;
.GLOBL PWRON,NMI,MESSAGE,LOADRAM
.GLOBL LODRM8,DIGITS,DIGTYS,DIGT1S
.GLOBL DSPLAY,DECIMAL
;
; EXTERNAL ENTRY POINTS
;
.GLOBL START,MOOLAH,MODSND
.GLOBL VGHEXZ,VGADD2,SCOREM,VGCNTR
.GLOBL VGVTR1,VGJSRL,VGRTSL,VGHEX
.GLOBL VGHALT,VGVTR,VGSCA1
.GLOBL STEAROM,EAUPD
;
; VECTOR/ALPHA STRING ADDRESSES
;
.GLOBL MSGS,VGMSGA,PLPROP,HATCH
.GLOBL .BNNR,BANNER
;
; RAM CELLS
;
.GLOBB RAMPTR,POINTR,EASRCE
.GLOBB VGSIZE,VGBRIT
.GLOBB TEMP1,TEMP2,TEMP3,TEMP4
.GLOBB GAMODE,SECCNT,FRAME
.GLOBB INTFLG,INTCNT,S.FLAG,F.CNTR
.GLOBB C.CNTR,CALFLG,CALCNT,NUMB1
.GLOBB POTVAL,P.CNTR,P.LTCH,RESULT
.GLOBB POTFLG,POTUSE,POTMIN,PTRNGE
.GLOBB LANG,ST.LED,EXPVAL,S.VAL
.GLOBB I.TEMP,SWSTAT,SPIRAL
.GLOBB $CMODE,$CCTIM,$LMTIM
.GLOBB EAX,EABC,EAFLG,EACS
.GLOBL EACNT,HSCRES,SLAMSN
.GLOBL GCOUNT,GTIME,PRCTIM,EABAD
;
; HARDWARE ADDRESSES
;
.GLOBL POTIN,COINCT,WATCH,TESTSW
.GLOBL OPT0,OPT1,NSERST,CRSHSN
.GLOBL VGRAM,VGROM
.GLOBL VGON,VGRST,POKEY
.GLOBL FIRE,MBOXIN,MBSTAT,YLOW,YHIGH
;
; BIT MASKS
;
.GLOBL ST.BIT,$LMBIT,SH.BIT,AUDCV
.GLOBL PS.BIT,EX.MSK,CM.MSK,CC.BIT
.GLOBL BNRBIT,BNRCNT
;
;CHECKSUM
;
.GLOBL CHKSM8
P.COUNT =2
.MACRO LAH .X
LDA I,0
.=.-1
.ENABL M68
.WORD .X
.DSABL M68
.=.-1
.ENDM
.MACRO CPH .X
CMP I,0
.=.-1
.ENABLE M68
.WORD .X
.DSABL M68
.=.-1
.ENDM
.MACRO SAH .X
SBC I,0
.=.-1
.ENABLE M68
.WORD .X
.DSABL M68
.=.-1
.ENDM
.MACRO LXL .X
LDX I,0
.=.-1
.WORD .X
.=.-1
.ENDM
.MACRO LYL .X
LDY I,0
.=.-1
.WORD .X
.=.-1
.ENDM
.MACRO CXH .X
CPX I,0
.=.-1
.ENABL M68
.WORD .X
.DSABL M68
.=.-1
.ENDM
.PAGE
.INCLUDE VGMC ;<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
.INCLUDE ASCVG ;<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
.PAGE
.TITLE RBINT - RED BARON INTERRUPT
.RADIX 16
.CSECT RBINT
;
; ATTRACT BANNER OUTLINE
;
BANNER: VCTR 40.,0,0
VCTR 28.,16.,3
VCTR -28.,-16.,0
VCTR 28.,-16.,3
VCTR 0,32.,5
VCTR 288.,0,5
VCTR -40.,-16.,5
VCTR 40.,-16.,5
VCTR -288.,0,5
VCTR 20.,4,0
;
.BNNR =.-BANNER
;
;
;
;GENERATE MESSAGE
;
; ENTRY EXIT
; ACC MESSAGE BLITZED
; X DC BLITZED
; Y DC BLITZED
;
MESSAGE:STA TEMP1
LDA LANG
ASL
TAX
LDA TEMP1
ADC AX,MSGS
STA POINTR
LDA I,0
TAY
ADC AX,MSGS+1
STA POINTR+1
LDA NY,POINTR
TAX
INY
LDA NY,POINTR
STMESS: STA POINTR+1
STX POINTR
LDY I,1
LDA NY,POINTR
BEQ 10$
PHA
JSR VGCNTR ;CENTER BEAM
LDY I,0
LDA NY,POINTR
TAX
PLA
JSR VGVTR ;OFFSET VCTR
10$: LDA TEMP1
CMP I,38.
BCC 20$
LDA I,2
JSR VGSCA1
20$:
LDY I,2
; JMP DSPLAY ;DISPLAY ALPHA STRING
;
;ALPHANUMERIC STRING DISPLAY
;ENTRY - POINTR = ALPHA STRING (.ASCVG)
; RAMPTR = ADDR. IN VGRAM FOR LOADING CHAR JSRL'S
;ASSUMES CHARACTER SIZE IS DEFAULT
;ALL CHARACTERS IN STRING ARE DISPLAYED ( ,1-9,A-Z)
;# OF CHARACTER <=255.
;EXIT - RAMPTR = ADDR. NEXT BYTE IN VGRAM
DSPLAY: LDA NY,POINTR
PHP ;SAVE SIGN
INY
STY TEMP1+1 ;SAVE POINTR OFFSET
AND I,7F
TAY
LDA AY,VGMSGA ;INSERT CHAR. JSRL INTO
LDX AY,VGMSGA+1
JSR VGADD2
LDY TEMP1+1
PLP ;RESTORE SIGN OFF .ASCVG BYTE
BPL DSPLAY ;DO NEXT CHARACTER
;EXIT W/RAMPTR = NEXT BYTE IN VG RAM LIST
LDA TEMP1
CMP I,38.
BCC 10$
LDA I,1
JMP VGSCA1
10$: RTS
;
; MESSAGE TAKES MESSAGE # (IN ACC) AND PUTS IN VG RAM
; X = LABS # (OFFSET IN MSSGLBS)
;
; CENTER & BEAM POSITION INSERTED IN VG RAM FOLLOWED
; BY MESSAGE STRING (OFFSET IN ACC)
;
; ALL REGS USED; LODRM4, SCRLD2, & DSPLAY ROUTINES CALLED
;
;
;
;
;
;LOADRAM MOVES BYTE FROM (RAMLD) TO
;(RAMPTR), X=# OF BYTES, Y,A = (LO),(HI) ADDR. TO LOAD FROM, AT EXIT
;RAMLD & RAMPTR POINT @ NEXT BYTE
;
LODRM8: LDX I,8 ;STANDARD = 8 BYTES
LOADRAM:STA POINTR+1 ;A,Y=HI,LO ADDR. OF SOURCE
STY POINTR
LDRAM: TXA ;ASSUMES RAMLD, RAMPTR ARE CORRECT
TAY
DEY
10$: LDA NY,POINTR ;MOVE BYTES FROM RAMLD TO RAMPTR
STA NY,RAMPTR ;# OF BYTES =[X]
DEY
BPL 10$
TXA
CLC
ADC RAMPTR ;UPDATE RAMPTR
STA RAMPTR
BCC 20$
INC RAMPTR+1
20$:
RTS ;EXIT RAMPTR=NEXT FREE BYTE
.PAGE
.PAGE
.SBTTL DISPLAY DIGITS
;
;DIGITS - DISPLAY 2(Y+1) DIGIT NUMBERS
;
;ENTRY (C) = CARRY SET FOR ZERO SUPPRESSION
; (X) = ADDRESS OF (Y) ZERO PAGE LOCATIONS CONTAINING MSB OF NUMBER (LSB TO MSB)
; (Y) = NUMBER OF ZERO PAGE LOCATIONS TO USE (0 TO 255).
DIGT1S: LDY I,1
DIGTYS: SEC
DIGITS: STY TEMP1+1
10$: PHP
STX TEMP1 ;SAVE DIGIT ZP OFFSET
LDA ZX,0
LSR
LSR
LSR
LSR
PLP
JSR VGHEXZ ;FIRST DIGIT
LDA TEMP1+1
BNE 20$
CLC ;DISPLAY LAST DIGIT (EVEN 0)
20$: LDX TEMP1
LDA ZX,0
JSR VGHEXZ ;SECOND DIGIT
LDX TEMP1
DEX
DEC TEMP1+1
BPL 10$ ;LOOP FOR EACH SET OF DIGITS
RTS
.PAGE
.SBTTL POWER ON & SELF TEST ROUTINES
;
;
;
PWRON: LDX I,INITSTK
TXS ;INITIALIZE STACK
STEST: LDA I,0
CLD ;CLEAR DECIMAL MODE
STA POKEY+0F
TAX
10$: STA ZX,0 ;CLEAR ZERO PAGE
STA AX,100 ;CLEAR PAGE 1
STA AX,200
STA AX,300
STA A,WATCH
INX
BNE 10$
STA A,VGRST
STA A,NSERST
LDA I,7
STA A,POKEY+0F
LDX I,7
LDA I,0
20$: STA AX,POKEY
DEX
BPL 20$
STA A,POKEY+8
LDA A,TESTSW ;D4=NOT (SELF TEST)
AND I,ST.BIT
BNE PWRINT ;CONTINUE POWER ON
JMP RAMTST ;CONTINUE SELF TEST
PWRINT: LDA I,0FF
STA POTMIN ;INITIALIZE POT. MIN.=0FF
STA POTMIN+1
STA POTFLG
JMP START ;GO TO ATTRACT
;
;
; CONVERTS HEX INTO DECIMAL - 1 BYTE HEX IN ACC
; RESULT IN NUMB2,NUMB1
;
;
; ROUTINE FOR FAST 8-BIT BINARY TO 3 DIGIT CONVERSION
; INPUT: A=MSB'S
; OUTPUT: A=LSD'S, X=MSD'S
; 774. CYCLES WORST (AND BEST) CASE FOR 16. BITS
;
DECIMAL:STA TEMP1 ;TEMP1+1,TEMP1 = BINARY WORD
LDY I,7 ;BIT COUNT
LDA I,0
STA NUMB1 ;CLR DECIMAL BYTES
STA NUMB1+1
SED ;SET DECIMAL MODE
10$: ASL TEMP1
LDA NUMB1
ADC NUMB1
STA NUMB1 ;AND ADD INTO DECIMAL BYTES
LDA NUMB1+1
ADC NUMB1+1 ;TOP BYTE
STA NUMB1+1
DEY
BPL 10$
LDX NUMB1+1
LDA NUMB1
CLD ;CLEAR DECIMAL FLAG
RTS
;
;
;
.SBTTL ZERO-PAGE TEST
RAMTST: LDX I,11 ;BEGINNING PATTERN
TXS ;S HOLDS PATTERN
TXA
STA Z,0 ;TEST CELL START @ 0
LDY I,0
2$: LDX I,1 ;ONE LESS COUNT BEFORE IT WRAPS
3$: INY ;SCAN FORWARD
LDA AY,0 ;ZERO ?
BNE 5$ ;NO - ERROR (HIGH BITS BAD)
INX ;CHK HOW FAR SCANNED
BNE 3$ ;BRANCH - CONTINUE
TSX
TXA ;ACC = PATTERN
STA A,WATCH ;WATCHDOG
INY ;POINT TO TEST CELL
EOR AY,0 ;DOES IT HAVE PATTERN ?
BNE 5$ ;N0 - ERROR (HIGH BITS BAD)
TXA ;ACC = PATTERN
LDX I,0
STX ZY,0 ;ELSE - CLEAR CELL
INY ;POINT TO NEXT TEST CELL
BNE 4$ ;IF PASS NOT COMPLETE
ASL ;ELSE SHIFT PATTERN
LDX I,0 ;IF DONE (0 = GOOD)
BCS STOP0 ;BRANCH - DONE (GOOD)
4$: TAX ;PATTERN ->X
TXS ;PATTERN ->S
STX ZY,0 ;PATTERN -> NEXT TEST CELL
BNE 2$ ;ALWAYS-REPEAT SCAN
5$: TAY
LDX I,1
TXS
JMP STEST2 ;BAD ZP
STOP0: LDX I,INITSTK
TXS ;INITIALIZE STACK (USED IN ROM TESTS)
LDX I,0
LAH VGRAM ;CLR VGRAM
STA 1
TXA
TAY
10$: STA NY,0
INY
BNE 10$
INC 1
STA WATCH
LDX 1
CXH VGRAM+1000
BCC 10$
;
; VECTOR GEN RAM TEST
;
.SBTTL VG RAM TEST
;
;
;
STEST1: LDA I,0
TAY
STA 0
LDA I,1
5$: STA 1 ;START @ PAGE 1 (NY,0)
10$: LDX I,11 ;STARTING PATTERN
LDA NY,0
BNE 20$ ;BAD CELL (START 0)
15$: TXA
STA NY,0 ;WRITE
EOR NY,0 ;AND COMPARE
BNE 20$ ;ERROR
TXA
ASL
TAX
BCC 15$ ;NEXT PATTERN
LDA I,0
STA NY,0 ;CLR CELL
INY
BNE 10$ ;NEXT LOCATION
STA A,WATCH ;MUZZLE THAT BEAST
INC 1
LDX 1
CPX I,04 ;PAGES 1 TO 3
BCC 10$ ;CHECK NEXT PAGE
LAH VGRAM
CXH VGRAM
BCC 5$ ;BEGIN NEXT @ VGRAM
CXH VGRAM+1000
BCC 10$ ;CHECK UP TO VGRAM+1000
JMP STEST3 ;RAM IS GOOD
20$: TAY ;Y=BAD BITS
LDA 1 ;ACC=RAM PAGE
CPH VGRAM ;VG RAM
BCC 30$ ;NO
SAH VGRAM-400 ;CARRY SET
30$: LSR ;RAM BLOCK *2
AND I,0E
TAX
INX
TXS ;X=(BAD RAM*2)+1
;
;S=BAD RAM COUNT(*2+1)
;Y=BAD BITS
;
STEST2: LDA I,0A2
STA A,POKEY+1 ;TONE/VOLUME
TSX
TXA
LSR
BNE 5$
LDX I,60 ;ASSUME BAD RAM
TYA
AND I,0F ;CHECK NIBBLE
BNE 10$
5$: LDX I,0C0
10$: TYA ;ACC=BAD BITS
STX A,POKEY ;FREQUENCY
LDY I,9 ;BAD=LONG PULSE
CPX I,60
BEQ 20$
LDY I,1 ;GOOD=SHORT PULSE
;Y=OUTER COUNT
20$: LDX I,8
STX CRSHSN ;START LED OFF
LDX I,0
21$: BIT A,TESTSW
BMI 21$
22$: BIT A,TESTSW
BPL 22$
STA A,WATCH
DEX
BNE 21$ ;256/3000 SECONDS
DEY
BNE 21$
STX CRSHSN ;START LED ON
STX A,POKEY+1 ;CLR SOUNDS
LDY I,9
40$: BIT A,TESTSW
BMI 40$
41$: BIT A,TESTSW
BPL 41$
STA A,WATCH
DEX
BNE 40$ ;256/3000
DEY
BNE 40$
TSX ;X=RAM COUNT
DEX
TXS
BNE 50$ ;NOT BAD RAM
LSR ;BAD RAM TOP NIBBLE
LSR
LSR
LSR ;INTO LOW NIBBLE
50$: TAY
TXA ;ACC=RAM COUNT
BPL STEST2 ;CONTINUE WITH SOUNDS
STOP1: STA A,WATCH ;NO WATCHDOG
JMP STOP1 ;BAD RAM-LOCKUP
;
.SBTTL ROM TEST
;
; ROM TEST
;
STEST3: LDA I,0 ;EOR CKSUM ROMS
TAY
TAX
STA TEMP1
LAH VGROM
5$: STA TEMP1+1
LDA I,8
STA TEMP2 ;8 PAGES
LDA I,0FF ;CHKSUM=0FF
10$: EOR NY,TEMP1
INY
BNE 10$
INC TEMP1+1
STA A,WATCH ;NO WATCHDOG
DEC TEMP2
BNE 10$ ;8 PAGES / ROM
STA ZX,TEMP3 ;CKSUMS @ TEMP3
INX
LDA TEMP1+1
CPH VGROM+1000 ;4K OF VECTOR ROM
BNE 20$
LDA I,48
STA TEMP1+1
20$: CMP I,80 ;PROGRAM ROM UP TO 7FFF
BCC 5$
LDX I,0
STX EABC ;START READ @ BYTE 0
STX EASRCE ;WILL WRITE TO PAGE 1
STX EAX ;READ ENTIRE ROM
INX
STX EASRCE+1 ;WRITE TO PAGE 1 ( 100 - 11E )
LDA #6*6
STA EACNT ;MAX COUNT
LDA I,20
STA EAFLG ;READ
LDA A,TESTSW
AND I,20
BNE MBDIAG
LDA I,80 ;GO DIRECTLY TO DIAG
STA TEMP4+4
;
INCLUDE = 1
$STAT =1 ;MB D7(HI)=BUSY
;
.INCLUDE MBDIAG ;<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
BCS 30$ ;ERROR IN MATHBOX
LDA I,0
30$: STA TEMP4+1 ;MB TEST RESULT
LDA TEMP3
BEQ 40$ ;VGROM IS OK
LDA I,40 ;ELSE SOUND
LDX I,0A4
STA A,POKEY
STX A,POKEY+1
40$: LDX I,0
STX TEMP4+6 ;DIAGNOSTIC STEP INDEX
LDA I,2
STA VGSIZE ;SCALE FACTOR
STX VGBRIT ;CLR BRIGHTNESS
;
; (TEMP2,+1) = SCRATCH
; (TEMP3,+6) = 7 CHKSUMS FOR ROMS
; (TEMP4) = DIAG STEP #
; (TEMP4+1) = MB STATUS (0 = NO ERRORS, ELSE 'T,'L, OR 'H)
; (TEMP4+2,+3) = SWITCH CLOSURES
; (TEMP4+4) =DIAG STEP DEBOUNCE (DIAGNOSTICS)
; (TEMP4+5) = SOUND LATCH
;
STEST4: LDX I,14 ;SET FOR 16MS BEST CASE
5$: BIT A,TESTSW ;3 KHZ SIQNAL
BPL 5$
7$: BIT A,TESTSW
BMI 7$
DEX
BPL 5$ ;WAIT FOR COUNT (LOOP=7 MS)
10$: BIT A,TESTSW
BVC 10$ ;IF NO HALT, WATCHDOG WILL RESET
STA A,WATCH ;MUZZLE THE DOG
LXL VGRAM
STX RAMPTR
LAH VGRAM
STA RAMPTR+1
LDA A,TESTSW ;DIAG STEP
AND I,20
BNE 16$ ;NO
ASL TEMP4+4 ;DEBOUNCE
BCC 18$ ;NOT YET
INC TEMP4+6 ;STEP TO NEXT TEST
LDA TEMP4+6
CMP I,6
BCC 18$
LDA I,0 ;TESTS 0 TO 5
STA TEMP4+6
BPL 18$ ;ALWAYS
16$: LDA I,20
STA TEMP4+4 ;INITIALIZE DEBOUNCE
18$: LDA TEMP4+6
BEQ STEST6 ;SELF TEST
CMP I,5
BEQ 40$ ;SA DIAGNOSTIC
LDX TEMP4+6 ;1 TO 4
DEX ;0 TO 3
20$: LDY AX,DIAGS ;LENGTH OF TEST
LDA I,20
STA NY,RAMPTR ;ADD HALT @ END
DEY
DEY
30$: LDA AY,DIATST ;COPY IN TEST PATTERN
STA NY,RAMPTR
DEY
BPL 30$
40$: JMP STEST8 ;CONTINUE DIAGNOSTICS
;
;
;
STEST6: LAH HATCH
LXL HATCH
JSR VGJSRL
JSR VGCNTR ;CENTER BEAM
LDA I,-480./4
LDX I,-358./4
JSR VGVTR1 ;POSITION BEAM
LAH VGMSGA
LXL VGMSGA
JSR VGJSRL ;DISPLAY ALPHABET
JSR VGCNTR ;CENTER BEAM
LDA #-96./4
LDX #112./4
JSR VGVTR1 ;POSITION BEAM
LDX I,15.
LDA A,OPT0
EOR I,0FF
STA TEMP2+1
STA TEMP1
LDA A,OPT1
EOR I,0FF
10$: ASL TEMP2+1
ROL ;DISPLAY D7 TO D0
STX TEMP2 ;SAVE COUNT
PHA ;SAVE TOP BITS
ROL
AND I,1
JSR VGHEX ;DISPLAY 0 OR 1
LDX TEMP2 ;RESTORE COUNT
CPX I,8 ;FINISHED WITH ONE BANK ?
BNE 15$ ;NO
LDA #-192./4 ;YES - SPACE OVER FOR NEXT BANK
LDX #-48./4
JSR VGVTR1 ;SPACE OVER BY VCTR
15$: PLA ;RETRIEVE OPTION DATA
LDX TEMP2 ;RETRIEVE COUNT
DEX
BPL 10$ ;DO ALL 16 OPTION SWITCHES
JSR VGCNTR ;CENTER BEAM
LDA I,-32./4
LDX I,160./4
JSR VGVTR1 ;POSITION BEAM
LDA I,1
JSR VGHEX ;1 FOR LEFT COIN MECH
LDA TEMP1
AND I,10
LSR
LSR
LSR
LSR ;0 OR 1
ADC I,1 ;1 OR 2 (CARRY CLR)
JSR VGHEX ;PUT CENTER MECH VALUE
LDA TEMP1
AND I,0C
LSR
LSR
TAX
LDA AX,STEST9
JSR VGHEX ;DOLLAR MECH VALUE
LDX I,88./4
STX TEMP2+1 ;STARTING Y VALUE CHECKSUMS
LDX I,9
20$: LDA ZX,TEMP3
BEQ 30$
STA 0
STX TEMP2 ;SAVE CHKSUM #
JSR VGCNTR ;CENTER BEAM
LDX TEMP2+1
TXA
SEC
SBC I,08 ;32. BELOW CURRENT LINE
STA TEMP2+1
LDA I,-384./4
JSR VGVTR1 ;POSITION BEAM
LDA TEMP2
JSR VGHEX ;ROM #
LDA I,24./4
LDX I,0
JSR VGVTR1
LDX I,0
LDY I,0
JSR DIGTYS ;DISPLAY 2 DIGITS
LDX TEMP2
30$: DEX
BPL 20$ ;LOOP THROUGH ALL ROMS
JSR VGCNTR
LDA I,-48./4
LDX I,256./4
JSR VGVTR1
LDX I,RESULT+3
LDY I,1
JSR DIGTYS
JSR VGCNTR ;CENTER BEAM
LDA I,384./4
LDX I,88./4
JSR VGVTR1 ;POSITION BEAM
LDA TEMP4+1
BEQ 40$ ;NO MB ERRORS
SEC
SBC I,36 ;A IS 11. IN VGMSGA TABLE
ASL
TAY
LDA AY,VGMSGA
LDX AY,VGMSGA+1
JSR VGADD2 ;PUT UP ERROR CODE
40$: JSR VGCNTR ;CENTER BEAM
LDA I,-154./4
LDX I,-128./4
JSR VGVTR1 ;POSITION BEAM
LDA POTVAL
JSR DECIMAL
LDX I,NUMB1+1
LDY I,1
JSR DIGTYS
LDX I,0
LDA I,24.
JSR VGVTR1
LDA POTVAL+1
JSR DECIMAL
LDX I,NUMB1+1
LDY I,1
JSR DIGTYS
LDA EAFLG
BEQ 50$
CMP I,20
BEQ 45$ ;READING EA ROM
LDA I,0
STA TEMP1 ;FULL SIZE
LAH ERMESS ;ERASE MESSAGE
LXL ERMESS
JSR STMESS
45$: LDA FRAME
AND I,3
BNE 50$
JSR EAUPD ;ERASE/WRITE ROM
50$: LDA EABAD
STA TEMP3+9
JSR VGHALT ;& HALT
STEST7: STA A,VGON ;START VG
LDA EAFLG
BNE 40$
BIT A,FIRE
BVS 5$
BPL 5$ ;D6=NOT (START)
LAH PRCTIM
STA EASRCE+1
LXL PRCTIM
STX EASRCE
LDX I,6*6
STX EAX ;CLR FROM START @ BOTTOM
INX
STX A,EACNT
STX EABC ;CLR ALL BYTES 6*3
JSR STEAROM ;SET UP ROM FUNCTIONS
5$: BIT RESULT+4
BMI 40$
SEC
LDY I,2
LDX I,0
10$: LDA AX,100+0A ;100+0A = GAME TIMES
SBC AX,100+7 ;100+7 = GAME COUNTS
STA AX,100+0A
INX
DEY
BPL 10$
LDY I,1
15$: BCS 20$ ;NO CARRY
LDA AX,100+0A
SBC I,0
STA AX,100+0A
INX
DEY
BPL 15$ ;DO +6,+7
BCC 30$ ;FINISHED
20$: SED
CLC
LDA RESULT+2
ADC I,1
STA RESULT+2
LDA RESULT+3
ADC I,0
STA RESULT+3
CLD
STA A,WATCH ;NO WATCHDOG
BCC 5$ ;SHOULD BE ALWAYS
30$: DEC RESULT+4 ;FLAG
40$: LDA A,FIRE ;D7=FIRE,D6=START
TAY
LDA A,TESTSW
AND I,03F
TAX
EOR TEMP4+2
BNE 50$ ;SWITCH HAS CHANGED
TYA
EOR TEMP4+3
BEQ 60$ ;NO CHANGE
50$: LDA I,4 ;TURN ON SOUND
60$: STA TEMP4+5
STX TEMP4+2
STY TEMP4+3
INC FRAME
LDA FRAME
AND I,1
TAX
STA A,POKEY+0B ;POTGO
LDY A,POTIN
STY ZX,POTVAL
EOR I,1
ORA TEMP4+5
STA A,CRSHSN
LDA A,TESTSW
AND I,10
70$: BNE 70$ ;START AGAIN (WATCHDOG RESETS)
JMP MBDIAG ;CONTINUE SELF-TEST
STEST8: LDA TEMP4+6 ;DIAG #
CMP I,5
BNE 20$ ;NOT SA
LDA I,0 ;CLOSE SIGNATURE WINDOW
STA CRSHSN ;SAEN23 (ENABLE FOR SA)
STA MBOXIN ;CLOCK IT
STA NSERST
STA POKEY
LDA MBSTAT
LDA YLOW
LDA YHIGH
LDA FIRE
LDA I,1
STA CRSHSN ;OPEN SIGNATURE WINDOW
LDX I,1F
CLC
10$: STA AX,MBOXIN ;SCAN MB MAPPING PROM
ROL
DEX
BPL 10$
JMP STEST4 ;CONTINUE TESTS
20$: STA VGON ;START VG
LDA I,0
STA A,CRSHSN ;CLR SOUNDS
JMP STEST4
;
STEST9: .BYTE 1,4,5,6 ;DOLLAR MECH MULTIPLIERS
;
.SBTTL VGDIAG TEST ROUTINES
;
.DIAG =7
.RADIX 10
;
;
;
ERMESS: .BYTE -12./4,172./4
.ASCVG <ERASING>
;
DIAGS: .BYTE 19,23,29,51
;
DIATST: CNTR
SCAL 1
VCTR -512,-384,0
STAT 0,0,0
VCTR 1023,767,.DIAG
STAT 0,1,0
CNTR
VCTR 30,-30,0
VCTR -30,30,.DIAG
JMPL 1$-DIATST ;JMPL TEST
HALT ;(FAILURE=HALT)
1$: VCTR -30,30,.DIAG
JSRL 2$-DIATST ;JSRL TEST
VCTR 0,-30,.DIAG
HALT
2$: JSRL 3$-DIATST
RTSL
3$: JSRL 4$-DIATST
RTSL
4$: JSRL 5$-DIATST
RTSL
5$: VCTR 30,0,.DIAG
.WORD ^H0C0EF ;RTSL W/CHKSUM
;
CHKSM8=.-2
.PAGE
;
;INTERRUPT VECTORS
;
;
; .VCTRS ^H0FFFA,NMI,PWRON ;NMI DEV SYS
;
.VCTRS ^H7FFA,NMI ;NMI VECTOR
.VCTRS ^H7FFC,PWRON ;RESET VECTOR
.VCTRS ^H7FFE,PWRON ;IRQ VECTOR
;
.END PWRON