Game Boy Maps
The Game Boy builds its background from a tile map: a 32×32 grid of tile indices that names which tile draws in each cell. The map is small, but scrolling and the window turn it into levels far larger than the 160×144 screen. This page covers the map layout, the two ways a tile index selects tile data, scrolling, and the separate window map.
Overview
A map is a compact description of a scene: one byte per cell, each byte an index into the tile store. Because a scene reuses the same tiles many times, a full 256×256 background costs just 1024 bytes of map plus the shared tiles. The display walks the map as it draws, fetching each named tile. Two map regions exist, and either can serve the background or the window.
| Property | Value |
|---|---|
| Map grid | 32 × 32 cells |
| Map field | 256 × 256 pixels |
| Bytes per cell | 1 (a tile index) |
| Map size | 1024 bytes |
| Map regions | $9800 and $9C00 |
The background tile map
The background map is 32 cells wide and 32 tall, each cell one byte. The byte at base + row * 32 + col holds the tile index drawn at that cell, where base is $9800 or $9C00 as chosen by LCDC bit 3. The screen shows a 20×18 window of these cells at a time.
| LCDC bit 3 | Background map |
|---|---|
| 0 | $9800 – $9BFF |
| 1 | $9C00 – $9FFF |
Editing one map byte swaps the tile in one cell, so animating scenery or revealing parts of a level is a matter of writing single bytes. The map and the tile store are separate: many cells can point at the same tile, and one tile edit changes every cell that uses it.
Tile addressing modes
A map byte is only an index; how it turns into an address in the tile store depends on the addressing mode, set by LCDC bit 4. In the unsigned mode the index counts up from $8000; in the signed mode it is a signed offset from $9000, letting indices reach tiles below and above that point.
| LCDC bit 4 | Base | Index | Tile at |
|---|---|---|---|
| 1 | $8000 | 0 to 255 (unsigned) | $8000 + index × 16 |
| 0 | $9000 | −128 to 127 (signed) | $9000 + signed(index) × 16 |
Objects always use the $8000 unsigned method, so their tile numbers are read the same way regardless of this bit. The signed $8800 mode lets the background share the middle of the tile store while objects use the low end, which is how many games fit both sets of art into video RAM.
Scrolling the map
The screen is a moving window onto the 256×256 map field. SCY ($FF42) and SCX ($FF43) set the pixel at the top-left of the screen within the field. Increasing them slides the view, and because the map wraps at 256 pixels, the far edge reappears at the near edge, giving seamless, endless scrolling in any direction.
| Register | Address | Effect |
|---|---|---|
| SCY | $FF42 | Top pixel row of the screen in the map field. |
| SCX | $FF43 | Left pixel column of the screen in the map field. |
To move through a level bigger than 256 pixels, a game scrolls the map and rewrites the cells about to appear at the leading edge, well before they scroll into view. This trick keeps the small map showing a much longer scene without ever needing a larger buffer.
The window map
The window is a second map-driven layer that ignores SCX and SCY. Its map region is chosen by LCDC bit 6, again $9800 or $9C00, and it is placed on screen by WX ($FF4B) and WY ($FF4A). Because it does not scroll, it holds fixed panels: score bars, dialogue boxes and menus that stay still over a scrolling background.
| Setting | Register | Role |
|---|---|---|
| Window enable | LCDC bit 5 | Turns the window on. |
| Window map | LCDC bit 6 | Selects $9800 or $9C00. |
| Window Y | WY ($FF4A) | Screen row the window starts on. |
| Window X | WX ($FF4B) | Screen column plus 7 the window starts on. |
The window always begins at its own top-left cell, so it cannot be scrolled internally by SCX and SCY; moving WX and WY slides the whole panel on screen instead. Sharing the two map regions between background and window means a game must pick a layout that gives each layer the region it needs.