OpenSNES
Modern Open-Source SNES Development SDK
Loading...
Searching...
No Matches
OpenSNES Examples

The example corpus: small ROMs, each a folder with its main.c, its assets, a Makefile and a README.md that says what it shows. They go from a first line of text to playable demonstrations and three complete games.

The table below counts them per folder.

Categories

Category Examples What It Covers
text/ 2 Text display, fonts, tilemaps
fundamentals/ 1 Under-the-hood: raw tiles, direct VRAM writes
basics/ 6 Collision, timing, scene stack, randomness, fixed-point, aiming, HUD panels, game skeleton, resetting the PPU between screens
backgrounds/ 5 BG modes 0/1/2/3/4/5/6, priority, LZ77, hi-res, offset-per-tile
sprites/ 7 Sprite display, animation, OAM, metasprites, VRAM streaming, swarm, Aseprite pipeline
hdma/ 3 Per-scanline HDMA effects: gradients, waves, raster
color/ 5 Palette cycling, colour math, shadow/tint, direct colour, HiColor, pseudo-hires blend
windows/ 2 Hardware window masking, shaped per scanline
transitions/ 1 Screen transitions: fades and the mosaic dissolve
scrolling/ 4 Layer scrolling: parallax, streaming, per-scanline HDMA, maps with more characters than VRAM
mode7/ 6 Mode 7: rotation, scaling, per-scanline perspective, DSP-1 ground and objects, EXTBG, a racing camera with sprites on the plane
input/ 3 Joypads, mouse, Super Scope, multi-player
audio/ 7 Music and sound effects: SNESMOD and raw APU/DSP
maps/ 1 Tile maps, dynamic streaming, slopes
memory/ 3 HiROM mode, battery-backed saves, LZ77 decompression into RAM
chips/ 3 Enhancement chips: SA-1 and SuperFX/GSU (the DSP-1 is in mode7/)
demos/ 3 Playable demonstrations: several modules in one scene, without a game's rules (map engine + object engine, a vertical shmup, Tiled-driven RPG)
games/ 4 Complete games, from the title screen to the game over (falling blocks, Breakout, a rooftop platformer, a small game built across several files)

Building

# Build all examples
cd opensnes
make
# Build a single example
make -C examples/text/print_string
# Clean and rebuild
make clean && make

Running

luna, the SDK's emulator (scripts/install-luna.sh installs it), plays any example in a window:

testing/bin/luna-gui examples/text/print_string/print_string.sfc

The headless luna dumps VRAM, OAM, palettes and registers (luna assets-dump, luna state) and is a full debugger over MCP: see Debugging. Any other SNES emulator works too.

Tips

  1. Read the source – every main.c is commented to explain the "why"
  2. Experiment – change values, break things, see what happens
  3. Look at the machine – luna assets-dump shows what the code put in VRAM, OAM and the palettes

Audio Backgrounds Basics Examples Enhancement chips Colour Demos Fundamentals Complete Games HDMA & raster Input & peripherals Maps Memory Examples Mode 7 Scrolling Sprites Text Examples Transitions Windows