I haven't been working on nes stuff for quite a while so my knowledge is super rusty... but here goes anyway.
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:
I was still passing blargg's nmi suppresion test with this. This was based on testing done in visualNES. I'll attach the 4 states i saved, which reads 0x2002 at 4 different ticks near the VBL flag getting set.
Like I said, I haven't been working on nes stuff for a while so I'd rather have someone else tell me if this stuff is faulty, the usual alignment shenanigans, wrong or right or whatever. Haha.
The wiki says this about VBL / NMI:
Quote:
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.
I recently checked through my nes code and remembered that one of my last changes was related to this:
Code:
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 }
[...]
}
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 }
[...]
}
I was still passing blargg's nmi suppresion test with this. This was based on testing done in visualNES. I'll attach the 4 states i saved, which reads 0x2002 at 4 different ticks near the VBL flag getting set.
Code:
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
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
Like I said, I haven't been working on nes stuff for a while so I'd rather have someone else tell me if this stuff is faulty, the usual alignment shenanigans, wrong or right or whatever. Haha.