Coordinating 32x screen flip and MD vblank?
Posted: Sun May 02, 2021 8:31 pm
Hi there,
I've got a basic 32x app loop running like
where Hw32xScreenFlip
I believe is originally from Chilly Willy's SDK. I'm using marsdev, which is a descendant.
If I wanted to update some MD planes, which is typically done during vblank, when would that be done? It's not clear to me when vblank happens in the screen flip. I've seen one example doing a screen flip without waiting, modify a plane, then waiting.
Or is waiting for vblank something other than flipping and waiting?
Can anybody shed some light on this? Thanks!
I've got a basic 32x app loop running like
Code: Select all
while (1)
{
// input
// draw
Hw32xScreenFlip(1); // 1 is for wait
}
Code: Select all
void Hw32xScreenFlip(int wait)
{
// Flip the framebuffer selection bit
MARS_VDP_FBCTL = currentFB ^ 1;
if (wait)
{
while ((MARS_VDP_FBCTL & MARS_VDP_FS) == currentFB) ;
currentFB ^= 1;
}
}
If I wanted to update some MD planes, which is typically done during vblank, when would that be done? It's not clear to me when vblank happens in the screen flip. I've seen one example doing a screen flip without waiting, modify a plane, then waiting.
Or is waiting for vblank something other than flipping and waiting?
Can anybody shed some light on this? Thanks!