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

All 66 examples organized by topic. For a progressive learning path, see Learn SNES Development.


Text

Print text, then move it.

Example Description
Print a string Print a string with the built-in font (textModeInit + textPrintAt)
Pixel Text Proportional text composed at the pixel: tileBlitGlyph2bpp() into a 2bpp layer

Fundamentals

Under-the-hood: raw tiles and direct VRAM writes, with the module stripped away.

Example Description
Fundamentals: how a glyph is drawn How a glyph becomes pixels: a hand-coded 2bpp font written straight to VRAM

Backgrounds

The PPU's background modes — colour vs layers vs resolution.

Example Description
Mode 1 Example Mode 1 multi-layer backgrounds (4bpp + 2bpp)
Mode 0 — 4-Layer 2bpp Background Mode 0: four 2bpp background layers (the city in parallax)
Mode 3 — 256-Color Background Mode 3: 256-colour (8bpp) single layer
mode2 — offset-per-tile in Mode 2 and Mode 4: per-column scroll from BG3 Offset-per-tile in Mode 2 (two rows) and Mode 4 (one row, 256 colours): per-column scroll from BG3
Hi-res text — BG Mode 5 + interlace (512 × 448) Mode 5 + interlace hi-res text (512×448) (krom port)

Sprites

Sprite display, animation, and OAM management.

Example Description
Simple Sprite -- Your First OAM Sprite Basic OAM setup, sprite display
Object Size -- All 6 SNES Sprite Size Modes OBJSEL size configurations (8x8 to 64x64)
Animated Sprite -- Direction States and Sprite Sheets Frame animation, sprite sheets, H-flip
Dynamic Sprite -- VRAM Streaming for Animated Sprites VRAM streaming, dynamic tile uploads; SELECT: metasprites under three OBJSEL size pairs
sprite_swarm — a bouncing swarm, and the OAM throughput ceiling A bouncing swarm + the per-sprite OAM throughput ceiling
World Sprites World-space sprites: a camera, culling and OAM in one call per batch
Aseprite Pipeline The asset pipeline: an Aseprite export through opensnes-sprite into an animated metasprite

Scrolling

Move a world past the camera.

Example Description
Mixed Scroll Multiple BG layers at different scroll rates
Continuous Scroll A threshold camera over two layers in parallax
Parallax Scrolling Per-scanline HDMA parallax scrolling
Tile Ring Eight-direction scrolling over 1,433 distinct characters: a ring of VRAM slots (tilering)

Mode 7

The rotate/scale plane — the SNES's signature trick.

Example Description
Mode 7 -- Rotation and Scaling Mode 7 rotation and scaling
Mode 7 Perspective -- Pseudo-3D Ground Effect Pseudo-3D perspective (F-Zero style)
Mode 7 rotating perspective — the full matrix, per scanline Full Mode 7 matrix rotation per scanline (krom port)
DSP-1 Ground — the Super Mario Kart floor Super Mario Kart floor: DSP-1 Raster streams the per-scanline matrices
Mode 7 EXTBG EXTBG: one plane split in two layers by bit 7, a sprite between them
mode7_racing — an F-Zero-style mini game F-Zero camera: a hover-bike race, rivals placed on the turning plane

HDMA & raster

Change a register every scanline.

Example Description
Gradient Colors -- HDMA Color Gradients HDMA + CGRAM colour gradients
HDMA Wave HDMA wave: a hand-built table (krom port), then the hdma module's helper
HDMA Helpers Demo High-level HDMA effect library (wave, ripple, iris)

Colour

Colour math, palette bypass, and beating the 256-colour limit.

Example Description
palette_cycle — animate by rotating CGRAM Palette cycling: animate by rotating CGRAM, no pixels moved
Color Addition Transparency — and Pseudo-Hires Colour math (add/subtract blending)
shadow_tint — recolour a whole scene at once Shadow & tint: darken or colour-cast a whole scene via fixed-colour math
direct_color — the pixel byte IS the color Direct colour mode: the 8bpp pixel byte IS the RGB colour
HiColor — 1792 colors from a 4bpp background 1792 colours from a 4bpp background via per-tile-row HDMA (krom port)

Windows

Mask part of the screen — static or HDMA-shaped.

Example Description
Window -- HDMA Torch Beam: Masking and Lighting Hardware window masking
Multi-window HDMA — both windows animated per scanline Both hardware windows animated per scanline (krom port)

