| |
oziphantom
Registered: Oct 2014 Posts: 478 |
EF 3 hardware crash
So I have this Easy flash cart that I'm flashing to the EF3 in the normal way. Nothing special.
In VICE it works perfectly fine, no issues.
However on hardware it crashes.
The structure is a little odd.
the lo bank is mirrored across all lower banks, i.e bank 0 8000-9FFF = 1 8000-9FFF = 2 8000-9FFF etc the upper 8K is unique, kind of the reverse of a NES mapper I guess.
When the code changes the bank, there is a routine that takes A and does
and #$3f
sta $DE01
rts
on hardware this kills it, as far as I can tell a BRK occurs. It should be fine because that routine is in every lower bank in the same spot. That fact that it works in VICE tells me this is true.
But is there a case where on hardware ( I'm running it on a Commodore 128, it has also been shown to fail on a 1541U11+ with identical behavior ) the read of the RTS can fail? It gets garbage data for the next clock, the latch hasn't settled in time or something?
Or any other ideas? |
|
| |
chatGPZ
Registered: Dec 2001 Posts: 11121 |
I'd check if the same happens on C64 first, the C128 can be odd in many subtle ways.
Do you have a minimal testcase? |
| |
JackAsser
Registered: Jun 2002 Posts: 1989 |
For EotB I never execute code in ROM while bankswitching, it was flakey on C128. I always jump to a common RAM area before bankswitching. This is fully implemented in macros so I have a JSRF (F=far) which JSRs from one bank into another via a RAM-trampoline. |
| |
Krill
Registered: Apr 2002 Posts: 2847 |
Quoting JackAsserFor EotB I never execute code in ROM while bankswitching, it was flakey on C128. I always jump to a common RAM area before bankswitching. This is fully implemented in macros so I have a JSRF (F=far) which JSRs from one bank into another via a RAM-trampoline. Indeed, having bankswitching thunks in common RAM is best practice, even for stock C-64 without any cartridges. =) |
| |
chatGPZ
Registered: Dec 2001 Posts: 11121 |
It should work the way described though - and sometimes its the preferred way too (if you can not afford to run in RAM) - eg AR/RR (and likely most other freezers) uses this technique all over the place. |
| |
JackAsser
Registered: Jun 2002 Posts: 1989 |
Also, unreleated, EF3 emulation in 1541U2 does NOT work on C128 when in 2Mhz mode. |
| |
oziphantom
Registered: Oct 2014 Posts: 478 |
The 1541-U11+ was connected to a C64, but I don't know which revision it was.
But I just tested on a E rev with my EF3 cart, and identical behavior.
I will try and make a simple test case. |
| |
JackAsser
Registered: Jun 2002 Posts: 1989 |
Quote: The 1541-U11+ was connected to a C64, but I don't know which revision it was.
But I just tested on a E rev with my EF3 cart, and identical behavior.
I will try and make a simple test case.
Very interesting. I’d love to test it on my custom EotB carts. |
| |
Martin Piper
Registered: Nov 2007 Posts: 634 |
Have to agree, bank switching code in RAM is the way to go. |
| |
oziphantom
Registered: Oct 2014 Posts: 478 |
Yup it crashes here is the complete code and pre-built ef cart https://www.dropbox.com/s/qh5bt265xcx2dpt/ef_crashtest.zip?dl=0 it has a batch file, but it is trivial to convert to anything else. assembles with 64tass
but for those that just want to snoop the code
; upper bank
.logical $a000
* = $bfd8
coldStart
sei
ldx #$ff
txs
cld
lda #8
sta $d016
_coldStart_wait_for_ram:
sta $0100, x
dex
bne _coldStart_wait_for_ram
ldx #$40
_coldStart_l1:
lda _startUpCode+$4000, x
sta $0100, x
dex
bpl _coldStart_l1
jmp $0100
*= $BF98
_startUpCode
lda #$87
sta $de02
lda #$7f
sta $dc00
ldx #$ff
stx $dc02
inx
stx $dc03
lda $dc01
stx $dc02
stx $dc00
and #$e0
cmp #$e0
bne _startUpCode_kill
ldx #0
stx $d016
jsr $ff84
jsr $ff87
jsr $ff8a
jsr $ff81
jmp $8000
_startUpCode_kill:
lda #4
sta $de02
jmp ($fffc)
_startUpCode_end:
*= $BFFA
.word $FFFE
.word coldStart+$4000
.word $4040
.here
;lowerBank00.asm
.logical $8000
start
lda #1
sta $0400
jsr changeBanks
lda #2
sta $0400
- inc $d020
jmp -
changeBanks
and #$3f
sta $de01
rts
.here
;makeBin.asm
*=$0000
Bank0Lo .binclude "lowerBank00.asm"
*=$2000
Bank0Hi .binclude "upperBank.asm"
*=$4000
Bank1Lo .binclude "lowerBank00.asm"
*=$6000
.fill $2000,$EA
|
| |
chatGPZ
Registered: Dec 2001 Posts: 11121 |
despite its a bit irritating that the ROMH bank base address is set to $a000 and not $e000 as it should be, this should work just fine. will test on the real thing later :) |
... 17 posts hidden. Click here to view all posts.... |
Previous - 1 | 2 | 3 - Next |