gfx_sys.h provides functions and macros related to low level graphics system functions
void init_graphics();
Call this to initialize the graphics system and prepare it for sequential drawing. Should only need to be called once at the beginning of the program.
void await_vsync(int frames);
Call this to block execution until the next vsync (frames=1) or wait for a number of vsyncs to pass (frames>1). Best used at the end of drawing and updating the game state.
void flip_pages();
Switch which framebuffer is being drawn on and which framebuffer is being sent to the TV. Call this right after await_vsync for consistent timing.
void await_drawing();
Waits for the current draw operation to complete.
Graphics API calls that use the blitter will set the global `draw_busy` variable to 1, and this function waits for the interrupt to set it to zero.