Transitions

How a scene leaves.

Example Description
Fade and Mosaic — Screen Transitions Brightness fades at three speeds and the mosaic dissolve

Input & peripherals

Controller input: joypads, mouse, and Super Scope.

Example Description
Controller Input — Both Pads, the Edges, the Frame Count Standard joypad: button state, edge detection
SNES Mouse Mouse detection, cursor, sensitivity
Super Scope Light gun detection, PPU H/V counters

Audio

Tracker music (SNESMOD), the raw-APU engine from C, and DSP tricks.

Example Description
SNESMOD Music and Sound Effects SPC700 music playback, transport controls, sound effects over the music
soundboard — the audio v2 engine, driven entirely from C Audio v2 engine driven entirely from C (resident SPC700 driver)
SFX from WAV One-shot SFX from WAV: a settings file beside each .wav, converted by opensnes-sample
SFX voices Effects voice by voice: looped waveform with per-frame pitch, stop+play in one frame, piecewise sample load, with the scanline cost of each
Sample swap Samples at addresses the game chooses: a resident set, a swap area replaced during play, the refusals, the silence a replacement needs
apu_switch — two S-DSP programs, swapped at runtime Hot-swapping APU programs at runtime
speech_synth — the SNES says "OPEN SNES… DAVEO" BRR speech playback: the SNES says "OPEN SNES" (krom port)

Maps

Tile-based maps, streaming, Tiled pipeline, and collision.

Example Description
Map Scroll Smooth tile-aligned scrolling with viewport tracking

Game math & mechanics

The reusable logic toolbox.

Example Description
Collision Detection Demo Bounding-box sprite collision detection
aim_target Aim, distance and angle; a sprite orbiting in 16.16 fixed point
Scene Stack Scene stack: title → game → pause workflow
panel_hud — a HUD that survives a dialog box 9-slice HUD + dialog box on one layer (the panel module)
game_skeleton — the smallest complete game The smallest complete game: title → play → game-over state machine
ppu_reset — the next screen starts from a clean PPU ppuReset() between two screens: every PPU register back to power-on

Memory & mappers

Persistence and ROM mapping.

Example Description
HiROM Demo -- Understanding SNES Memory Mapping HiROM vs LoROM memory mapping
Save Game -- SRAM Persistence SRAM battery-backed saves
LZ77 into RAM — lzssDecodeRam LZ77 decompression into RAM ($7E, $7F), screen on

Enhancement chips

Cartridge coprocessors that extend the SNES beyond its base hardware.

SA-1 Coprocessor

The SA-1 is a second 65816 CPU running at 10.74 MHz (3x main CPU speed), sharing I-RAM with the main CPU for inter-processor communication.

Example Description
SA-1 Starfield (Murmuration) 128-dot Lissajous murmuration driven by SA-1 math

Super FX (GSU)

The Super FX is a custom RISC processor (GSU) with built-in pixel PLOT, hardware multiply, and direct framebuffer access for 3D and bitmap effects.

Example Description
SuperFX 3D Cube Rotating wireframe cube (Star Fox style 3D)
Super FX Game Skeleton A 60 fps game loop while the GSU renders; double-buffered presentation

DSP-1 Coprocessor

The DSP-1 (NEC µPD77C25) is a fixed-function fixed-point math coprocessor — matrix, vector and projection ops for pseudo-3D (Pilotwings, Super Mario Kart).

| Example | Description | |------—|----------—|


Demos

Playable demonstrations: several modules in one scene, without a game's rules (no score, no end).

Example Description
Map and Objects Map engine with interactive objects
shmup Vertical shoot 'em up: Kit's glider over the city against the security's hunters
rpg — an RPG template driven by a Tiled map RPG template: Tiled map drives collision and entities, dialog boxes

Games

Complete games, from the title screen to the game over.

Example Description
Breakout Breakout clone: sprites, input, game logic, scoring
Blocks Falling-blocks puzzle with Korobeiniki music, multi-line clear
shard_dash — a game in several files, with a test for each screen A game in several files: one C file per screen, a screen layer, a checksummed save, a test per screen
rooftop_run — Kit's Rooftop Run Kit's Rooftop Run: a platformer with shards, stompable machines, lives, checkpoints and a goal