OpenSNES
Modern Open-Source SNES Development SDK
Loading...
Searching...
No Matches
main.c File Reference

Family 1 (Text) · rung 1.1 — print a string with the built-in font. More...

#include <snes.h>

Functions

int main (void)
 Entry point – initialize text module and display a test string.

Detailed Description

Family 1 (Text) · rung 1.1 — print a string with the built-in font.

The gentlest possible program that still exercises the whole SNES rhythm (tiles + palette + VRAM + VBlank). textModeInit() sets up the hardware and the text engine in one call, textPrintAt() writes into an off-screen buffer, and the NMI handler DMAs that buffer to VRAM as a tilemap on the next VBlank — no manual flush needed. One string, on BG1, in Mode 0. This is the first rung of the Text ladder; the under-the-hood version (a glyph as raw 2bpp bitplanes) lives in examples/fundamentals/text_glyphs.

SNES Concepts
What to Observe
  • A dark blue screen with "TEXT MODULE TEST" printed in white
Modules Used
console, dma, text, background, sprite
See also
text.h, video.h, tutorial_graphics

Function Documentation

◆ main()

int main ( void )

Entry point – initialize text module and display a test string.

Demonstrates the OpenSNES text module workflow: textModeInit() sets up hardware + the text engine in one call, textPrintAt() writes characters into the off-screen buffer, and the NMI handler DMAs the buffer to VRAM as a tilemap during the next VBlank. A WaitForVBlank() before setScreenOn() ensures all VRAM writes complete during blanking, preventing PPU corruption on the first frame.

Returns
Never returns (infinite loop).