Static 16-color background display in Mode 1 (4bpp).
Displays a single full-screen tiled background using Mode 1, the most commonly used SNES video mode. Mode 1 provides two 4bpp layers (BG1 and BG2, each up to 16 colors) plus one 2bpp layer (BG3, 4 colors). This example uses only BG1 with a 16-color tileset and tilemap converted from a PNG by gfx4snes.
This is a direct port of the PVSnesLib "Mode1" example.
- SNES Concepts
- Mode 1: BG1/BG2 are 4bpp (16 colors each), BG3 is 2bpp (4 colors)
- bgInitTileSet() for combined tile + palette loading with VRAM address configuration
- dmaCopyVram() for tilemap data transfer to a separate VRAM region
- VRAM layout: tilemap at $0000, tiles at $4000 (non-overlapping regions)
- Force blank (setScreenOff) during VRAM setup to avoid mid-frame writes
- What to Observe
- A static full-screen image rendered as 8x8 tiles on BG1
- Only BG1 is enabled; BG2 and BG3 are unused
- The image remains stationary (no scrolling)
- Modules Used
- console, sprite, dma, background, asset
- See also
- background.h, dma.h, video.h
Entry point – load a 4bpp tileset and display a static Mode 1 image.
Demonstrates the typed asset bundle: tileset, palette, tilemap, color depth and map size all travel together in a single BgAsset. A single bgLoad() does the same work as a manual bgSetMapPtr + bgInitTileSet + dmaCopyVram triple, with the color-mode / size pairing locked at declaration time.
The VRAM layout places the tilemap at $0000 and tile graphics at $4000 to avoid overlap (each tilemap is up to 2KB, tile data can be many KB).
- Returns
- Never returns (infinite loop).