Mode 0 parallax scrolling with four independent 2bpp backgrounds.
Showcases BG Mode 0, the only SNES video mode that provides four simultaneous background layers. Each layer is limited to 4 colors (2bpp), giving a total of 16 on-screen palette entries across four independent palette banks. The four layers are loaded from separate BMP assets and scroll horizontally at different speeds every 3 frames, creating a parallax depth effect.
This is a direct port of the PVSnesLib "Mode0" example.
- SNES Concepts
- Mode 0: four BG layers, each 2bpp (4 colors), each with its own palette bank
- Palette banking: BG0 uses palette 0-3, BG1 uses 4-7, BG2 uses 8-11, BG3 uses 12-15
- bgInitTileSet() loads tiles, palette, and configures the tile base address in one call
- Independent per-layer scrolling via bgSetScroll() for parallax effects
- VRAM layout: four separate tilemap regions ($0000/$0400/$0800/$0C00) and tile regions
- What to Observe
- Four layered backgrounds visible simultaneously
- BG1-BG3 scroll horizontally at different speeds (3x, 2x, 1x) for parallax
- BG0 (frontmost) remains stationary
- Each layer uses a distinct 4-color palette
- Modules Used
- console, dma, background
- See also
- background.h, dma.h, video.h
Entry point – load 4 BG layers and animate parallax scrolling.
Loads four independent 2bpp tilesets and tilemaps into separate VRAM regions, one per Mode 0 background layer. Each layer gets its own palette bank (Mode 0 provides 4 banks of 4 colors). After setup, the main loop increments scroll positions at different speeds every 3 frames to create a parallax depth illusion: BG1 (foreground) moves fastest, BG3 (farthest) moves slowest, and BG0 stays stationary.
- Returns
- Never returns (infinite loop).