Or maybe not? I was working on Dragon Warrior nes2pce thing recently, and I came across something I hadn't seen before. The NMI routines takes the stack pointer and looks at the address pushed from the interrupt call. It appears that the game identifies where the game logic is 'idling' or not (there are multiple checks), before the NMI was called.
I hadn't seen this before, and the reason I noticed it is that for the PCE I replace the NMI vector with a custom one in which I handle a few internal emulation states, before passing code direction back to the game's original nmi routine. It wasn't working because I was pushing a return address (and dummy PHP), onto the stack so that the NMI routine would return back into my PCE vblank interrupt routine and clear a flag on exit (I didn't want more than one NMI happening, just in case). This caused a misalignment on the NMI side for directly reading into the $0100 range. I ended up modifying the original routine to point ahead (3 bytes) into the stack space to fix it. But yeah - I thought this was strange.
I've heard Final Fantasy I does some stack manipulation. Is it like this? Are there other NES games known to do this?
I hadn't seen this before, and the reason I noticed it is that for the PCE I replace the NMI vector with a custom one in which I handle a few internal emulation states, before passing code direction back to the game's original nmi routine. It wasn't working because I was pushing a return address (and dummy PHP), onto the stack so that the NMI routine would return back into my PCE vblank interrupt routine and clear a flag on exit (I didn't want more than one NMI happening, just in case). This caused a misalignment on the NMI side for directly reading into the $0100 range. I ended up modifying the original routine to point ahead (3 bytes) into the stack space to fix it. But yeah - I thought this was strange.
I've heard Final Fantasy I does some stack manipulation. Is it like this? Are there other NES games known to do this?