Game Boy Color Map

The Game Boy Color draws its background from a tile map, the same 32×32 grid of tile indices the Game Boy uses. What is new is a parallel attribute map, one byte per cell in the second video RAM bank, that gives every tile its own palette, its own tile bank, a horizontal and vertical flip, and a background priority. So colour and orientation are per tile, not shared across the whole screen.

Game Boy Color Maps

Overview

The visible screen is 20×18 tiles of 160×144 pixels. Behind it sits a 32×32 tile map, 256×256 pixels, that wraps, so a game scrolls the small map as a window and rewrites the edge it exposes. Each cell is two bytes: a tile index in video RAM bank 0, and an attribute in bank 1 at the same address. The attribute's bank bit and the two tile banks together give 512 distinct tiles on screen.

PropertyValue
Visible screen20 × 18 tiles
Tile map32 × 32 cells, wraps at 256 pixels
Bytes per cell1 index (bank 0) + 1 attribute (bank 1)
Distinct tiles512 (256 × 2 banks), the Background mode's tile count
Background palettes8, of 4 colours each, per tile
LayersBackground and Window

The background tile map

The tile map lives in video RAM bank 0, in one of two 1 KB regions, $9800 and $9C00, chosen by the display control register. Each is 32 rows of 32 bytes; the cell at column cx, row cy is byte cy × 32 + cx, and its value is a tile index. The addressing mode selects which 256-tile window of tile data the index reads, exactly as on the Game Boy.

OffsetSizeContents
$9800–$9BFF1 KBTile map 0, 32 × 32 indices.
$9C00–$9FFF1 KBTile map 1, 32 × 32 indices.

The attribute map

Video RAM bank 1 holds a byte for every cell of the tile map, at the same address as its index. This attribute colours and orients the tile: it picks one of the eight background palettes, chooses which tile bank the index reads, flips the tile on either axis, and sets a background priority over objects.

BitMeaning
0–2Background palette 0–7.
3Tile VRAM bank, 0 or 1.
5Horizontal flip.
6Vertical flip.
7Background-to-object priority.

So the tile index says which shape, and the attribute says how it is coloured and turned. Colour is per cell, unlike the Game Boy, whose whole background shares one four-shade palette.

Scrolling the map

Two registers, SCX and SCY, set the top-left pixel of the visible window into the 256×256 map, and both wrap. To scroll a world larger than the map, the game moves the scroll a pixel at a time and, as a fresh row or column of tiles comes into view, writes its indices into bank 0 and its attributes into bank 1 at the wrapped edge. The wrap makes the tile map a treadmill; the writes happen in the vertical blank, which caps how fast a detailed screen can scroll.

The window map

The Window is a second tilemap layer that draws over the background from a fixed position, set by WX and WY, without scrolling. It reads the other tile map region and the same attribute map, so a heads-up display or a status bar sits above the scrolling world. It is the same Window the Game Boy has, now coloured per tile.