-
Notifications
You must be signed in to change notification settings - Fork 6
/
TEST12.SRC
executable file
·1241 lines (1199 loc) · 21.1 KB
/
TEST12.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
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
NLIST
INCLUDE SPHR56.SRC
INCLUDE EQ4.SRC
LIST
TTL <<<<< S T A R G A T E >>>>>
ORG RAMALS USE SAMS RAM
SW0ST RMB 1
SW0SCN RMB 1
SW2ST RMB 1
SW2SCN RMB 1
SW3ST RMB 1
SW3SCN RMB 1
SW2STI RMB 1
SW2SCI RMB 1
SW3STI RMB 1
SW3SCI RMB 1
ORG TSTORG
JMP AUD$
JMP AUD1$
JMP PWRUP
JMP ADVSW$
JMP AUTCYC
* AUDIT: COUNT=A, COUNTER=B (1-7)
*
AUD1$ PSHS D,X SAVE STATE
LDA #$01 BUMP BY COUNT OF 1
BRA AUD2
AUD$ PSHS D,X SAVE STATE
AUD2 ANDB #$0F LIMIT TO 0-F
ASLB MAKE INTO 4X
PSHS B
ASLB
ADDB ,S+ 6X
LDX #CMOS-4+$100 POINT TO START-6 (CREDITS TAKES UP 2)
ABX GET THE CORRECT DESTINATION
JSR RCMOSB
PSHS B
JSR RCMOSB
PSHS B
JSR RCMOSB
PSHS B
ADDA ,S
DAA
STA ,S
LDA 1,S
ADCA #0
DAA
STA 1,S
LDA 2,S
ADCA #0
DAA
LEAX -6,X
JSR WCMOSA
PULS B
PULS A
JSR WCMOSD
PULS A
AUDX PULS D,X,PC CLEAN UP
*
*** POWER UP ROUTINE
*
PWRUP ORCC #$FF NO INTERRUPTS ETC.
LDS #HSTK IF AND WHEN WE DECIDE TO USE THE STACK
CLR PIA0+1
CLR PIA0
LDA #$3C SET LED 3 TO 1 (WE'RE MAKING AN F TO BLANK)
STA PIA0+1
CLR PIA1+1
LDA #$C0 BITS 6,7 TO OUTPUTS (LEDS)
STA PIA1
LDA #$3C SET BIT 2 TO 1
STA PIA1+1 CLEAR CB2 (LED)
LDA #$C0 CLEAR LEDS
STA PIA1 SET BITS 0,1
LDA #1
STA RWCNTL MAKE SURE WE COPY FROM ROM!
LDX #CRTAB
LDY #CRAM
PWRUP0 LDD ,X++
STD ,Y++
CMPX #CRTAB+16
BLO PWRUP0
LDA #2
LDY #PWRUP1
LDX #0
JMP RAMTST DO A RAM TEST.
PWRUP1 LDY #PWRUP4
JMP ROMTST
PWRUP4 LDA #$34 PUT A ZERO IN THE LED.
STA PIA0+1
STA PIA1+1
CLR PIA1
LDA #RAM!>8
TFR A,DP
LDS #HSTK
JSR SCRCLR
LDA #OKM
JSR WRD7V INDICATE OK
LDY #INITV DELAY TO JUMP INTO GAME.
LDA #7
JMP DELA1
*
* ADVANCE SWITCH
*
ADVSW$ LDA INDIAG ALREADY HERE??
BNE SUCDV
NAP 2,ADVSW2 MAKE SURE THAT ITS NOT NOISE
ADVSW2 LDA PIA0 IS IT STILL PRESSED??
BITA #$02 WELL??
BNE ADVSW3 YEP
SUCDV JMP SUCIDE NOPE...DIE
ADVSW3 JSR GNCIDE CAN EVERYBODY
JSR P1SW MAKE SURE PROPER DIRECTION FACED
LDA #$FF
STA INDIAG
STA STATUS KEEP EM ALL OUT
JSR INITCM INITIALIZE COLOR MATRIX
LDA PIA0 CHECK WHICH TYPE OF TEST
RORA AUTO UP??
LBCS BOOK YEP...GO TO BOOKKEEPING
JSR SCRCLR
ORCC #$BF FIRQ ENABLED INDICATES NORMAL AGNOSTICS RUNNING.
LDY #DAG999
JMP BLKLED BLANK THE LEDS
DAG999 LDA #WDATA
STA WDOG
LDA PIA0 WAIT FOR ADVANCE SWITCH LET GO
BITA #2
BNE DAG999
LDY #DIAG0
JMP ROMTST DO THE ROM TEST
DIAG0 LDA #RAM!>8
TFR A,DP
JSR SCRCLR CLEAR FOR ROMS MESSAGE.
LDA #ROMOK
JSR WRD7V PRINT THE MESSAGE
LDB #3
DIG111 LDX #$7000
DIAG1 LDA #WDATA
STA WDOG
LDA PIA0
BITA #2
BNE DIAG2 CONTINUE IF ADVANCE PRESSED.
LEAX -1,X
CMPX #0
BNE DIAG1
DECB
BNE DIG111
DIG11$ LDY #DIAG2
LDX #0
LDA #$FF INDICATE FRONT DOOR
JMP RAMTST DO THE RAM TEST.
DIAG2 LDA #1
STA RWCNTL
LDA #RAM!>8
TFR A,DP
JSR SCRCLR
LDA #RAMOK
JSR WRD7V PRINT RAM OK MESSAGE
DIAG22 LDA #WDATA
STA WDOG
LDA PIA0
BITA #2
BNE DIAG22 HOLD CONTROL UNTIL LET GO.
RAMERJ LDX #$9C00 RAM ERROR MESSAGE COMES HERE.
DIAG3 CLR ,X+ CLR USABLE MEMORY
LDB #WDATA
STB WDOG
CMPX #HSTK+1
BNE DIAG3
LDD #$A55A
STD HSEED
STA INDIAG INDICATE THAT WE'RE AGNOSTICS
JSR PINIT TIME TO LET THE SYSTEM TAKE OVER
JSR INT20V
JSR P1SW
COM STATUS
MAKP DIAG4 START A PROCESS TO CONTINUE
BSR ZLED ZERO IN LED
ANDCC #0 LET THE INTERRUPTS IN
JMP EXEC GO!
DIAG4 JSR AVWAIT WAIT FOR ADVANCE SWITCH.
JSR CMTEST TEST CMOS.
ANDCC #1 INTERRUPTS BACK ON LEAVE CARRY
LDA #CMOK
BCC DIAG66
LDB #$2F INDICATE THAT ITS IN R/W HALF
CMPX #CMOS+$100
BHI DIAG5 IT WAS IN WRITABLE HALF
LDB #$1F
DIAG5 ORCC #$10 LOCK OUT THE INTERRUPTS
LDS #DIAG55
LDA #$3
JMP PULSE
DIAG55 LDS #HSTK
BSR ZLED
LDA #RAM!>8
TFR A,DP
ANDCC #$EF LET THE INTERRUPTS BACK
LDA #CMERR
CMPB #$1F
BHI DIAG66
LDA #CMDOOR
DIAG66 JSR SCRCLR
JSR WRD7V PRINT ONE OF THE TWO MESSAGES.
LDU CRPROC
JSR AVWAIT
CLR PD+2,U INDICATE FRONT DOOR TEST CALLING
JSR SNDSRT START THE SOUND TEST
DIAG6 JSR SNDCYC CYCLE ONE SOUND
JSR AVCHK CHECK ADVANCE SWITCH.
BCC DIAG6 NOT PRESSED, DO ANOTHER SOUND
LDA #$3F
STA SOUND
NAP 1,DIAG77
DIAG77 LDA #$C SILENCE
STA SOUND
JSR AVWAIT NOW WAIT FOR RELEASE.
JSR SWTEST DO A SWITCH TEST.
JSR AVWAIT WAIT FOR RELESE
JSR CRTEST DO THE COLOR MATRIX TEST
JSR AVCHK HOLDING BUTTON??
BCC DIAG78 NOPE...CONTINUE
JSR AVWAIT WAIT FOR LET GO TIME.
DIAG78 JMP TSTPAT DO SOME TEST PATTERNS THEN GO TO BOOK.
ZLED CLR PIA1 ZERO IN LED INDICATES ON LAST TEST OR DUN
LDA #$34
STA PIA0+1
INCA
STA PIA1+1
RTS
*
INITCM LDX #CRTAB
LDY #PCRAM
ADVS90 LDD ,X++
STD ,Y++
CMPX #CRTAB+16
BLO ADVS90
RTS
*
*** AUTO CYCLE
*
AUTCYC LDA #$3F MAKE LOOK LIKE FRONT DOOR TEST THANX TO MOTOROLA
TFR A,CC SET TO AUTOCYCLE NO INTS PLEASE ETC.
LDA #$8F FIFTEEN RAM PASSES, IN AUTOCYCLE
LDX RAMALS+$600 TAKE A BYTE FROM THE RAM TEST
LEAX $1234,X ADD A STUPID NUMBER TO VARY TEST
LDY #AUTO1
JMP RAMTST TEST THE RAM
AUTO1 LDY #AUTO2
JMP ROMTST
AUTO2 LDA #RAM!>8
TFR A,DP
LDS #HSTK JUST IN CASE
JSR CMTEST
BCC AUTO4
LDA #CMDOOR
CMPX #CMOS+$100 WRITE PROTECT??
BLS AUTO8
LDA #CMERR
AUTO8 JSR SCRCLR
JSR WRD7V PRINT THE ERROR
AUTO5 LDA #WDATA
STA WDOG
BRA AUTO5
AUTO4 JSR BARS
LDY #AUTCYC
LDA #4
JMP DELA1
*
*** TEST PATTERNS
*
TSTPAT JSR CROSS DO FANCY HASSLER PAT.
JSR AVWAIT WAIT FOR ADVANCE
JSR SCRCLR
LDA #$7 RED
STA PCRAM
JSR AVWAIT
LDA #$38 GREEN
STA PCRAM
JSR AVWAIT
LDA #$C0
STA PCRAM BLUE
JSR AVWAIT
JSR BARS
JSR AVWAIT
JMP BOOK
BARS LDX #PCRAM
LDY #CBARCL
LDU #CRAM
BARS0 LDD ,Y++ GET A COLOR
STD ,X++
STD ,U++ IN CASE INTERRUPTS OFF
LDA #WDATA
STA WDOG
CMPX #PCRAM+16
BLO BARS0
LDD #0
LDX #0
COLOR1 STX XTEMP
LEAX $F00,X
COLOR2 STD ,--X
PSHS A
LDA #WDATA
STA WDOG
PULS A
CMPX XTEMP
BNE COLOR2
LEAX $900,X
TSTA
BNE COLOR3
LDX #$D00
COLOR3 ADDD #$1111
BCC COLOR1
RTS
*
CBARCL FCB $5,$5,$28,$28,$80,$80,$0,$0
FCB $AD,$AD,$2D,$2D,$A8,$A8,$85,$85
*
* DON HASSLER CROSSHATCH
*
* RAM0 = BLACK - 00
* RAM1 = WHITE - FF
* RAM2 = BLUE - C0
* RAM3 = GREEN - 38
* RAM4 = RED - 07
*
CROSS JSR SCRCLR CLEAR SCREEN
CLRA
JSR SETPCR ZERO COLOR MATRIX
LDA #$FF
STA PCRAM+1
LDA #$C0
STA PCRAM+2
LDA #$38
STA PCRAM+3
LDA #$7
STA PCRAM+4
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
LDA #$11 MOVE WHITE HORIZ
LDY #WHORZ
CROSS2 LDX 0,Y GET START PTR
STX XTEMP
CROSS3 STA 0,X MOVE IN WHITE
INC XTEMP UPDATE PTR
LDX XTEMP
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
LDY #HORIZ MOVE IN COLOR HORIZ.
CROSS6 LDX 0,Y GET START PTR
STX XTEMP
LDA 4,Y GET COLOR
CROSS7 STA 0,X MOVE IN COLOR
INC XTEMP
LDX XTEMP
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
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
LDA #$21 BLUE TOUCH UP
STA $437E
LDA #$20
STA $937E
LDX #$4B0A
CROSSA ORCC #$10 SEI
CLR RWCNTL
LDA 0,X
LDB #1
STB RWCNTL
ANDCC #$EF CLI
ANDA #$F0
ORA #$02
STA ,X+
CMPX #$4B6D
BNE CROSSA
LDX #$4B90
CROSSB ORCC #$10 SEI
CLR RWCNTL
LDA 0,X
LDB #1
STB RWCNTL
ANDCC #$EF CLI
ANDA #$F0
ORA #$02
STA ,X+
CMPX #$4BF3
BNE CROSSB
LDX #$0B18
STX XTEMP MOVE IN DOTS
CROSSC LDX XTEMP
LDA 0,X OR IN DOT
ANDA #$F0
ORA #$01
STA 0,X STORE DOT
LDB XTEMP+1 UPDATE VERTICAL PTR
ADDB #$22
BCS CROSSD
STB XTEMP+1
BRA CROSSC
CROSSD LDB #$18
STB XTEMP+1 RE-INIT VERT. PTR
LDB XTEMP
ADDB #$10 UPDATE HORIZ PTR
STB XTEMP
CMPB #$9B CK IF DONE
BNE CROSSC NO, KEEP GOING
RTS
*
* CROSS HATCH DATA
*
WHORZ FDB $0407
FDB $9407
FDB $0429
FDB $9429
FDB $044B
FDB $944B
FDB $046D
FDB $946D
FDB $048F
FDB $948F
FDB $04B1
FDB $94B1
FDB $04D3
FDB $94D3
FDB $04F5
FDB $94F5
WHORZX EQU *
WVERT FDB $0307
FDB $03F5
FDB $1307
FDB $13F5
FDB $2307
FDB $23F5
FDB $3307
FDB $33F5
FDB $4307
FDB $43F5
FDB $5307
FDB $53F5
FDB $6307
FDB $63F5
FDB $7307
FDB $73F5
FDB $8307
FDB $83F5
FDB $9307
FDB $93F5
WVERTX EQU *
HORIZ FDB $4505
FDB $5205
FCB $44
FDB $4506
FDB $5206
FCB $44
FDB $4507
FDB $5207
FCB $00
FDB $4508
FDB $5208
FCB $33
FDB $4509
FDB $5209
FCB $33
FDB $45F3
FDB $52F3
FCB $33
FDB $45F4
FDB $52F4
FCB $33
FDB $45F5
FDB $52F5
FCB $00
FDB $45F6
FDB $52F6
FCB $44
FDB $45F7
FDB $52F7
FCB $44
FDB $047E
FDB $437E
FCB $22
FDB $547E
FDB $937E
FCB $22
HORIZX EQU *
VERT FDB $026F
FDB $028E
FCB $04
FDB $036F
FDB $038E
FCB $30
FDB $936F
FDB $938E
FCB $00
FDB $946F
FDB $948E
FCB $34
VERTX EQU *
*
*** COLOR MATRIX TEST
*
CRTEST PULS D GET RETURN
LDU CRPROC
STD PD+6,U SAVE
JSR SCRCLR CLEAR OUT BABY
LDA #CMTSTM PRINT THE MESSAGE
JSR WRD7V
LDA #$80
STA PD,U
CRTST1 NAP 1,CRTST2
CRTST2 JSR AVCHK PRESS??
BCS CMTBYE NOPE
DEC PD,U DONE WITH DELAY??
BNE CRTST1
LDA COLRMT GET FIRST COLOR.
BSR SETPCR STORE IT DOWN
BSR RAMBAR SET UP MEMORY.
CRTT$$ LDX #COLRMT TABLE TO STORE
CRTST3 LDA ,X+ GET A COLOR
LDU CRPROC
STX PD+2,U
BSR SETPCR STORE IT THROUGH
LDA #$80
STA PD,U
CRTST4 NAP 1,CRTST5
CRTST5 JSR AVCHK ADVANCE??
BCS CMTBYE YEP
DEC PD,U
BNE CRTST4
LDX PD+2,U RESTORE POINTER
CMPX #COLRMT+8
BLO CRTST3
BRA CRTT$$ CONTINUE THROUGH
CMTBYE LDU CRPROC
JMP [PD+6,U]
RAMBAR LDX #$0
LDY #COLRMD NUMBERS TO PUT IN BARS
RAMBA1 STX XTEMP SAVE OUR X
LEAX $F00,X
LDA ,Y+
TFR A,B
RAMBA2 STD ,--X
CMPX XTEMP
BNE RAMBA2
LEAX $900,X
TSTA
BNE RAMBA3
LDX #$D00
RAMBA3 CMPY #COLRMD+16
BNE RAMBA1
RTS
COLRMT FCB $02,$03,$04,$10,$18,$20,$40,$80
COLRMD FCB $00,$FF,$11,$EE,$22,$DD,$33,$CC
FCB $44,$BB,$55,$AA,$66,$99,$77,$88
SETPCR LDX #PCRAM
SETPC1 STA ,X+
CMPX #PCRAM+16
BLO SETPC1
RTS
*
*** SWITCH TEST
*
SWMH EQU 44 HEIGHT OF FIRST MESSAGE
SWTEST PULS D GET RETURN ADDR
LDU CRPROC
STD PD+6,U
LDA #10
STA PD+4,U DELAY COUNTER FOR EXIT
JSR SCRCLR CLEAR IT PLEASE
LDA #SWTESM SWITCH TEST MESSAGE.
JSR WRD7V
LDU #RAMALS
SWTES0 CLR ,U+
CMPU #SW3SCI+1
BLS SWTES0
SWTES2 LDU #STABP
BSR SWSCN0
SWTES1 LDA #$34
STA PIA3+1
BSR SWSCN0 SCAN THE COCKTAIL SIDE
LDA #$3C
STA PIA3+1
BSR SWDISP
JSR AVCHK ADVANCE PRESSED?
BCC SWT999 NOPE.
LDU CRPROC
DEC PD+4,U
BEQ SWTBYE
SWT999 NAP 1,SWTES2
SWTBYE LDU CRPROC
JMP [PD+6,U] "RETURN"
SWSCN0 LDX ,U++ GET ADDRESS OF PORT
BEQ SWSCN5 DONE
LDY ,U++ GET ADDRESS TO STORE STATE
LDA ,X GET NEW STATE
EORA ,Y SEE WHERE DIFFERENT
STA 1,Y AND SAVE AS DIFFERENCE BYTE.
BRA SWSCN0
SWSCN5 RTS
SWDISP LDU #SPHTAB WE'LL WALK THROUGH SWITCH PHRASE TABLE
LDY #RAMALS WALK THROUGH THE SCANNED STUFF.
SWDIS4 LDB #1 WALK FROM LSB
SWDIS0 BITB 1,Y SEE IF THIS BIT CHANGED.
BEQ SWDIS2
BSR SWACT TAKE SOME ACTION
SWDIS2 LEAU 3,U MOVE TO NEXT ENTRY
ASLB SHIFT ONE DOWN
BCC SWDIS0
LEAY 2,Y TO NEXT BYTE
CMPY #SW3SCI PAST TABLE
BHI SWDIS9 YEP..DONE
LDA PIA3 COCKTAIL
BMI SWDIS4 YEP...FULL SCAN
CMPY #SW3SCN NOPE..DONE WITH NORMAL SWITCHES??
BLS SWDIS4 NOT DONE
SWDIS9 RTS RETURN BABY.
SWACT PSHS B,X SAVE THE MASK
LDA #$3F
STA SOUND BRING SOUND LINES HIGH IN ANTICIPATION
EORB ,Y INVERT THE BIT
STB ,Y AND MAKE THAT THE NEW STATE
LDB ,S RESTORE MASK
BITB ,Y WHICH WAY DID IT GO
BNE SWPRNT ON....PRINT A MESSAGE.
LDB 2,U HEIGHT
BEQ SWNOAC
LDA #$40 X
TFR D,X MAKE IT CURSOR
LDD #$3006
JSR BLKCLR CLEAR THE BLOCK
PULS B,X,PC
SWPRNT LDB 2,U GET HEIGHT
BEQ SWNOAC
LDA #$40 CURSOR
TFR D,X
LDB #$BB
STB TEXCOL
LDD ,U GET MESSAGE NUMBER,B (PLAYER NUMBER)
JSR WRD5FV AND PRINT IT.
LDA #$17
STA SOUND MAKE A SOUND
SWNOAC PULS B,X,PC AND RETURN.
STABP FDB PIA0,SW0ST
FDB PIA2,SW2ST
FDB PIA3,SW3ST
FDB 0
FDB PIA2,SW2STI
FDB PIA3,SW3STI
FDB 0
SPHTAB FCB SWMES1,0,SWMH AUTO UP
FCB SWMES1+1,0,SWMH+7 ADVANCE
FCB SWMES1+2,0,SWMH+14 RIGHT COIN
FCB SWMES1+3,0,SWMH+21 HIGH SCORE RESET
FCB SWMES1+4,0,SWMH+28 LEFT COIN
FCB SWMES1+5,0,SWMH+35 CENTER COIN
FCB SWMES1+6,0,SWMH+42 SLAM SWITCH
FCB 0,0,0 UNUSED (SOUND HANDSHAKE)
*
FCB SWMES1+7,1,SWMH+49 FIRE (1)
FCB SWMES1+8,1,SWMH+56 THRUST (1)
FCB SWMES1+9,1,SWMH+63 SMARTBOMB (1)
FCB SWMES1+10,1,SWMH+70 HYPERSPACE (1)
FCB SWMES1+11,0,SWMH+77 START 2
FCB SWMES1+12,0,SWMH+84 START 1
FCB SWMES1+13,1,SWMH+91 REVERSE (1)
FCB SWMES1+14,1,SWMH+98 DOWN (1)
*
FCB SWMES1+15,1,SWMH+105 UP (1)
FCB SWMES1+16,1,SWMH+112 INVISO (1)
FCB 0,0,0 UNUSED
FCB 0,0,0 UNUSED
FCB 0,0,0 UNUSED
FCB 0,0,0 UNUSED
FCB 0,0,0 UNUSED
FCB 0,0,0 UNUSED
*
FCB SWMES1+7,2,SWMH+119 FIRE (2)
FCB SWMES1+8,2,SWMH+126 THRUST (2)
FCB SWMES1+9,2,SWMH+133 SMART BOMB(2)
FCB SWMES1+10,2,SWMH+140 HYPERSPACE (2)
FCB 0,0,0 UNUSED
FCB 0,0,0 UNUSED
FCB SWMES1+13,2,SWMH+147 REVERSE (2)
FCB SWMES1+14,2,SWMH+154 DOWN (2)
*
FCB SWMES1+15,2,SWMH+161 UP (2)
FCB SWMES1+16,2,SWMH+168 INVISO (2)
FCB 0,0,0 UNUSED
FCB 0,0,0 UNUSED
FCB 0,0,0 UNUSED
FCB 0,0,0 UNUSED
FCB 0,0,0 UNUSED
FCB 0,0,0 UNUSED
FDRET LDU #RAMERJ RAM ERROR RETURN
BRA FDROM0
FDROM LDU #DIG11$
FDROM0 LDS #HSTK
FDROM5 LDY #FDROM6
LDA #1
JMP DELA1
FDROM6 LDA PIA0
BITA #$2
BNE FDROM5
FDROM1 LDY #FDROM7
LDA #1
JMP DELA1
FDROM7 LDA PIA0
BITA #$2
BEQ FDROM1
FDROM2 LDY #FDROM8
LDA #1
JMP DELA1
FDROM8 LDA PIA0
BITA #2
BNE FDROM2
JMP ,U
AVWAIT PULS D
LDU CRPROC
STD PD+6,U
AVWAI$ LDA PIA0 SEE IF ADVANCE PRESSED
BITA #$2 WELL??
BNE AVWAT2
NAP 1,AVWAI$ WELL, WAIT FOR IT.
AVWAT2 CLR PCRAM
JSR SCRCLR
BRA AVWAT5
AVWAT4 LDA PIA0
BITA #$2 WAIT FOR IT TO BE RELEASED
BEQ AVWAT3
AVWAT5 NAP 2,AVWAT4
AVWAT3 JMP [PD+6,U]
AVCHK LDA PIA0
BITA #$2
BEQ AVCHK1
ORCC #$01 SEC
RTS
AVCHK1 ANDCC #$FE CLC
RTS
*
* DISPLAY BOOKKEEPPING
*
BOOK LDA #$FF
STA STATUS
JSR INITCM COLOR MATRIX PROPER.
JSR AVCHK
BCC BOOK3
JSR AVWAIT WAIT FOR HIM TO LET GO.
BOOK3 LDA #BOOKM
JSR WRD7V PRINT THE BOOKKEEPING MESSAGE
LDU #SLOT1
LDA #AUDMES FIRST OF THE AUDIT MESSAGES
BOOK0 PSHS A SAVE MESSAGE NUMBER
JSR WRD7V PRINT IT.
EXG U,X
JSR RCMOSB GET THE TOP BYTE
PSHS B
JSR RCMOSD
TFR D,Y
PULS B
EXG U,X
TSTB
BEQ BOOK1
LDA #AUDM1
JSR WRD7V FULL SIX DIGITS USED
LDA #AUDM2
JSR WRD7V
BRA BOOK2
BOOK1 LDA #AUDM3
JSR WRD7V
BOOK2 PULS A RESTORE A
INCA
CMPU #WARPS
BLS BOOK0 THANK YOU SIR, MAY I HAVE ANOTHER??
JSR AVWAIT
JMP ADJV NOW GO DO ADJUSTMENT MODE
*
* SOUND TEST
*
SNDSRT JSR SCRCLR CLEAR THE SCREEN
SNDSR1 LDD #$FE01 SET UP FOR SOUND LINE 1
STD PD,U
RTS
SNDCYC PULS D
STD PD+6,U
LDA #$3F
STA SOUND
NAP 1,SNDC55
SNDC55 LDA #$C
STA SOUND
NAP 1,SNDCY6
SNDCY6 LDA #$3F
STA SOUND
NAP 1,SNDCY1
SNDCY1 LDD PD,U
ANDA #$3F
STA SOUND
LDA #SNDTEX
JSR WRD7V
LDA #$40
STA PD+4,U
SNDCY4 NAP 1,SNDCY5
SNDCY5 JSR AVCHK ADVANCE???
BCS SNDCY3 THEN GO
DEC PD+4,U
BNE SNDCY4
SNDCY3 LDA PD+2,U SEE WHO SET THIS UP??
BNE SNDC90 AUTOCY DID....ALWAYS ADVANCE
LDA PIA0 CHECK MANUAL/AUTO
RORA
BCC SNDC91 MANUAL...DON'T MOVE ON.
SNDC90 LDD PD,U
ORCC #$01 SEC
ROLA MOVE TO NEXT LINE
INCB
CMPB #6 UP TO LINE 6??
BLO SNDCY2
BSR SNDSR1
SNDCY2 STD PD,U
SNDC91 JMP [PD+6,U]
*
* CMOS RAM TEST
*
CMTEST LDX #CMOS
LDY #RAMALS USE SAMRAM
CMTST1 LDA ,X+ DON'T DO DOUBLES BECAUSE OF HARDWARE BRAIN DAM.
STA ,Y+
CMPX #CMOS+$400 DONE??
BNE CMTST1
LDB #6 ENOUGH ITERATIONS TO ASSURE
ORCC #$3F STOP INTERRUPTS
CMTST2 LDU HSEED
LDY SEED
LDX #CMOS
CMTST3 JSR RAND
STA ,X+
LDA #WDATA
STA WDOG
CMPX #CMOS+$400 DONE??
BNE CMTST3
STY SEED RESTORE SEED
STU HSEED
LDX #CMOS
CMTST4 JSR RAND
EORA ,X+
ANDA #$F
BNE CMEROR
LDA #WDATA
STA WDOG
CMPX #CMOS+$400
BNE CMTST4
DECB ANOTHER PASS...DONE??
BNE CMTST2
BSR RAMBAK
ANDCC #$FE CLC CLEAR IT FOR REAL
RTS AND RETURN
RAMBAK LDU #RAMALS
LDY #CMOS
RAMBK0 LDA ,U+
STA ,Y+
CMPY #CMOS+$400
BNE RAMBK0
RTS
CMEROR BSR RAMBAK
ORCC #$01 SEC
RTS
* RAM TEST....Y = PLACE TO RETURN IF NO ERROR
* X = SEED TO START WITH
* A = ITERATIONS TO MAKE
RAMTST ORCC #$3F NO INTERRUPTS DURING TEST
CLR RWCNTL SET TO RAM READ
TFR A,DP COUNT AT DP.
TFR X,D START WITH A PASSED SEED.
RAM2 TFR D,U SAVE THE SEED
RAM0 LDX #0 MEMORY POINTER
RAM3 COMB DONT ASK
BITB #9
BNE RAM4
COMB
RORA
RORB
BRA RAM6
RAM4 COMB
BITB #9
BNE RAM5
RORA
RORB
BRA RAM6
RAM5 LSRA
RORB
RAM6 STD ,X++
EXG X,D SINCE IRQ RUNS OUT OF RAM, STROKE ROVER
TSTB
BNE RAM6B EVERY 256!
LDB #WDATA
STB WDOG HAVE A BONE..EVER BEEN BONED.....
TFR DP,B CHECK IS NORMAL DIAGS
CMPB #$FF FF MEANS FRONT DOOR
BNE RAM6C
LDB PIA0 CHECK FOR ADV.
BITB #2
BEQ RAM6C NOT PRESSED.
JMP ,Y TIME TO RETURN
RAM6C CLRB RETURN B TO ZERO
RAM6B EXG X,D TRADE BACK
CMPX #$C000 DONE??
BNE RAM3 NOPE..CONTINUE
*
TFR U,D RESTORE SEED.
LDX #0
RAM7 COMB
BITB #9
BNE RAM8
COMB
RORA
RORB
BRA RAM10
RAM8 COMB
BITB #9
BNE RAM9
RORA
RORB
BRA RAM10
RAM9 LSRA
RORB
RAM10 CMPD ,X++
BNE RERROR RAM ERROR!
RAM25 EXG X,D CHECK FOR END OF PAGE
TSTB
BNE RAM17
LDB #WDATA
STB WDOG
TFR DP,B SEE IF NORMAL RUN
CMPB #$FF FRONT DOOR??
BNE RAM17C NOPE
LDB PIA0 CHECK ADV.
BITB #2
BEQ RAM17C
JMP ,Y JUST RETURN (NO ERRORS)
RAM17C CLRB
RAM17 EXG X,D TRADE BACK
CMPX #$C000 DONE??
BNE RAM7
TFR D,U SHOVE NEW SEED OVER
TFR DP,A
CMPA #$FF FF INDICATES FRONT DOOR
BNE RAM99
TFR U,D
JMP RAM0 DO ANOTHER ITERATION IN THIS TEST.
RAM99 DECA TAKE ONE AWAY