Like you know, the basic template to follow is
Code: Select all
void hblank()
{
//code 1
}
void vblank()
{
//code 2
}
int main()
{
while(1)
{
//code 3
waitSync();
}
}
All my demos/games work with (almost) no lag because I move code from //code 2 to //code 3 when it starts to lags (or invert if there is no more lag), it's more a try-and-see that a real code workflow optimization.
And I'd like to fix this lack of knowledge !
What I know :
//code 1 should be very small (what is small?)
//code 2 could be more advanced
//code 3 is a problem because a hint/vint could occurs if too heavy
So, is there someone able to explain, for newb like me (!), how it could be handled the best way ?
I know, in asm, you can count the ticks needed by each part and so optimize at most each one (just insane, but doable)
How could I know if my code would produce a lag, will be interrupted by a vint or simply will crash ?
I hope my question is clear enough