[Coco] 64K Coco mode and the MC6883
Sean Conner
sean at conman.org
Sun Mar 26 21:18:23 EDT 2023
It was thus said that the Great RETRO Innovations via Coco once stated:
>
> Sean's note piques my interest, so I'll see if I can fire up the logic
> analyzer (it'd be nice to have someone write a test program in ML that
> checks all the test cases one right after the other, turning off IRQs,
> and I can capture the entire address and data bus at the CPU and the SAM
> or something for those cycles). I would think it should also be easy to
> test by writing a small program that does:
>
> switch to all RAM mode and write 00 to the first byte of the various ROM
> areas.
>
> switch back to RAM/ROM mode and write a 01 to those same areas
>
> switch back to all RAM mode and look at the various locations. 00 means
> nothing got written, 01 means it did.
Fair enough: here's a BASIC program that should do just that:
10 CLEAR 999:FOR I=1 TO 59:READ B:P$=P$+CHR$(B):NEXT I:P=VARPTR(P$)+1:POKE P,126
20 PRINT"HIT ANY KEY TO RUN TEST";EXEC P;PRINT
30 A=253:M$="ROM-1":GOSUB100
31 A=A+1:M$="ROM-2":GOSUB100
33 A=A+1:M$='ROM-3":GOSUB100
40 END
90 DATA 52,3,173,159,160,0,39
91 DATA 250,26,80,79,183,255,223
92 DATA 183,128,0,183,160,0,183
93 DATA 192,0,76,183,255,222,183
94 DATA 128,0,183,160,0,183,192
95 DATA 0,183,255,223,182,128,0
96 DATA 151,253,182,160,0,151
97 DATA 254,182,192,0,151,255
98 DATA 183,255,222,53,131
100 PRINT M$;": ";
110 IF PEEK(A)=1 THEN PRINT "NO SWITCH NEEDED" ELSE PRINT "SWITCH NEEDED"
120 RETURN
And here's the assembly code (the listing file from a custom 6809
assembler I wrote):
| FILE qtest.a
0000: 34 03 1 | pshs a,cc
0002: AD 9FA000 2 | loop jsr [$A000] ; key press?
0006: 27 FA 3 | beq loop ; wait until so
0008: 1A 50 4 | orcc #$50 ; disable IRQ
000A: 4F 5 | clra ; A = 0
000B: B7 FFDF 6 | sta $FFDF ; set RAM/RAM
000E: B7 8000 7 | sta $8000 ; write to ROM-1
0011: B7 A000 8 | sta $A000 ; write to ROM-2
0014: B7 C000 9 | sta $C000 ; write to ROM-3
0017: 4C 10 | inca ; A = 1
0018: B7 FFDE 11 | sta $FFDE ; set RAM/ROM
001B: B7 8000 12 | sta $8000 ; write to ROM-1
001E: B7 A000 13 | sta $A000 ; write to ROM-2
0021: B7 C000 14 | sta $C000 ; write to ROM-3
0024: B7 FFDF 15 | sta $FFDF ; set RAM/RAM
0027: B6 8000 16 | lda $8000 ; read ROM-1
002A: 97 FD 17 | sta $FD ; save
002C: B6 A000 18 | lda $A000 ; read ROM-2
002F: 97 FE 19 | sta $FE ; save
0031: B6 C000 20 | lda $C000 ; read ROM-3
0034: 97 FF 21 | sta $FF ;save
0036: B7 FFDE 22 | sta $FFDE ; set RAM/ROM
0039: 35 83 23 | puls a,cc,pc ; return
2 | address 0002 loop
Addresses $FD, $FE and $FF are unused by BASIC, so I used that to store
the results.
-spc
More information about the Coco
mailing list