NES Maps

On the NES a tile map and the background are the same thing. The nametable is a grid of tile numbers and its attached attribute table sets the palettes, so the map that defines a level is exactly the data the PPU draws. Mirroring and cartridge mappers let that map grow far beyond one screen.

NES Maps

Overview

The NES draws its background straight from a tile map, so there is no separate map format to convert. The visible map is the nametable: 32×30 tile entries, one byte each, followed by a 64-byte attribute table that colours them. A game stores a level as this same grid of tile numbers, streaming fresh columns or rows into the nametable as the screen scrolls.

PropertyValue
Map size32 × 30 tiles per nametable
Tile entry1 byte (index into the pattern table)
Attribute area64 bytes per nametable
Colour granularity1 palette per 16 × 16 pixels
Physical nametables2 (extended by mirroring)

The nametable as a map

Each nametable is 1024 bytes: 960 tile bytes then 64 attribute bytes. The tile map is the first 960 bytes, laid out as 30 rows of 32. The tile at column cx, row cy is byte cy × 32 + cx, and its value is the pattern-table tile drawn in that cell. Editing one byte changes one 8×8 cell of the map.

OffsetSizeContents
$000–$3BF960 bytesTile indices, 32 columns × 30 rows.
$3C0–$3FF64 bytesAttribute table (palettes).

Attribute palettes

The 64 attribute bytes assign palettes to the map. One byte covers a 32×32 pixel region, a 4×4 tile block, split into four 16×16 quadrants. Two bits per quadrant give the palette number 0 to 3. So the map’s colour is set on a coarser grid than its tiles, and level art is built so each 2×2 tile group shares one palette.

Bits7–65–43–21–0
QuadrantBottom-rightBottom-leftTop-rightTop-left

The 64 attribute bytes form an 8×8 grid of these 4×4 tile blocks, which covers the 32×30 tile map with a little spare at the bottom edge.

Mirroring

The console has room for four nametables but only 2KB of nametable RAM, enough for two. Mirroring decides how the four logical nametables share the two real pages, which sets the direction a map can scroll seamlessly. Horizontal mirroring pairs the tables side by side for vertical scrolling; vertical mirroring stacks them for horizontal scrolling.

MirroringLayoutSeamless scroll
HorizontalTop two tables share one page, bottom two the other.Vertical
VerticalLeft two tables share one page, right two the other.Horizontal
Single-screenAll four map to one page.Neither (still screen)
Four-screenExtra cartridge RAM gives four real tables.Both

Mappers and large maps

A level far larger than two screens lives in cartridge ROM and is fed into the nametable as the player moves. As the view scrolls, the game writes the next off-screen column or row of tiles and its attributes into the nametable that mirroring keeps just out of sight. Mappers, the bank-switching hardware on the cartridge, swap in fresh tile data and pattern banks, and some can even change the mirroring mode or generate a scanline interrupt so a status bar stays fixed while a huge map scrolls beneath it.