Romhacking.net

Romhacking => Programming => Topic started by: w7n on September 29, 2013, 08:54:32 am

Title: Curious about a problem with the MMC3 IRQ.
Post by: w7n on September 29, 2013, 08:54:32 am
Some time ago I was reverse engineering ATA's 'vertical' patch for the game Super Mario Bros. The patched game works on VNES, but it doesn't work on FCEUX or Nestopia. I used the FCEUX's debugging function, and I found that the game got stuck in the IRQ routine.

So here's the code:
;IRQ Routine
...
...
LDA #$00
STA $C000
STA $C001
STA $E000
...
RTI

And the result: the IRQ routine gets executed immediately after the RTI, creating an infinite loop. Seemingly the IRQ isn't acknowledged at all--although this part of code ALWAYS gets executed.

So... Is there any problem with the code? Or, in what cases can this glitch occur?
Title: Re: Curious about a problem with the MMC3 IRQ.
Post by: KingMike on September 30, 2013, 08:40:29 pm
Not much experience in IRQ issues (Gideon will probably agree on that! :P ), but this doc (http://wiki.nesdev.com/w/index.php/INES_Mapper_004) seems to stress "do not write 0 to $C000" (seems the behavior should best be considered undefined).