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

All 83 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)
Scroll a message Move text: scroll the text layer for a marquee (bgSetScroll)

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 1 BG3 High Priority -- HUD Layer Over Backgrounds BG3 priority bit for overlay effects
Mode 1 LZ77 LZ77-compressed background data
Mode 0 — 4-Layer 2bpp Background Mode 0: four 2bpp background layers (Kirby parallax)
Mode 3 — 256-Color Background Mode 3: 256-color (8bpp) single layer
Mode 5 — Hi-Res 512×256 Background Mode 5: hi-res 512×256 (16-color)
mode2 — offset-per-tile: per-column scroll from BG3 Mode 2 offset-per-tile: per-column scroll from BG3 (modes 2/4/6)
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
Metasprite Multi-tile composite sprites
Dynamic Sprite -- VRAM Streaming for Animated Sprites VRAM streaming, dynamic tile uploads
Dynamic Metasprite Engine Dynamic metasprite engine with batched OAM updates
sprite_swarm — a bouncing swarm, and the OAM throughput ceiling A bouncing swarm + the per-sprite OAM throughput ceiling

Scrolling

Move a world past the camera.

Example Description
Mixed Scroll Multiple BG layers at different scroll rates
Continuous Scroll Streaming scroll with dynamic tile loading
Parallax Scrolling Per-scanline HDMA parallax scrolling

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)

HDMA & raster

Change a register every scanline.

Example Description
Gradient Colors -- HDMA Color Gradients HDMA + CGRAM color gradients
HDMA Indirect Gradient Indirect HDMA pointer-table gradient (krom port)
HDMA Wave HDMA scanline wave distortion
HDMA Wave Table Raw HDMA table in C, krom-style repoint animation
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 Color 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 color mode: the 8bpp pixel byte IS the RGB color
"9-bit" gradient — brightness-dithered backdrop Brightness-dithered "9-bit" gradient backdrop (krom port)
HiColor — 1792 colors from a 4bpp background 1792 colors from a 4bpp background via per-tile-row HDMA (krom port)
"3840 colors" — RGB channel-split blend 3840 colors via RGB channel-split blend (krom port)

Windows

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

Example Description
Window -- HDMA Triangle Masking Hardware window masking
Multi-window HDMA — both windows animated per scanline Both hardware windows animated per scanline (krom port)
Transparent Window -- Color Math + HDMA Color math + HDMA windowed transparency

Transitions

How a scene leaves.

Example Description
Fading Example Brightness control, screen transitions
Mosaic -- PPU Pixel Block Effect Mosaic pixelation effect

Input & peripherals

Controller input: joypads, mouse, and Super Scope.

Example Description
Controller Input Standard joypad: button state, edge detection
Drive a sprite with the pad Drive a sprite with the D-pad
Two Players Example Joypad reading, two-player movement
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 Example SPC700 music playback, transport controls (LoROM)
SNESMOD Large Soundbank Music Large soundbank: multi-bank module split
SNESMOD Sound Effects Sound effects alongside 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: the zero-config .wav to .brr build rule (wav2brr)
apu_switch — hot-swapping APU programs at runtime Hot-swapping APU programs at runtime
play_noise — a drum kit with zero samples A drum kit from the S-DSP white-noise generator (krom port)
pitch_mod — hardware vibrato via pitch modulation Hardware vibrato via pitch modulation (PMON) (krom port)
speech_synth — the SNES says "OPEN SNES" BRR speech playback: the SNES says "OPEN SNES" (krom port)
Echo / reverb S-DSP echo / reverb, isolated — START toggles dry/wet

Maps

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

Example Description
Map Scroll Smooth tile-aligned scrolling with viewport tracking
Tiled Map Editor Integration Tiled Map Editor (.tmx) integration
Dynamic Map Dynamic tile map streaming
Slope Mario Slopes and tile-based collision

Game math & mechanics

The reusable logic toolbox.

Example Description
Collision Detection Demo Bounding-box sprite collision detection
aim_target Aim a cursor at moving targets — sprites + input
fix32_orbit 16.16 fixed-point API: a sprite orbits the screen centre
Random Numbers LCG pseudo-random number generation
VBlank Timer Frame-accurate timers with VBlank counters
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

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

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 Hello World Boot diagnostic: SA-1 init, I-RAM handshake, register verification
SA-1 Starfield (Murmuration) 128-dot Lissajous murmuration driven by SA-1 math

SuperFX (GSU)

The SuperFX 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 Hello Boot + SRAM + FMULT hardware tests
SuperFX 3D Cube Rotating wireframe cube (Star Fox style 3D)

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
DSP-1 Cube Pseudo-3D: a cube's 8 corners tumbling in 3D, rotated by the DSP-1

Games (capstones)

Complete game projects combining multiple subsystems.

Example Description
Breakout Breakout clone: sprites, input, game logic, scoring
Tetris Tetris with Korobeiniki music, multi-line clear
LikeMario Platformer with scrolling, animation, physics
Map and Objects Map engine with interactive objects
shmup_1942 Vertical shoot 'em up (Kenney Pixel Shmup assets)
mode7_racing — an F-Zero-style mini game F-Zero-style racer on the rotating Mode 7 plane
mode7_flying — a Pilotwings-style demo Pilotwings-style flight: altitude drives Mode 7 scale
rpg — an RPG template driven by a Tiled map RPG template: Tiled map drives collision and entities, dialog boxes