Right now I'm resetting scoll values in all my subroutines where I write to $2006. Is that the best way to go?

If you're not doing any raster effects, you only need to reset the scroll once per frame, before rendering starts. Normally that'd be at the end of your NMI handler, after all PPU operations have already been done.

Quote:

And when is the best time to read from controller? Every NMI or during the main loop?

Doing it in the NMI can actually cause bugs during lag frames, because the same logic frame may end up using 2 different states of the same button if an NMI happens between two checks. Better do it in the main loop, once for each logic frame.

[Reading the controller] in the NMI can actually cause bugs during lag frames, because the same logic frame may end up using 2 different states of the same button if an NMI happens between two checks. Better do it in the main loop, once for each logic frame.

That's a good idea in many cases. The other way to handle it, especially if you're playing DPCM samples, is to have the main loop request that the NMI handler perform the reread immediately after uploading a display list to OAM, as Rahsennor discovered.

Oh yeah, I forgot about that. Yes, if you read the controllers in the NMI only when a logic frame isn't interrupted, you can avoid that button inconsistency issue I mentioned before and still make use of this technique to avoid DPCM input glitches.

[Reading the controller] in the NMI can actually cause bugs during lag frames, because the same logic frame may end up using 2 different states of the same button if an NMI happens between two checks. Better do it in the main loop, once for each logic frame.

That's a good idea in many cases. The other way to handle it, especially if you're playing DPCM samples, is to have the main loop request that the NMI handler perform the reread immediately after uploading a display list to OAM, as Rahsennor discovered.

That's a great link. The ring counter technique is awesome.

I'm purposely avoiding DPCM samples in the music specifically so I don't have to worry about it.

Who is online

Users browsing this forum: No registered users and 8 guests

You cannot post new topics in this forumYou cannot reply to topics in this forumYou cannot edit your posts in this forumYou cannot delete your posts in this forumYou cannot post attachments in this forum