Re: Fun with MMC3 Scanline IRQs
Posted: Thu Oct 15, 2015 9:44 pm
After I knew that it was safe, I started testing it on hardware, and I don't see any timing related glitches anymore.lidnariq wrote:you should know that FCEUX's renderer is scanline-at-a-time
When are some times that this would be useful? It seems like the combination of MMC3 IRQs and just hScroll/vScroll setting is pretty lenient. I will eventually want to work in CHR bankswitching.thefox wrote:you may be able to chain two IRQs to minimize latency
I noticed some cool raster effects in Ninja Gaiden III: https://www.youtube.com/watch?v=_FmWbIqe7FQ (at 00:17). Maybe this trick would be useful for something complex like that. (I wonder why it shows garbled tiles when bankswitching. I wonder if that's the emulator or the cartridge. Apparently nobody gets that far on the cartridge...)
Yeah that's probably going to rule those out as well. The biggest problem is that the strips scroll vertically as well so they'd really stand out.tokumaru wrote:But those affect sprites too, so they won't help with creating more colorful backgrounds with overlaying sprites.
As for the tile and attribute fetching, I wondered if anyone had any thoughts on this.
What I did was basically this:
- Keep a master hScroll value
Set hScroll hi/lo of each scanline split
Calculate each required variable separately for each scanline split, essentially, scroll values, counter reload value, nametable addresses for tiles and attributes, last column tiles for which tiles were fetched, and a separate value for last frame's scroll position so that is doesn't get changed while waiting on scanlines
Read data from metatiles and write to zero page slots pretty much the same as normal, except on a loop, once per scanline split
Now the part that I feel like is probably the most messy, is in NMI, since all of the preload tiles aren't being used every time tiles are drawn, I basically made eight routines for writing background tiles to the nametable, one for each scanline strip. Then, as I check for new tiles needed, I draw the address of the routine from an array and JMP (indirect) to it. That means that my NMI is hardcoded for this particular level and would need to be changed depending on how many scanline splits there are.