OK, first off, let me say I am well aware that the sprite overflow flag is buggy. The problem is that, from my understanding of the bug, my code should be unaffected -- yet the flag is still not being set when it should be. Either my understanding of the bug is incomplete, or there is something else going on here.
The attached file has four Pac-Man ghosts in a row. These ghosts and Pac-Man are made using two 8x16 sprites. Move Pac-Man to the same scanline as the ghosts and there are 10 sprites on the line. I'm expecting the overflow flag to be set, in which case my code will cycle the ghosts' priorities and they should blink. FCEUX and a few other emulators show this behavior. However, some other emulators, and actual hardware, show a different behavior where Clyde (the orange ghost) simply disappears. I debugged it in Nintendulator and it seems indeed the flag is not being set. The question is, why not?
Here is my understanding of the overflow bug, as described on the wiki: after the eighth sprite on the scanline has been found, the sprite address will be incremented by 5 instead of 4. This is not supposed to affect the first sprite found in OAM after the eighth sprite on the line; the bug is only supposed to take effect after that. I've only got ten sprites, and the tenth shares its Y coordinate with the ninth, so Y coordinate of the ninth sprite (Clyde's left half) should be read correctly. The PPU should see it's on the same scanline as the other ghosts and Pac-Man, and set the flag. Apparently, it does not.
Is the description of the bug on the wiki inaccurate? Am I misunderstanding it? What's going on here?
The attached file has four Pac-Man ghosts in a row. These ghosts and Pac-Man are made using two 8x16 sprites. Move Pac-Man to the same scanline as the ghosts and there are 10 sprites on the line. I'm expecting the overflow flag to be set, in which case my code will cycle the ghosts' priorities and they should blink. FCEUX and a few other emulators show this behavior. However, some other emulators, and actual hardware, show a different behavior where Clyde (the orange ghost) simply disappears. I debugged it in Nintendulator and it seems indeed the flag is not being set. The question is, why not?
Here is my understanding of the overflow bug, as described on the wiki: after the eighth sprite on the scanline has been found, the sprite address will be incremented by 5 instead of 4. This is not supposed to affect the first sprite found in OAM after the eighth sprite on the line; the bug is only supposed to take effect after that. I've only got ten sprites, and the tenth shares its Y coordinate with the ninth, so Y coordinate of the ninth sprite (Clyde's left half) should be read correctly. The PPU should see it's on the same scanline as the other ghosts and Pac-Man, and set the flag. Apparently, it does not.
Is the description of the bug on the wiki inaccurate? Am I misunderstanding it? What's going on here?