Mode 5 hi-resolution background display. More...
#include <snes.h>Functions | |
| int | main (void) |
| Entry point – sets up Mode 5 hi-res display and loops forever. | |
Variables | |
| u8 | palette [] |
| 15-bit BGR palette for the Mode 5 background (up to 16 colors). | |
| u8 | palette_end [] |
| u8 | tilemap [] |
| Tilemap data mapping tile indices to BG1's 32x32 grid. | |
| u8 | tilemap_end [] |
| u8 | tiles [] |
| Mode 5 interleaved 4bpp tile data (converted with gfx4snes -M 5). | |
| u8 | tiles_end [] |
Mode 5 hi-resolution background display.
Demonstrates SNES BG Mode 5 (512x256, 4bpp, 16 colors). Mode 5 doubles the horizontal resolution from 256 to 512 pixels by using interlaced tile data and requiring BG1 on both the main and sub screens. The PPU alternates even/odd pixel columns between the two screens each frame, producing a true 512-pixel-wide output on compatible displays. Tile data must be converted with the special -M 5 interleaving flag.
gfx4snes -M 5)| int main | ( | void | ) |
Entry point – sets up Mode 5 hi-res display and loops forever.
The setup sequence is:
|
extern |
15-bit BGR palette for the Mode 5 background (up to 16 colors).
| u8 palette_end[] |
|
extern |
Tilemap data mapping tile indices to BG1's 32x32 grid.
Each tilemap entry is 2 bytes: low byte = tile index, high byte = attributes (palette, priority, flip). Loaded to VRAM $6000 to avoid overlapping the tile data region at $0000.
| u8 tilemap_end[] |
|
extern |
Mode 5 interleaved 4bpp tile data (converted with gfx4snes -M 5).
Mode 5 tile data is interleaved: even pixel columns go to the main screen and odd pixel columns go to the sub screen. The PPU composites both screens each frame to produce the 512-pixel-wide output. Standard (non-interleaved) tile data would display incorrectly in Mode 5.
| u8 tiles_end[] |