VBlank frame counter display, written against the gameloop framework. More...
Functions | |
| int | main (void) |
| Entry point — hand off to gameLoopRun(). | |
| static void | on_init (void) |
| One-time hardware setup. Runs before the first VBlank sync. | |
| static void | on_update (void) |
| Per-frame work. Called once per VBlank by the gameloop. | |
VBlank frame counter display, written against the gameloop framework.
Displays a live frame counter that increments every VBlank (60 fps NTSC, 50 fps PAL). The simplest possible real-time display: read a hardware counter, render it as text, repeat. Doubles as the canonical demo of the opt-in gameloop framework — init() runs the standard SNES boot sequence, update() runs once per VBlank, and main() never sees a while(1) itself.
Equivalent hand-rolled main loop:
Both ship the same observable behaviour; the framework exists so the loop boilerplate isn't repeated 53 times across the SDK and so future scene/state machinery has one place to plug into.
| int main | ( | void | ) |
Entry point — hand off to gameLoopRun().
gameLoopRun never returns; the return 0 exists only to satisfy int main(void)'s control-flow contract.
|
static |
One-time hardware setup. Runs before the first VBlank sync.
Standard text-mode boot: textModeInit() sets BG mode + text engine, the PrintAt writes our static label into the off-screen tilemap buffer, the explicit WaitForVBlank ensures the very first NMI has fired (so the buffer has been DMA'd to VRAM) before we turn the screen on.
|
static |
Per-frame work. Called once per VBlank by the gameloop.
The framework has already done WaitForVBlank() before calling us, so we are inside the VBlank window — VRAM/CGRAM/OAM writes are safe at this point. Nothing here exceeds the budget so we never drop a frame.