I am trying to figure out when the scanline irq is generated relative to the ppu memory accesses. Most docs say it comes when the scanline starts being rendered which is good for emulators but not accurate enough for hardware. The two options I could see are:
1. New scanline is found when there are 3 sequential name table reads, IRQ generated at that time. IRQ comes after the first 2 tiles are prefetched on the previous scanline. Seems to match the clock cycle count done by blargg.
2. New scanline starts when the first tile is prefetched, right after the sprites are read. IRQ starts then so no tiles are missed. Makes more sense but doesnt match the clock counts?
From what I have been able to tell from emulator source is they do #2, but also dont bother with emulating the hardware exactly because it isnt needed. Best would be to know which ppu memory access the irq coincides with.
1. New scanline is found when there are 3 sequential name table reads, IRQ generated at that time. IRQ comes after the first 2 tiles are prefetched on the previous scanline. Seems to match the clock cycle count done by blargg.
2. New scanline starts when the first tile is prefetched, right after the sprites are read. IRQ starts then so no tiles are missed. Makes more sense but doesnt match the clock counts?
From what I have been able to tell from emulator source is they do #2, but also dont bother with emulating the hardware exactly because it isnt needed. Best would be to know which ppu memory access the irq coincides with.