It's surprisingly hard to get frame synchs.
Firstly there are no such functions in the standard library, which isn't surprising as it's designed as far as possible to be hardware agnostic.
Ideally you'd just call a fucntion waitforverticalblank(). That's how it ought to work. In practise such a function is almost never provided. You've got to do things like setting up an interrupt function to intercept the blank. This is nowhere near as complicated as it sounds. Vertical blank will cause the processor to stop what it is doing and run to a routine at an address given by a table. You overwrite the table with your interrupt function, do your stuff, and then call the old routine. A skeleton is
volatile int flag;
void (*oldinterrupt)(void);
void vbinterrupt(void)
{
flag = 1;
/* now do everything else we need to service the interrupt */
(*oldinterrupt)();
}
void waitforverticalblank(void)
{
while(flag == 0) {};
flag = 0;
}
The principle isn't hard. It's getting the details of how your system is set up that can be difficult.