|
Post by oziphantom on Dec 10, 2018 5:40:18 GMT
What happens if you assert EXROM or GAME while in 128 mode? Does the PLA just ignore it, or does it do weird "this isn't suppose to happen" stuff.
|
|
|
Post by jmpff3d on Dec 10, 2018 7:07:34 GMT
What happens if you assert EXROM or GAME while in 128 mode? Does the PLA just ignore it, or does it do weird "this isn't suppose to happen" stuff. Required Reference :: c-128.freeforums.net/thread/638/mmu-bitswitch-guideIf you're describing a fully powered-up C128 with C64-carts forcibly asserting EXROM/GAME outside of power-up initialization (weird cartridge or device?), I don't think anything happens software-wise that triggers anything strange in basic or kernal. I don't recall C128 basic/kernal checking those lines after power-up init. Hardware-wise, I really hope there would be no strange issues with EXROM/GAME assertions after power-up init. .. If there is, I've forgotten about it ! .. but I hope the hardware is solid enough to allow you to check the lines with MMU at any point after init, without suprirse oddities/failures from MMU/PLA, etc. Al Margolis may provide better info in his very-nice repair manual, available on DLH's archive: 69.60.118.202/books/commodore/books/Troubleshooting_and_Repairing_your_Commodore_128.zipIf this topic revolves around SCPU 128 hooking up to MMU and doing whatever it does.. I have no clue. Anyone have a good description of this SCPU 128 attachment?? :: ...... and finally, to the more-common response ...... If you mean c64-carts asserting EXROM/GAME on power-up, the answer is obvious as seen in the BootROM of course, as noted below: C128 'CP/M 3 ROM loader 13 May 85' .. aka The Z80 BootROM ... in 8080 ... ...the pseudo-6502 disasm at the bottom of this post makes the 8080/Z80 equate assignments clear. i didn't want to paste a textfile of equates. ; power on location ; org 00h ; RST 0 - Cold Start
mvi a,3eh ; LDA #$3E, configuration byte RAM I/O sta force$map ; STA $FF00, into mmu config. register jmp power$up ; continue init at $003B
[...]
power$up: ; $003B lxi b,VIC$key$row lxi d,0fffch ; D=ff, E=fc outp d ; set extra 3 scan lines off inx b ; point to clock speed reg outp e ; bits 7-2 unused ; bit 1 enable test mode (1) ; bit 0 2 Mhz (1) / 1 MHz (0) ; ; continue the check to see if a C64 type chartrage is installed ; (EXROM or GAME active) if so we enter C64 mode ; lxi b,mode$reg ; get EXROM and GAME bits mvi a,z80$on outp a ; set bit high inp a ; see if they went high cma ; make highs low ani 30h ; EXROM or GAME enabled? *** bit-testing the lines here: if yes, fallthrough to go$c64 ; http://c-128.freeforums.net/thread/638/mmu-bitswitch-guide
jrz test$key ; if no EXROM/GAME line hit, branch to the commodore key test
; ; This is a one way trip, no return flights. ; Thus we do not have to do the transfer from RAM ; (as in C128 mode). We just enable C64 and run. ;
go$c64: mvi a,enable$c64 ; enable$c64 is an equate for #$F1 outp a ; mvi and outp here are nothing more than #$F1 to $mmu+5 ($d505) ; in 6502 -> LDA #$F1, move to c64 ; STA $D505, turn on 64 mode
; should never get here, to RST 0 RST 0 ; unless there are hardware problems
; Commodore Key check is next .. etc etc etc
test$key: lxi b,0dc0fh ; D1CRB mvi a,8h ; turn off timers outp a dcr c ; D1CRA outp a
mvi c,03h ; D1DDRB = inputs xra a ; A=00 outp a dcr c ; D1DDRA = outputs dcr a ; A=FF outp a dcr c ; dc01 dcr c ; dc00 mvi a,01111111b ; bit 7 for commodore key outp a inx b ; dc01 point to key$col inp a ani commodore$key lxi b,mode$reg jrz go$c64
... and for those of us who prefer Z80 instruction mnemonics ... the 8080 instructions from prior listing now in Z80 form, as seen below ; ; power on location ; org 00h ; RST 0 - Cold Start
ld a,3eh ; LDA #$3E, configuration byte RAM I/O ld (force$map),a ; STA $FF00, into mmu config. register jp power$up ; continue init at $003B
[...]
power$up: ; $003B ld bc,VIC$key$row ld de,0fffch ; D=ff, E=fc out (c),d ; set extra 3 scan lines off inc bc ; point to clock speed reg out (c),e ; bits 7-2 unused ; bit 1 enable test mode (1) ; bit 0 2 Mhz (1) / 1 MHz (0) ; ; continue the check to see if a C64 type chartrage is installed ; (EXROM or GAME active) if so we enter C64 mode ; ld bc,mode$reg ; get EXROM and GAME bits ld a,z80$on out (c),a ; set bit high in a,(c) ; see if they went high cpl ; make highs low and 30h ; EXROM or GAME enabled? *** bit-testing the lines here: if yes, fallthrough to go$c64 ; http://c-128.freeforums.net/thread/638/mmu-bitswitch-guide
jr z,test$key ; if no EXROM/GAME line hit, branch to the commodore key test
; ; This is a one way trip, no return flights. ; Thus we do not have to do the transfer from RAM ; (as in C128 mode). We just enable C64 and run. ;
go$c64: ld a,enable$c64 ; enable$c64 is an equate for #$F1, same as in 8080 source listing out (c),a ; tag $mmu+5 ($d505) with #$F1 for switch to 64-mode.
; should never get here, to RST 0 RST 8*0 ; unless there are hardware problems
test$key: ; check for Commodore Key, same as in 8080 source listing ld bc,0dc0fh ; D1CRB ld a,8h ; turn off timers out (c),a dec c ; D1CRA out (c),a
ld c,03h ; D1DDRB = inputs xor a ; A=00 out (c),a dec c ; D1DDRA = outputs dec a ; A=FF out (c),a dec c ; dc01 dec c ; dc00 ld a,01111111b ; bit 7 for commodore key out (c),a inc bc ; dc01 point to key$col in a,(c) and commodore$key ld bc,mode$reg jr z,go$c64
... and for those who can't stand 8080/z80 and prefer a mangled raw disassembly with pseudo-6502 for equate-duty, for guidance ... ORG 0000h ; Restart 0 (RST 00) RST_00 ld a,MMU_CR_BYTE_3E ; LDA #$3E, configuration byte RAM I/O ld (MMU_CR),a ; STA $FF00, into config. register jp RST_00_CONTINUED_003B ; JMP $003B, continue cold start rout.
[...]
RST_00_CONTINUED_003B ld bc,XSCAN_D02F ; BC = $D02F ld de,XSCAN_AND_CLKRATE_BYTES_FFFC ; DE = $FFFC, D = $FF, E = $FC out (c),d ; STD $D02F inc bc ; BC = $D030 out (c),e ; STE $D030 ld bc,MMU_MCR ; BC = $D505 ld a,MMU_MCR_BYTE_B0 ; LDA #$B0, /EXROM /GAME test out (c),a ; STA $D505, turn on 128 mode in a,(c) ; LDA $D505, read back MMU_MCR cpl ; EOR #$FF, negate MMR_MCR and 30_HEX_OR_BITMASK_00110000 ; AND #$30, IF /EXROM or /GAME set, fallthrough to GO64_MODE ; http://c-128.freeforums.net/thread/638/mmu-bitswitch-guide jr z,CBMKEY_CHECK ; BEQ CBMKEY_CHECK, Not set, check Commodore Key!
GO64_MODE ld a,MMU_MCR_BYTE_F1 ; LDA #$F1, move to c64 out (c),a ; STA $D505, turn on 64 mode rst 0h ; cold restart
CBMKEY_CHECK ld bc,CIA1_TIMER_B ; BC = $DC0F ld a,B_08 ; LDA #$08 out (c),a ; STA $DC0F dec c ; BC = $DC0E out (c),a ; STA $DC0E ld c,B_03 ; BC = $DC03 xor a ; EORing A against itself = 0 out (c),a ; STA $DC03 dec c ; BC = $DC02 dec a ; A = #$FF, (#$00 -> #$FF) out (c),a ; STA $DC02 dec c ; BC = $DC01 dec c ; BC = $DC00 ld a,7F_HEX_OR_BITMASK_01111111 ; LDA #$7F out (c),a ; STA $DC00 inc bc ; BC = $DC01 in a,(c) ; LDA $DC01 and 20_HEX_OR_BITMASK_00100000 ; AND #$20 ld bc,MMU_MCR ; BC = $D505 jr z,GO64_MODE ; BEQ GO64_MODE, C= key pressed! ; 28 D8 byte-pattern for rom edit
|
|
|
Post by jusalak on Feb 29, 2024 21:54:03 GMT
I was thinking what happens if GAME/EXROM checks (there are 2 of them, both Z80 and 8502 do the check) are disabled in C128 ROM. I tried this with emulators (VICE and Z64K) and the cartridge code is not shown in Bank 8 (external ROM bank). Testing it on real hardware requires replacing the Kernal ROM chip.
|
|