EDIT: Fixed. Turns out it was a pattern table problem already covered on the forum. (viewtopic.php?t=1609)
I really had no idea this was a thing, kind when I first tried to implement DPCM but I got quite angry because of the glitch controller reads.
I'm making a game with an IRQ-triggered status bar on the bottom. I made my routine and it works on FCEUX. However other emulators don't seem to be very keen on that routine. Anyone knows why it's wrong?
Here is the IRQ triggering code in my NMI and my IRQ handler.
LDA IRQFlag ;This is the code that's in my NMI handler. Basically, it checks if the game needs IRQs with the IRQFlag variable
BEQ .noirq ;then it does IRQ stuff like it's explained here - http://bobrost.com/nes/files/mmc3irqs.txt
STA IRQOFF ;IRQLATCH = $C000
LDA #$BF ;IRQRELOAD = $C001
STA IRQLATCH ;IRQOFF = $E000
STA IRQRELOAD ;IRQON = $E001
STA IRQOFF
STA IRQON
.noirq
;More code here...
IRQ: ;This is my IRQ handler. Right now, it just scrolls the status bar with the "ticker" variable, and bankswitches CHR
;Works on FCEUX, doesn't work on any other emulator
PHA ;(Don't have a flashcart to test it on...)
TXA
PHA
TYA
PHA
LDX #$00
.loop
INX
CPX #$0A
BNE .loop
NOP
LDA #%10000000
STA BANKSWAP
LDA #%00010000
STA BANKDATA
LDA ticker
STA $2005
LDA #$00
STA $2005
LDA #%10110000
STA $2000
STA IRQOFF ;It's supposed to acknowledge the IRQ here.
PLA
TAX
PLA
TAY
PLA
RTI
Thanks for your help guys
I really had no idea this was a thing, kind when I first tried to implement DPCM but I got quite angry because of the glitch controller reads.
I'm making a game with an IRQ-triggered status bar on the bottom. I made my routine and it works on FCEUX. However other emulators don't seem to be very keen on that routine. Anyone knows why it's wrong?
Here is the IRQ triggering code in my NMI and my IRQ handler.
Code:
LDA IRQFlag ;This is the code that's in my NMI handler. Basically, it checks if the game needs IRQs with the IRQFlag variable
BEQ .noirq ;then it does IRQ stuff like it's explained here - http://bobrost.com/nes/files/mmc3irqs.txt
STA IRQOFF ;IRQLATCH = $C000
LDA #$BF ;IRQRELOAD = $C001
STA IRQLATCH ;IRQOFF = $E000
STA IRQRELOAD ;IRQON = $E001
STA IRQOFF
STA IRQON
.noirq
;More code here...
IRQ: ;This is my IRQ handler. Right now, it just scrolls the status bar with the "ticker" variable, and bankswitches CHR
;Works on FCEUX, doesn't work on any other emulator
PHA ;(Don't have a flashcart to test it on...)
TXA
PHA
TYA
PHA
LDX #$00
.loop
INX
CPX #$0A
BNE .loop
NOP
LDA #%10000000
STA BANKSWAP
LDA #%00010000
STA BANKDATA
LDA ticker
STA $2005
LDA #$00
STA $2005
LDA #%10110000
STA $2000
STA IRQOFF ;It's supposed to acknowledge the IRQ here.
PLA
TAX
PLA
TAY
PLA
RTI
Thanks for your help guys