Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

VRAM Layout

Note

This page is currently a stub and needs more detail.

Where VRAM starts is defined in the memory map. Most regions have a slot that is larger than what it currently uses, so such regions can grow without the others having to move.

OffsetSizeUsedContents
+0x000000x10000x400Sprite table
+0x010000x10000x30Background color, Screen Brightness, and layer registers
+0x020000x20000x300Palettes
+0x040000x40000x4000Tile map for layer 0
+0x080000x40000x4000Tile map for layer 1
+0x0C0000x40000x4000Tile map for layer 2
+0x100000x40000x4000Tile map for layer 3
+0x140000x40000x4000Tile map for layer 4
+0x180000x80000Reserved

Sprite Table

128 sprite entries of 8 bytes each, which is 1 KB. Sprite N lives at vram start + N * 8.

Background Color

The background color is 3 bytes, red then green then blue, at +0x01000. It is drawn behind everything and is not part of any palette.

Screen Brightness

The byte at +0x01003 controls the screen brightness. At 0, the screen will render as normal. As the value approaches 255, the screen gets closer to pure black, where 255 is pure black.

The 4 bytes after it (+0x01004 to +0x01007) are reserved.

Layer Registers

Each layer has 8 bytes of layer registers. The registers for layer N live at vram start + 0x01008 + N * 8.

Palettes

16 palettes of 16 colors, 3 bytes per color. Color C of palette P is at vram start + 0x02000 + P * 0x30 + C * 3.

Tile Maps

Each tile layer has a tile map of 64x64 tile entries, 4 bytes each. The tile map for layer N starts at vram start + 0x04000 + N * 0x4000, and the entry at column X and row Y is at map start + Y * 0x100 + X * 4.