VDP Sprite overflow bit and polling

By PingPong

Prophet (3281)

PingPong's picture

04-06-2019, 12:23

Hi, it is known that when one read the VDP status reg 0 the v. interrupt bit is cleared.
I'm wondering if it is also for the sprite overflow bit. For example:
(assuming msx2)
we have two regions where we had a sprite overflow say at line 50 there are 9 sprites on a scanline.
If i poll the register on scanline 51, i probably report the overflow, but my question is:
if on line 150 i have another sprite overflow situation, reading the S#0 on line 151 do i report the first overflow at line 50, or the second occouring at line 150 ?
In others words do the s#0 read reset the sprite overflow bit and make it ready for another situation or the bit is cleared at the beginning of a frame only once?

Login or register to post comments

By Grauw

Enlighted (8015)

Grauw's picture

04-06-2019, 16:05

Any flag that is automatically cleared on register read should not be polled but instead rely on triggering the IRQ. Polling those flags will sometimes miss when the flag is set by the VDP and read by the CPU at the same. It is simply a fundamental flaw with the way this reset-on-read works.