MMC3 is supposed to have a register at $A001 that write-protects PRG RAM (WRAM) at $6000-$7FFF but still allows it to be read. According to the wiki, $00 is open bus, $80 is read/write, and $C0 is read-only. But I'm having trouble verifying that this protection is in place. Here's the code I tried:
On both FCEUX 2.2.0 and my PowerPak, I get MAPTEST_WRAMRO returned instead of 0. I've stepped through this subroutine in FCEUX 2.2.0's debugger to make sure the problem happens in this subroutine, not some unrelated defect in the test harness. But if you want, I can give you a minimal buildable program that demonstrates this. At this point I want to know if the problem is in my emulator and flash device or all in my head.
Code:
MMC3_WRAM_ENABLE = $A001
MMC3_WRAM_OFF = $00
MMC3_WRAM_RW = $80
MMC3_WRAM_RO = $C0
.proc mmc3_test_wram_protection
; make sure writes at least take
ldy #MMC3_WRAM_RW
sty MMC3_WRAM_ENABLE
ldx #$6B ; the "bad" value
lda #$B6 ; the "good" value
sta $6000
cmp $6000
bne protproblem
; make sure writes don't take if set to read-only
ldy #MMC3_WRAM_RO
sty MMC3_WRAM_ENABLE
stx $6000
cmp $6000
bne roproblem
; make sure it can't be read from open bus
ldy #MMC3_WRAM_OFF
sty MMC3_WRAM_ENABLE
cmp $6000
beq protproblem
; test for $6000/$E000 glitch (Crystalis map corruption bug)
ldy #MMC3_WRAM_RW
sty MMC3_WRAM_ENABLE
stx MMC3_IRQ_DISABLE
cmp $6000
bne protproblem
lda #0
rts
protproblem:
lda #MAPTEST_WRAMEN
rts
roproblem:
lda #MAPTEST_WRAMRO
rts
.endproc
MMC3_WRAM_OFF = $00
MMC3_WRAM_RW = $80
MMC3_WRAM_RO = $C0
.proc mmc3_test_wram_protection
; make sure writes at least take
ldy #MMC3_WRAM_RW
sty MMC3_WRAM_ENABLE
ldx #$6B ; the "bad" value
lda #$B6 ; the "good" value
sta $6000
cmp $6000
bne protproblem
; make sure writes don't take if set to read-only
ldy #MMC3_WRAM_RO
sty MMC3_WRAM_ENABLE
stx $6000
cmp $6000
bne roproblem
; make sure it can't be read from open bus
ldy #MMC3_WRAM_OFF
sty MMC3_WRAM_ENABLE
cmp $6000
beq protproblem
; test for $6000/$E000 glitch (Crystalis map corruption bug)
ldy #MMC3_WRAM_RW
sty MMC3_WRAM_ENABLE
stx MMC3_IRQ_DISABLE
cmp $6000
bne protproblem
lda #0
rts
protproblem:
lda #MAPTEST_WRAMEN
rts
roproblem:
lda #MAPTEST_WRAMRO
rts
.endproc
On both FCEUX 2.2.0 and my PowerPak, I get MAPTEST_WRAMRO returned instead of 0. I've stepped through this subroutine in FCEUX 2.2.0's debugger to make sure the problem happens in this subroutine, not some unrelated defect in the test harness. But if you want, I can give you a minimal buildable program that demonstrates this. At this point I want to know if the problem is in my emulator and flash device or all in my head.