I recently produced a test ROM to learn the IRQ interrupt for MMC3.
In this ROM, I tried to make it possible to change the value to be written to $C000 from 0-255 with the up and down buttons, and to swap BG and sprite pattern table addresses with the B button.
It worked as expected when running it on Mesen and EverDriveN8, but when tested on an actual Sharp MMC3B and EEP-ROM, the interrupt did not work correctly when 0 was written to $C000.
Expected behavior
Actual behavior with Sharp MMC3B
I was wondering if this was due to a mistake in my code or another problem, so I posted this.
I'm using machine translation, so the sentence may be strange. Sorry.
Thanks in advance.
Code: Select all
.inesprg 1
.ineschr 1
.inesmir 0
.inesmap 4
.bank 1
.org $f000
RESET:
sei
cld
lda #%01000000
sta $4017
ldx #$ff
txs
inx
stx $2000
stx $2001
stx $4010
stx $e000
.Vwait
bit $2002
bpl .Vwait
.Vwait2
bit $2002
bpl .Vwait2
lda #$e0 ; Sprite clear
sta $4014
lda #$3f
sta $2006
lda #$00
sta $2006
lda #$0f
sta $2007 ; BG color = $0f
lda #%10001000
sta <$00
lda #$03
sta <$01
lda #%00010000
sta $2001
lda #%10000000
sta $2000
cli
.loop:
jmp .loop
;-------------------------------------------------------------------------------
NMI:
lda <$00
sta $2000 ; Set PPUCTRL
lda #$18
sta $c000 ; Set IRQ
sta $c001
sta $e000
sta $e001
jsr GetKey ; Get keystrokes
; Processing in response to keystrokes.
bit <$21
bvc .sub
lda <$00
eor #%00011000
sta <$00
.sub
lda <$21
lsr A
lsr A
lsr A
bcc .sub2
inc <$01
.sub2
lsr A
bcc .sub3
dec <$01
.sub3
lda #$bf
sta <$02
rti
;-------------------------------------------------------------------------------
IRQ:
lda #%00010001 ; Draw gray line
sta $2001
lda <$01
sta $c000 ; Set IRQ
sta $c001
sta $e000
sta $e001
lda <$02
clc
sbc <$01
sta <$02
bcs .end
sta $e000 ; IRQ disable
.end
lda #%00010000 ; End gray line
sta $2001
rti
;-------------------------------------------------------------------------------
GetKey:
lda <$20
pha
lda #$01
sta <$20
sta $4016
lsr A
sta $4016
.loop
lda $4016
lsr A
rol <$20
bcc .loop
pla
eor <$20
and <$20
sta <$21
rts
;-------------------------------------------------------------------------------
.bank 1
.org $fffa
.dw NMI,RESET,IRQ
.bank 2
.org $0000
; --- CHR area ---