unregistered wrote:What normally would go into the empty loop?
There are 3 main ways to set up NES programs:
1. Game logic in the main loop, video and audio updates in the NMI:
The whole game logic (i.e. movement, collisions, etc.) is in the main loop, and once it finishes the program waits for the NMI to fire. When it fires, it performs all the necessary video and audio updates, and then control is returned to the main loop, where the next frame will be processed.
2. Game logic and video and audio updates in the main loop, the NMI only sets a flag:
The whole game logic is in the main loop, and once it finishes the program waits for VBlank. The NMI will simply set a flag to indicate that VBlank has started and then return, at which point the main loop will proceed to perform video and audio updates and loop back to process the next frame.
3. Video and audio updates and game logic in the NMI, the main loop is empty:
Video and audio updates based on the previous frame are performed first, and then the game logic of the following frame is calculated. Absolutely nothing is done in the main loop. This is considered the most newbie-friendly method because the programmer doesn't have to worry about 2 "threads" running in parallel, and the NMI automatically firing 60 (or 50, if it's a PAL NES) times per second is a very convenient way to time the program without any effort (i.e. no need to wait for VBlank).
Are there any downsides to having a whole engine running in the NMI?
Yes, if you have raster effects timed from the start of the frame (such as a status bar). Methods 2 an 3 suck for handling cases when the game logic takes too long (i.e. longer than a frame) to complete and you have such effects. Unpleasant visual glitches and music slowdown are the side effects of this (the program can even crash if sprite 0 hits are involved). Method 1 is the best to avoid these problems.
Simple games will hardly use too much CPU time unless they are very badly programmed, but complex games with scrolling, large number of active enemies, and so on, will certainly have a few sections with slowdown, and this is an issue for them.