-
Notifications
You must be signed in to change notification settings - Fork 19
/
ROMC0.SRC
executable file
·926 lines (926 loc) · 19.4 KB
/
ROMC0.SRC
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
TTL ROMC0 - DIAG ROM AT C000 - 12/22/80
*
* SYSTEM EQUATES
*
LETCOL EQU $C001 USE COLOR 1!!!
THSTAB EQU $B260 HOME!!
KILSND EQU $13 SOUND NUMBER TO TURN OFF SOUNDS
LSOUND EQU $1F LAST SOUND TO BE TESTED
SWSND EQU $08 SOUND MADE FOR SWCLOSURE
*
*
* DIAGNOSTIC ROM
*
*
ORG DIAORG POINT TO START
*
* VECTORED JUMPS INTO ROM HERE
*
JMP RORAOK
JMP ROOKRB
JMP ROMBAD
JMP PWRUP
JMP AUD
JMP AUD1
JMP COINL
JMP COINR
JMP COINC
JMP RHSTD
JMP CMOSMV
JMP AUDITG
JMP AUTOCY
JMP CROM0
JMP CRAM10
JMP CRAM20
JMP SOUND0
JMP RHSTD$
OUTB0 JMP STBXBV DIRECT
INB0 JMP LDBXBV DIRECT
*
* INDIRECT TO BLOCK 2 TEXT ROUTINES
*
VWTEXT JSR LJSRV GO TO BLOCK 2
FDB TV1
FCB 2
RTS
VETEXT JSR LJSRV
FDB TV2
FCB 2
RTS
VWNUMB JSR LJSRV
FDB TV5
FCB 2
RTS
VENUMB JSR LJSRV
FDB TV6
FCB 2
RTS
VERAST JSR LJSRV
FDB TV9
FCB 2
RTS
VDISST JSR LJSRV
FDB TV10
FCB 2
RTS
VOPER$ JSR LJSRV
FDB TV11
FCB 2
RTS
VOPERI JSR LJSRV
FDB TV12
FCB 2
RTS
*
* CHECKBYTE
*
FDB $FFFF
*
* INITIAL ROM OK, RAM OK
*
RORAOK JSR NEWTST
LDB #$7A GREEN LETTERS
JSR SETCOL SET COLOR
LDU #VINITT "INITIAL TESTS INDICATE "
LDX #$2870 SCREEN ADDRESS
JSR VWTEXT WRITE TO SCREEN
LDU #VUNIOK "UNIT OK "
LDX #$4090 SCREEN ADDRESS
JSR VWTEXT WRITE TO SCREEN
LDB #$F FLASH ALL LEDS TWICE
JSR FLASHL
LDY #3000 3 SECOND DELAY
JMP DELAY AND RTS BACK TO MAIN
*
* INTIIAL ROM OK, RAM BAD
*
ROOKRB JSR NEWTST
LDB #$57 RED LETTERS
JSR SETCOL SET COLORS
LDU #VINITT "INITIAL TESTS INDICATE "
LDX #$2870 SCREEN ADDRESS
JSR VWTEXT WRITE TO SCREEN
LDU #VRAMFL "RAM FAILURE "
LDX #$3890 SCREEN ADDRESS
JSR VWTEXT WRITE TO SCREEN
BRA IDIS30 WAIT 30 SECONDS THEN RETURN
*
* INTITAL ROM BAD
*
ROMBAD JSR NEWTST
LDB #$57 RED LETTERS
JSR SETCOL SET COLORS
LDU #VINITT "INITIAL TESTS INDICATE "
LDX #$2860 SCREEN ADDRESS
JSR VWTEXT WRITE TO SCREEN
LDU #VROMFL "ROM FAILURE "
LDX #$3880 SCREEN ADDRESS
JSR VWTEXT WRITE TO SCREEN
TFR DP,A CHECK IF RAM ALSO BAD
CMPA #$9E
BEQ IDIS30
*
* RAM BAD ALSO
LDU #VRAMFL "RAM FAILURE "
LDX #$38A0 SCREEN ADDRESS
JSR VWTEXT WRITE TO SCREEN
* 30 SECOND DELAY - CHECK ADVANCE SWITCH
IDIS30 LDY #3000 30 SECOND DELAY
IDIS31 JSR DELY10 DELAY 10 MILLISECONDS
LDX #$CC00 READ COIN DOOR SWITCHES
JSR INB0
BITB #2 CHECK FOR ADVANCE
BEQ IDIS32 NO ADVANCE?, CONTINUE
LSRB CHECK AUTO/MANUAL SWITCH
BCS IDIS33 AUTO?, BACK TO MAIN PROGRAM
BRA CROM0 MANUAL?, JUMP TO DIAGNOSTICS
IDIS32 LEAY -1,Y COUNT DOWN TIME
BNE IDIS31
IDIS33 RTS BACK TO MAIN PROGRAM
*
* POWER UP SUBROUTINE
*
PWRUP ANDCC #$EF REMOVE CONTINUOUS TEST IF GET BACK HERE
LDX #CMOSCK GO READ CHECK BYTE
JSR RCBV
CMPB #$5A OK
BNE PWRUP0 NO
LDX #DIPFLG CHECK FOR SPECIAL FUNCTION
JSR INB0
ANDB #$F REMOVE GARBAGE
BNE PWRUP4 YES?, WHICH FUNCTION?
RTS NO?, DONE
*SPECIAL FUNCTION
PWRUP4 CLRB CLEAR SPECIAL FUNCTION FLAG
JSR OUTB0
LDX #DIPSW GET FUNCTION NUMBER
JSR RCBV
CLRA ZERO FUNCTION NUMBER
LEAX -2,X
JSR WCAV
CMPB #$15 AUTO CYCLE?
BNE PWRUP2 NO
AUTOCY ANDCC #$7F CLEAR AUTO CYCLE FLAG
BRA CROM0 GO DO ROM TEST
PWRUP2 CMPB #$25 RESET HIGH SCORE TABLES?
BNE PWRUP3 NO
JMP RHSTD RESET THEM
PWRUP3 CMPB #$35 CLEAR AUDITS?
BNE PWRUP1 NO
JMP CLRAUD CLEAR THEM
PWRUP1 CMPB #$45 DEFAULT?
BEQ PWRUP0 YES, DO IT
RTS
PWRUP0 LEAS 2,S REMOVE THIS CALL
JSR CMINIT INIT CMOS
JMP AUDITG GO TO AUDIT SECTION
*
* COMPREHENSIVE ROM TEST
*
CROM0 ORCC #$10 SET COMPREHENSIVE FLAG
JSR NEWTST
JSR ROM0V
PSHS U SAVE A BIT
LDU RMAPV GET IT INDIRECT
LEAU 24,U GET TO THE END
STU TEMP2D SAVE A BIT
PULS U GET IT BACK
CMPU TEMP2D DONE?
BEQ CROM10 ROMS ALL OK
* ROM FAILURE
STU ROMPTR SAVE ROM TABLE POINTER
LDB #8 LIGHT LED1
JSR LEDS
LDB #$57 RED LETTERS
JSR SETCOL SET COLORS
LDU #VROMFL "ROM FAILURE "
LDX #$3860 SCREEN ADDRESS
JSR VWTEXT WRITE TO SCREEN
LDY #IROMFL GIVE INSTRUCTIONS
JSR VOPERI
LDD #$4266 SET CURSER
STD CURSR2
CROM1 LDX CURSR2 GET CURSER
LEAX 10,X ADVANCE IT
STX CURSR2 SAVE CURSER
LDU #VWROM "ROM "
JSR VWTEXT WRITE TO SCREEN
LDU RMAPV GET INDIRECTLY
STU TEMP2D SAVE #
LDU ROMPTR RESTORE ROM POINTER
LDD ROMPTR GET ROM TABLE POINTER
SUBD TEMP2D DETERMINE WHICH ROM FAILED
LSRB
BCS CROM2 ERROR IN FIRST HALF
LEAU 1,U FORGET ABOUT OTHER HALF
CROM2 INCB
STB TEMP1A SAVE ROM NUMBER
JSR CONVTB CONVERT FROM HEX TO BCD
LDX CURSER STEAL CURSER FROM TEXT
JSR VWNUMB WRITE NUMBER TO SCREEN
JSR WATCHD RESET WATCHDOG
JSR ROM9V CONTINUE
STU ROMPTR SAVE ROM POINTER
LDU RMAPV GET IT
LEAU 24,U INDIRECTLY
CMPU ROMPTR DONE?
BNE CROM1 ANOTHER FAILURE
JSR ADVSW WAIT FOR ADVANCE SWITCH
TST ASCNTR CHECK FOR AUTO UP
BNE CRAM0 YES?, NEXT TEST
LDB TEMP1A GET LAST BAD ROM NUMBER
JSR LEDS DISPLAY ON LEDS
LDY #IROMDO GIVE INSTRUCTIONS
JSR VOPERI
BRA CROM20 WAIT FOR ADVANCE THEN RAM TEST
* ROMS OK
CROM10 TFR CC,B CHECK AUTO CYCLE NOT FLAG <===========TEMPORORY
TSTB
BPL CRAM0A CLEAR?, NEXT TEST <===========
LDB #$7A GREEN LETTERS
JSR SETCOL SET COLOR
LDU #VALROM "ALL ROMS OK "
LDX #$3880
JSR VWTEXT WRITE TO SCREEN
LDY #IROMDO GIVE INSTRUCTIONS
JSR VOPERI
LDB #8 FLASH LED 1 TWICE
JSR FLASHL
CROM20 JSR NEXTST
*
* COMPREHENSIVE RAM TEST
*
CRAM0 JSR NEWTST
CLRB TURN OFF LEDS
JSR LEDS
JSR WHITE WHITE LETTERS
LDU #VRAMTS "RAM TEST "
LDX #$4080
JSR VWTEXT WRITE TO SCREEN
LDY #IRAMTS GIVE INSTRUCTIONS
JSR VOPERI
LDY #5000 DELAY 5 SECONDS
JSR DELAY
CRAM0A JSR DELY10 WAIT 10 MILLISECONDS
TST ASCNTR CHECK FOR ADV W AUTO
LBNE CMOS0 YES, NEXT TEST
TST ASBUFF IS ADVANCE SWITCH DEFINATELY OPEN
BNE CRAM0A NO, KEEP WAITING
LDX #$C000 SET INTERESTING SCREEN COLORS
LDB #$C0
CRAM1 JSR OUTB0
LDA #$B5
MUL
EXG A,B
LEAX 1,X
CMPX #$C010
BNE CRAM1
LDD #0 ZERO RANDOM SEED
LDY #$000A INITIALIZE TEST COUNTER
JMP RAM2V BEGIN TEST
* RAM FAILURE
CRAM10 TFR Y,D GET ERROR
EORB ,-X
EORA ,-X
STD TEMP2C SAVE ERROR
STX TEMP2D SAVE ADDRESS
JSR ZEROCL ZERO COLORS
JSR SCRCLV
JSR INITDP RE-INITIALIZE DIRECT PAGE VARIABLES
JSR WATCHD RESET WATCHDOG
LDB #4 LIGHT LED 2
JSR LEDS
LDB #$57 COLOR LETTERS RED
JSR SETCOL SET COLOR
LDU #VRAMFL "RAM FAILURE "
LDX #$3870
JSR VWTEXT WRITE TO SCREEN
LDY #IRAMFL GIVE INSTRUCTIONS
JSR VOPERI
LDD TEMP2C GET ERROR IN A
TSTA
BNE CRAM11
TFR B,A
CRAM11 CLRB FIND BIT NUMBER
CRAM12 INCB
LSRA
BCC CRAM12
STB TEMP1A SAVE BAD BIT NUMBER
LDD TEMP2D GET BAD BLOCK NUMBER IN A
CRAM13 SUBA #3
BCC CRAM13
ADDA #4
STA TEMP1B SAVE BAD BLOCK NUMBER
LDU #VWRAM "RAM "
LDX #$4290 SCREEN ADDRESS
JSR VWTEXT WRITE TO SCREEN
LDB TEMP1B GET BAD BLOCK NUMBER
ASLB SHIFT ONE NIBBLE LEFT
ASLB
ASLB
ASLB
ADDB TEMP1A ADD BAD BIT NUMBER
CLRA
LDX CURSER STEAL CURSER FROM TEXT
JSR VWNUMB WRITE RAM NUMBER TO SCREEN
JSR ADVSW WAIT FOR ADVANCE SWITCH
TST ASCNTR CHECK AUTO/MANUAL SWITCH
BNE CMOS0 AUTO, SKIP TO CMOS RAM TEST
LDA TEMP1B GET BAD BLOCK NUMBER
LDB #$10 DISPLAY BAD BLOCK ON LEDS
CRAM14 LSRB
DECA
BNE CRAM14
JSR LEDS
JSR ADVSW WAIT FOR ADVANCE SWITCH
TST ASCNTR CHECK AUTO/MANUAL SWITCH
BNE CMOS0 AUTO, SKIP TO CMOS RAM TEST
LDB TEMP1A GET BAD BIT NUMBER
JSR LEDS DISPLAY ON LEDS
LDY #IRAMDO GIVE INSTRUCTIONS
JSR VOPERI
BRA CRAM30 WAIT FOR ADVSW
* RAM TEST ABORTED
CRAM20 JSR ZEROCL ZERO COLORS
JSR SCRCLV
JSR INITDP RE-INTIIALIZE DIRECT PAGE VARIABLES
JSR WATCHD RESET WATCHDOG
CMPY #$000A TEST FOR EARLY ABORT
BEQ CMOS0 ABORTED EARLY-NEXT TEST
LDB #$7A GREEN LETTERS
JSR SETCOL SET COLOR
LDU #VNORAM "NO RAM ERRORS DETECTED "
LDX #$2880
JSR VWTEXT WRITE TO SCREEN
LDY #IRAMDO GIVE INSTRUCTIONS
JSR VOPERI
LDB #4 FLASH LED 2 TWICE
JSR FLASHL
CRAM30 JSR NEXTST
*
* CMOS RAM TEST
*
CMOS0 JSR NEWTST
TFR DP,A GET CONTENTS OF CMOS RAM INTO GOOD BLOCK
CMPA #$A2 DOES GOOD BLOCK EXITS?
BNE CMOS10 YES?, CONTINUE
* NO GOOD BLOCKS
LDB #2 LIGHT LED 3
JSR LEDS
LDB #$57 COLOR LETTERS RED
JSR SETCOL SET COLOR
LDU #VCMSAB "MULTIPLE RAM FAILURE, CMOS RAM CAN NOT BE TESTED"
LDX #$2880
JSR VWTEXT WRITE TO SCREEN
LDY #ICMSDO GIVE INSTRUCTIONS
JSR VOPERI
JMP CMOS30 WAIT FOR SWITCH THEN COLOR RAM
*
CMOS10 ADDA #3 SAVE CMOS $300 ABOVE DIRECT PAGE
CLRB
STD TEMP2C SAVE ADDRESS
LDU TEMP2C INTO U REGISTER
LDX #CMOS CMOS STARTING ADDRESS
CMOS11 JSR INB0
STB ,U+
LEAX 1,X
CMPX #CMOS+$100
BNE CMOS11
LDD #$10 INITIALIZE PATTERN COUNTER AND CLEAR A
STB TEMP1A
* TEST LOOP
CLRA ZERO TEST COUNTER
CMOS12 LDX #CMOS INITIALIZE CMOS POINTER
LDB TEMP1A GET START OF PATTERN
CMOS13 JSR OUTB0
LEAX 1,X
INCB
CMPB TEMP1A CHECK IF DONE
BNE CMOS13
LDX #CMOS
INCA
CMOS14 JSR INB0
STB TEMP1B
LEAX 1,X
JSR INB0
SUBB TEMP1B
DECB
ANDB #$F MASK UPPER NIBBLE
BNE CMOS15 ERROR? ABORT TEST(TEMP1A>0)
INCA CHECK COUNTER
BNE CMOS14
JSR WATCHD RESET WATCHDOG
TST ASCNTR CHECK FOR ADV. W AUTO
BNE CMOS15 YES?, ABORT TEST
DEC TEMP1A NEXT PATTERN
BNE CMOS12
* RECOVER CMOS
CMOS15 LDU TEMP2C INTO U REGISTER
LDX #CMOS CMOS STARTING ADDRESS
CMOS16 LDB ,U+ TRANSFER DATA
JSR OUTB0
LEAX 1,X
CMPX #CMOS+$100 AT END?
BNE CMOS16
TST ASCNTR CHECK IF OPERATOR ABORTED?
BNE COLRAM NEXT TEST
LDA TEMP1A CHECK IF TEST ABORTED?
BEQ CMOS20 NO?, CMOS OK
* CMOS RAM BAD
LDB #2 LIGHT LED 3
JSR LEDS
LDB #$57 COLOR LETTERS RED
JSR SETCOL SET COLOR
JSR WATCHD GET THE DOGGY
LDU #VCMSFL "CMOS RAM FAILURE "
LDX #$3080
JSR VWTEXT WRITE TO SCREEN
JSR WATCHD GET THE DOGGY
LDY #ICMSDO GIVE INSTRUCTIONS
JSR VOPERI
BRA CMOS30 WAIT FOR SWITCH THEN COLOR RAM TEST
* CMOS RAM OK
CMOS20 LDB #$7A GREEN LETTERS
JSR SETCOL SET COLOR
LDU #VCMSOK "CMOS RAM OK "
LDX #$3880
JSR VWTEXT WRITE TO SCREEN
LDY #ICMSDO GIVE INSTRUCTIONS
JSR VOPERI
LDB #2 FLASH LED 3 TWICE
JSR FLASHL
CMOS30 JSR NEXTST
*
* COLOR RAM TEST
*
COLRAM JSR NEWTST
LDB #1 LIGHT LED #4
JSR LEDS
JSR WHITE WHITE LETTERS
LDU #VCOLTS "COLOR RAM TEST "
LDX #$3880
JSR VWTEXT WRITE TO SCREEN
LDY #ICOLTS GIVE INSTRUCTIONS
JSR VOPERI
LDY #5000 DELAY 5 SECONDS
JSR DELAY
JSR RAMBAR DO COLOR RAM BARS!!!
LDY #2000 DELAY 2 SECONDS EACH COLOR
COLRM0 LDU #COLRMT GET START OF COLOR RAM TEST TABLE
* COLOR LOOP
COLRM1 LDB ,U+
LDX #$C000 SET ALL COLORS
COLRM2 JSR OUTB0
LEAX 1,X
CMPX #$C010
BNE COLRM2
JSR DELAY WAIT TWO SECONDS
CMPU #COLRMT+8 CHECK IF FINISHED
BNE COLRM1
TST ASCNTR
BEQ COLRM0
*
* AUDIO TEST
*
SOUND0 JSR NEWTST
CLRB TURN OFF LEDS
STB TEMP2C INIT TOP HALF OF NUMBER!!
STB TEMP2C+1 AND BOTTOM
JSR LEDS
JSR WHITE WHITE LETTERS
LDU #VAUDTS "AUDIO TEST SOUND "
LDX #$4078
JSR VWTEXT WRITE TO SCREEN
LDY #IAUDTS GIVE INSTRUCTIONS
JSR VOPERI
LDY #1 NO DELAY ON FIRST SOUND
SOUND1 LDU #SKIPSN GET START OF SKIP SOUND TABLE
CLRA INITIALIZE SOUND COUNTER
SOUND2 LDX #$CC00 READ COIN DOOR SWITCHES
JSR INB0
BITB #1 CHECK AUTO/MANUAL BIT
BNE SOUND3 AUTO?, BRANCH AHEAD
BITB #2 CHECK FOR ADVANCE
BNE SOUND6 YES, PLAY SOUND
JSR DELY10 PAUSE 10 MILLISECONDS
BRA SOUND2 KEEP WAITING
SOUND3 JSR DELAY DELAY BETWEEN SOUND IN AUTO
SOUND4 INCA ADVANCE SOUND NUMBER
CMPA ,U SKIP THIS SOUND?
BNE SOUND5 NO?, PLAY IT
LEAU 1,U ADVANCE SKIP SOUND TABLE POINTER
BRA SOUND4 TRY NEXT SOUND
SOUND5 STA TEMP1A SAVE SOUND NUMBER
EORA #$3F
SOUND6 LDB #KILSND TURN OFF SOUND
JSR PLAYB
TST ASCNTR CHECK FOR ADVANCE WITH AUTO
BNE SWITST NEXT TEST
LDB TEMP1A GET NEW SOUND
JSR PLAYB
LDY #1000 NOW SET ONE SECOND DELAY
LDD TEMP2C GET OLD SOUND BCD NUMBER
LDX #$5A8C SCREEN POSITION
JSR VENUMB ERASE OLD BCD NUMBER
LDB TEMP1A GET SOUND NUMBER
JSR CONVTB CONVERT FROM HEX TO BCD
CLRA
STD TEMP2C SAVE BCD NUMBER
LDX #$5A8C SCREEN POSITION
JSR VWNUMB WRITE NEW NUMBER
LDA TEMP1A GET SOUND NUMBER
CMPA #LSOUND CHECK FOR LAST SOUND
BNE SOUND2 CONTINUE
TFR CC,B CHECK AUTO CYCLE NOT FLAG <=============TEMPORARY
TSTB
LBPL MONTRT CLEAR?, BRANCH NEXT TEST <=============
BRA SOUND1 REINITIALIZE
*
* SWITCH TEST
*
SWITST JSR NEWTST
JSR WHITE WHITE LETTERS
LDU #VSWTTS "SWITCH TEST "
LDX #$3820
JSR VWTEXT WRITE TO SCREEN
LDY #ISWTTS GIVE INSTRUCTIONS
JSR VOPERI
TFR DP,A GET ADDRESS OF DISTBL
LDB #$FF!.DISTBL
STD TEMP2C SAVE IT
ADDB #38 INITIALIZE TABLE
TFR D,X
LDA #$FF MINUS BYTE INDICATES SPACE AVAILABLE
SWIT1 STA ,-X
CMPX TEMP2C
BNE SWIT1
CLR LSCC00 ZERO LAST PIA READS
CLR LSCC04
CLR LSCC06
CLR LCC042
CLR LCC062
* TEST LOOP
SWIT2 LDA #1 INTIALIZE CONTROL PANEL NUMBER
STA TEMP1C
LDX #$CC00 GET FIRST PIA ADDRESS
LDU TEMP2C GET START OF LAST PIA READS
LEAU LSCC00-DISTBL,U
CLRA INITIALIZE SWITCH NUMBER COUNTER
SWIT3 JSR INB0
CMPX #$CC06 COCTAIL PIA?
BNE SWIT3A NO?, SKIP MASK
ANDB #$7F MASK COCTAIL BIT
SWIT3A CMPA #$18 PLAYER 2 CONTROL PANEL
BNE SWIT3B NO?, SKIP MASK
ANDB #$CF MASK ONE AND TWO PLAYER STARTS
SWIT3B STB TEMP1A SAVE DATA
EORB ,U+ COMPARE WITH LAST PIA READS
BNE SWIT5 CHANGED?, BRANCH TO SWITCH STATE CHANGE
ADDA #8 ADVANCE SWITCH NUMBER COUNTER 8 SWITCHES
SWIT4 LEAX 2,X ADVANCE PIA ADDRESS
CMPX #$CC02 CHECK IF SOUND PIA
BEQ SWIT4 YES?, SKIP IT
CMPX #$CC08 CHECK IF LAST PIA
BNE SWIT3 NO?, READ NEXT PIA
CMPA #$28 DONE SCANNING CONTROL PANEL 2?
BEQ SWIT4A YES?, QUIT SCANNING
LEAX -2,X CHECK IF COCTAIL
JSR INB0
TSTB
BPL SWIT4A NO?, QUIT SCANNING
LDB #$34 ENABLE CONTROL PANEL 2
LEAX 1,X
JSR OUTB0
LEAX -3,X SET TO PIA $CC04
INC TEMP1C CONTROL PANEL NUMBER 2
BRA SWIT3 SCAN CONTROL PANEL 2
SWIT4A LDB #$3C ENABLE CONTROL PANEL 1
LDX #$CC07
JSR OUTB0
JSR WATCHD RESET WATCHDOG
TST ASCNTR CHECK FOR ADV W AUTO
BEQ SWIT2 NO?, REPEAT TEST
BRA MONTRT NEXT TEST
* SWITCH STATE CHANGE
SWIT5 STB TEMP1B SAVE CHANGE
LDB #1 INITIALIZE BIT TEST POINTER
SWIT6 BITB TEMP1B CHECK FOR CHANGED BIT
BNE SWIT7 YES?, NEXT STEP
INCA ADVANCE SWITCH NUMBER COUNTER
ASLB MOVE BIT TEST POINTER
BRA SWIT6 CONTINUE TEST
SWIT7 LDX TEMP2C GET START OF SWITCH SCREEN TABLE
BITB TEMP1A CHECK NEW STATE OF SWITCH
BNE SWIT9 CLOSED?, BRANCH TO SWITCH CLOSED
* SWITCH OPENED
EORB ,-U CHANGE STATE ON LAST PIA READS
STB ,U
SWIT8 CMPA ,X+ FIND SWITCH ON SWITCH SCREEN TABLE
BNE SWIT8
COM ,-X KILL IT(MINUS)
BSR SWIT11 GET SCREEN POSITION
LDD #$3808 ERASE SWITCH MESSAGE
JSR BLKCLV
BRA SWIT4A NEXT SCAN
* SWITCH CLOSED
SWIT9 EORB ,-U CHANGE STATE OF LAST PIA READS
STB ,U
LDB #SWSND PLAY SOUND
JSR PLAYB
SWIT10 TST ,X+ FIND AVAILABLE SPOT ON SCREEN TABLE
BPL SWIT10
STA ,-X STORE SWITCH NUMBER AT SPOT
PSHS A SAVE SWITCH NUMBER
BSR SWIT11 GET SWITCH NAME AND SCREEN POSITION
JSR VWTEXT WRITE SWITCH NAME TO SCREEN
PULS A GET SWITCH NUMBER
CMPA #$8 CHECK IF $CC00 PIA
BLO SWIT4A SKIP PLAYER NUMBER, NEXT SCAN
LSRA CHECK IF ONE OR TWO PLAYER START
CMPA #$6
BEQ SWIT4A SKIP PLAYER NUMBER, NEXT SCAN
LDX #$CC06 CHECK IF COCTAIL
JSR INB0
TSTB
BPL SWIT4A NO?, NEXT SCAN
LDX CURSER STEAL CURSER FROM TEXT
CLRA GET PANEL NUMBER
LDB TEMP1C
JSR VWNUMB WRITE TO SCREEN
BRA SWIT4A NEXT SCAN
* CHANGE SCREEN
SWIT11 LDU #VSW0 GET FIRST SWITCH NAME VECTOR ADDRESS
CMPA #24 CHECK IF ON CONTROL PANEL 2
BLO SWT11A NO?, WRITE IT
SUBA #16 SAME NAMES AS PANEL 1 SWITCHES
SWT11A ASLA MULTIPLY SWITCH NUMBER BY 2
LEAU A,U OFFSET ADDRESS TO CHANGED SWITCH NAME
TFR X,D GET SCREEN TABLE POINTER
SUBD TEMP2C GET DISTANCE FROM TOP
LDA #$A MULTIPLY BY DISTANCE BETWEEN ENTRIES
MUL
ADDD #$3830 ADD POSITION ON SCREEN
TFR D,X SET TEXT POSITION POINTER
RTS
*
* MONITOR TEST PATTERNS
*
MONTRT JSR NEWTST
JSR WHITE WHITE LETTERS
LDU #VMONTS "MONITOR TEST PATTERNS "
LDX #$2880
JSR VWTEXT WRITE TO SCREEN
LDY #IMONTS GIVE INSTRUCTIONS
JSR VOPERI
LDX #$CC00 COIN DOOR SWITCH PIA
MONT0 LDU #PATTBL INITIALIZE PATTERN VECTOR POINTER
MONT1 JSR INB0
BITB #1 CHECK FOR MANUAL
BEQ MONT2 YES?, WAIT FOR ADVANCE SWITCH, NEXT PATTERN
LDY #5000 DELAY 5 SECONDS
MONT4 JSR DELAY
TST ASCNTR CHECK FOR ADV W AUTO
LBNE AUDITG YES?, NEXT TEST
JSR INB0
BITB #1 CHECK FOR AUTO UP
BNE MONT3 YES?, DISPLAY NEXT PATTERN
MONT2 JSR ADVSW WAIT FOR ADVANCE SWITCH
TST ASCNTR CHECK FOR ADV W AUTO
LBNE AUDITG YES?, NEXT TEST
MONT3 PSHS U,Y,X SAVE REGISTERS
JSR [,U] DISPLAY PATTERN
PULS X,Y,U RECOVER REGISTERS
LEAU 2,U ADVANCE PATTERN VECTOR POINTER
CMPU #PATTBL+10 CHECK FOR LAST PATTERN
BNE MONT1 NO?, CONTINUE
LDY #5000 LET THIS PATTERN LAST 5 SECS TOO
JSR DELAY BEFORE MOVING ON
TFR CC,B CHECK AUTO CYCLE NOT FLAG <=============TEMPORARY
TSTB
LBPL CROM0 CLEAR?, BRANCH NEXT TEST <=============
BRA MONT0 RESTART
*
* DON HASSLER CROSSHATCH
*
* RAM0 = BLACK - 00
* RAM1 = WHITE - FF
* RAM2 = BLUE - C0
* RAM3 = GREEN - 38
* RAM4 = RED - 07
*
CROSS JSR WATCHD RESET DOGGY
JSR SCRCLV CLEAR SCREEN
JSR ZEROCL SET ALL TO BLACK
LDX #$C001 SET COLOR 1
LDB #$FF WHITE
JSR OUTB0 DO IT
LDX #$C002 SET COLOR 2
LDB #$C0 BLUE
JSR OUTB0 DO IT
LDX #$C003 SET COLOR 3
LDB #$38 GREEN
JSR OUTB0 DO IT
LDX #$C004 SET COLOR 4
LDB #$07 RED
JSR OUTB0 DO IT
JSR WATCHD GET THE DOGGY
LDY #WVERT MOVE WHITE VERTICALS
LDD #$0101
CROSS4 LDX 0,Y GET START PTR
CROSS5 STD ,X++ MOVE IN WHITE
CMPX 2,Y CK IF LINE DONE
BNE CROSS5 NO, KEEP GOING
LEAY 4,Y INCR Y BY 4
CMPY #WVERTX CK IF ALL DONE
BNE CROSS4 NO, DO NEXT LINE
JSR WATCHD GET THE DOGGY
LDA #$11 MOVE WHITE HORIZ
LDY #WHORZ
CROSS2 LDX 0,Y GET START PTR
STX TMPAD
CROSS3 STA 0,X MOVE IN WHITE
INC TMPAD UPDATE PTR
LDX TMPAD
CMPX 2,Y CK IF DONE
BNE CROSS3 NO, KEEP GOING
LEAY 4,Y INCR Y BY 4
CMPY #WHORZX CK IF ALL DONE
BNE CROSS2 NO, DO NEXT LINE
JSR WATCHD GET THE DOGGY
LDY #HORIZ MOVE IN COLOR HORIZ.
CROSS6 LDX 0,Y GET START PTR
STX TMPAD
LDA 4,Y GET COLOR
CROSS7 STA 0,X MOVE IN COLOR
INC TMPAD
LDX TMPAD
CMPX 2,Y CK IF LINE DONE
BNE CROSS7 NO, KEEP GOING
LEAY 5,Y INCR Y BY 5
CMPY #HORIZX CK IF ALL DONE
BNE CROSS6 NO, DO NEXT LINE
JSR WATCHD GET THE DOGGY
LDY #VERT MOVE IN COLOR VERTICAL
CROSS8 LDX 0,Y GET START PTR
LDA 4,Y GET COLOR
CROSS9 STA ,X+ MOVE IN COLOR
CMPX 2,Y CK IF LINE DONE
BNE CROSS9 NO, KEEP GOING
LEAY 5,Y INCR Y BY 5
CMPY #VERTX CK IF ALL DONE
BNE CROSS8 NO, DO NEXT LINE
JSR WATCHD GET THE DOGGY
LDA #$21 BLUE TOUCH UP
STA $467E
LDA #$20
STA $967E
LDX #$4E0A
CROSSA LDA 0,X
ANDA #$F0
ORA #$02
STA ,X+
CMPX #$4E6D
BNE CROSSA
LDX #$4E90
CROSSB LDA 0,X
ANDA #$F0
ORA #$02
STA ,X+
CMPX #$4EF3
BNE CROSSB
JSR WATCHD GET THE DOGGY
LDX #$0E18
STX TMPAD MOVE IN DOTS
CROSSC LDX TMPAD
LDA 0,X OR IN DOT
ANDA #$F0
ORA #$01
STA 0,X STORE DOT
LDB TMPAD+1 UPDATE VERTICAL PTR
ADDB #$22
BCS CROSSD
STB TMPAD+1
BRA CROSSC
CROSSD LDB #$18
STB TMPAD+1 RE-INIT VERT. PTR
LDB TMPAD
ADDB #$10 UPDATE HORIZ PTR
STB TMPAD
CMPB #$9E CK IF DONE
BNE CROSSC NO, KEEP GOING
JMP WATCHD GET DOGGY + RTS THERE
*
* CROSS HATCH DATA
*
WHORZ FDB $0707
FDB $9707
FDB $0729
FDB $9729
FDB $074B
FDB $974B
FDB $076D
FDB $976D
FDB $078F
FDB $978F
FDB $07B1
FDB $97B1
FDB $07D3
FDB $97D3
FDB $07F5
FDB $97F5
WHORZX EQU *
WVERT FDB $0607
FDB $06F5
FDB $1607
FDB $16F5
FDB $2607
FDB $26F5
FDB $3607
FDB $36F5
FDB $4607
FDB $46F5
FDB $5607
FDB $56F5
FDB $6607
FDB $66F5
FDB $7607
FDB $76F5
FDB $8607
FDB $86F5
FDB $9607
FDB $96F5
WVERTX EQU *
HORIZ FDB $4805
FDB $5505
FCB $44
FDB $4806
FDB $5506
FCB $44
FDB $4807
FDB $5507
FCB $00
FDB $4808
FDB $5508
FCB $33
FDB $4809
FDB $5509
FCB $33
FDB $48F3
FDB $55F3
FCB $33
FDB $48F4
FDB $55F4
FCB $33
FDB $48F5
FDB $55F5
FCB $00
FDB $48F6
FDB $55F6
FCB $44
FDB $48F7
FDB $55F7
FCB $44
FDB $077E
FDB $467E
FCB $22
FDB $577E
FDB $967E
FCB $22
HORIZX EQU *
VERT FDB $056F
FDB $058E
FCB $04
FDB $066F
FDB $068E
FCB $30
FDB $966F
FDB $968E
FCB $00
FDB $976F
FDB $978E
FCB $34
VERTX EQU *
* RED FIELD
RFIELD JSR SCRCLV CLEAR SCREEN
LDB #$5 COLOR RED
RFIEL LDX #$C000
BSR RFIEL1 INDIRECT
LDX #$C00C HIDE WATCHDOG
RFIEL1 JMP OUTB0
* GREEN FIELD
GFIELD LDB #$28 COLOR GREEN
BRA RFIEL DO IN IT THE RED ROUTINE
* BLUE FIELD
BFIELD LDB #$80 COLOR BLUE
BRA RFIEL DO IT IN THE RED PROGRAM
* COLOR BAR
COLBAR LDY #CBARCL SET COLORS
JSR SCOLOR
JMP COLORB DRAW COLOR BARS
*
* SET COLOR AT LETCOL TO "B"
*
WHITE LDB #$A5 WHITE LETTERS
SETCOL LDX #LETCOL POINT TO IT
JMP OUTB0 MAKE IT THAT COLOR
PAGE