The wiki says this about VBL / NMI:
I recently checked through my nes code and remembered that one of my last changes was related to this:Reading one PPU clock before reads it as clear and never sets the flag or generates NMI for that frame. Reading on the same PPU clock or one later reads it as set, clears it, and suppresses the NMI for that frame.
Code: Select all
Before:
uint8_t Ppu::StatusRead() //2002
{
if(scanlineV == 241 && scanlineH < 3)
{ //suppress NMI }
[...]
}
After:
uint8_t Ppu::StatusRead() //2002
{
if(scanlineV == 241 && scanlineH < 2) //does dot 2 really suppress?
{ //suppress NMI }
[...]
}
Code: Select all
nmiEnabled339 = 339,340,000 nmi happens
nmiEnabled340 = 340,000,001 nmi doesn't happen, flag not set (A=0x20)
nmiEnabled0 = 000,001,002 nmi doesn't happen, flag set (A=0xA0)
nmiEnabled1 = 001,002,003 nmi happens