|
I'm writing NES emulator (it's name is 'NEZ' for now) and I don´t have very much experience in this, so please be patient. I´ve got a couple of very simple demos to work perfectly (like: mmx, jumpy, zelda titlescreen, macos...) with correct colors and all (a bit slow though). But if the demo uses NMI interrupts (like: billworld01, blocks, sprite...) it crashes, because I don't know how to implement it in my CPU...
I believe it works like this: When the PPU generates a Vertical Blanking Impulse, the program counter jumps to the adresse 0xFFFA, and continues from there. I guess the code uses a RTI or RTS or something to get back to where it was before.
Now how am I supposed to implement that? Should I let the CPU make a NMI interrupt right after I've updated the screen? Only once? What does Non-Msakable Interrept mean? How many cycles should I add to the counter? Does the NMI clear D7 in $2002? Does NMI trigger after every screen refresh (60 times per second)? Am I supposed to push the program counter onto the stack? The questions goes on forever... It feels and sounds like a simple thing, but I just can't make it work. I have only found little information about this. I would appreciate if someone tells me or give me a link to an accurate document...
// Zansibal
|