First off, this forum has been a tremendous help for me when developing the first three iterations of my emulator.
However, I've run into a little difficulty, and I was hoping that somebody here might have an idea/suggestion that could point me in the right direction.
I recently rewrote my CPU emulation core and I've come across a bug which is giving me a headache (or migraine, rather).
Whenever the CPU is about to RTI from a NMI, it pops the wrong return adress from the stack and jumps into oblivion. I've tracked down the issue to that the stackpointer isn't incremented/decremented as it should be, or rather, there is one push more than there are pops before RTI.
The only game out of my test roms I've found that this bug doesn't affect is SMB, which runs properly.
If I add another POP to my RTI-implementation, many other roms loads and runs without issues, such as donkey kong, pac-man and mario brothers, but alas, it breaks super mario bros.
Does anybody have any idea what I'm doing wrong?
Please don't flame me too hard if I have overlooked something obvious, this is my first post after all
However, I've run into a little difficulty, and I was hoping that somebody here might have an idea/suggestion that could point me in the right direction.
I recently rewrote my CPU emulation core and I've come across a bug which is giving me a headache (or migraine, rather).
Whenever the CPU is about to RTI from a NMI, it pops the wrong return adress from the stack and jumps into oblivion. I've tracked down the issue to that the stackpointer isn't incremented/decremented as it should be, or rather, there is one push more than there are pops before RTI.
The only game out of my test roms I've found that this bug doesn't affect is SMB, which runs properly.
If I add another POP to my RTI-implementation, many other roms loads and runs without issues, such as donkey kong, pac-man and mario brothers, but alas, it breaks super mario bros.
Does anybody have any idea what I'm doing wrong?
Please don't flame me too hard if I have overlooked something obvious, this is my first post after all