How to get started with MMC3?

Discuss technical or other issues relating to programming the Nintendo Entertainment System, Famicom, or compatible systems. See the NESdev wiki for more information.

Moderator: Moderators

User avatar
rainwarrior
Posts: 8734
Joined: Sun Jan 22, 2012 12:03 pm
Location: Canada
Contact:

Re: How to get started with MMC3?

Post by rainwarrior »

pinkpuff wrote:FCEUX has been set to New PPU the whole time. The status bar is still rock solid in that one.
Ah, I am surprised by this because on the first ROM you posted I saw a flickering white artifact on the split line with New PPU but not Old PPU. (The overlay wasn't moving up or down, though, so it stable.)
pinkpuff wrote:I put in a loop to delay the scroll write until Nintendulator was reporting it happening at a tick somewhere in the low 300s (305 to about 311; it varies a bit). It was still jittery. Is that during hblank? I wasn't quite sure from the link, but I got the impression that it's basically any time after tick 257?
I think I should have linked Wiki: PPU Scrolling instead, it has more relevantly digested information.

So, the PPU is going to increment the Y scroll at pixel 256, and then won't start incrementing the X scroll until pixel 328. This is your window of opportunity. (The other option is to update scroll somewhere in the middle of the scanline, any time before pixel 256, leaving a rough edge and fine X scroll will be off until the next line-- that's what most games did, and it's a very wide window to hit.)

The timing of any interrupt will vary up to i think 6 cycles (18 pixels) depending on what instruction it interrupted, so try to look for the low and high point this far apart. If you've only seen 305 to 311, you might not have caught the extremes. Maybe to help testing, you have a LDA $10 / BNE wait loop, but you could temporarily add a little JSR / RTS into that loop for more variability of timing?

Also, to keep the window as tight as you can, you can do the BIT $2002 early, and preload X or Y if needed to hold values to write quickly to $2006/2005. The first write to $2006 can be done early as well, as its effect is buffered. In your case, only the second $2006 and then the $2005 need to actually occur within hblank, because they're what take immediate visual effect. The actual stuff that happens in hblank should be as minimal as possible, ideally just the write instructions, no loads.
Post Reply