Fixing DEBUG_VDP_INT

The RetroNET NABU-LIB z88dk C Library for creating games and software.
Post Reply
User avatar
AGMS
Posts: 18
Joined: Tue Feb 20, 2024 9:56 pm

Fixing DEBUG_VDP_INT

Post by AGMS »

I tried the DEBUG_VDP_INT option in NABU_LIB, which flashes the Alert light when you miss a frame. It has a logic bug and leaves the light on all the time!

To fix it, add a "vdpIsReady = false;" right after your call to vdp_waitVDPReadyInt(), because that function forgets to reset the flag after waiting, leaving it set to true pretty much all the time. By the way, it may be a better idea to increment it in the interrupt handler (use uint8_t rather than bool) so you can still keep track of missed frames when aiming for 30 frames per second rather than 60.

For another way of noticing missed frame updates, if you have a sound channel available, you can play a tone in your frame processing loop. Easier to notice than a flickering light.

Code: Select all

if (vdpIsReady)
  playNoteDelay(2, 71, 40); /* High, short note. */
vdp_waitVDPReadyInt();
vdpIsReady = false;
- Alex
Post Reply