Quote:
Originally Posted by Toni Wilen
I usually simply wait for line x and then wait until line is not x.
|
This is reliable, but the CPU would then do nothing but busy-wait for a whole scanline, i.e. 0.4% CPU time wasted.
Waiting for line $138 = EOF is essentially the same as waiting for line $1a = TOF, except for the flyback of the beam. So if you poll for these raster lines and execute code, any Vblank interrupt will interrupt that code after a very short while.
So if code is executed after a raster busy wait in main, that relies on values set by the int, read them at EOF quickly before the int hits (and never re-read them later in the code), because they may be changed by the int mid-execution.