“Mirroring” means two different things on the NES. Memory mirroring is one byte appearing at several addresses. Nametable mirroring is the layout of the four background screens, usually made by memory mirroring. The iNES header bits that tell an emulator which layout a cartridge uses are on iNES: header.
Memory mirroring
A chip that ignores some address lines answers at several addresses. Decoding every line costs pins, so this is common, and costs nothing if the mirror sits in otherwise unused space. On the NES:
- CPU RAM at
$0000–$07FFrepeats at$0800–$0FFF,$1000–$17FFand$1800–$1FFF. So$0173,$0973,$1173and$1973are one byte. - The PPU registers at
$2000–$2007repeat every 8 bytes up to$3FFF. - The single register of most simple (discrete logic) mappers is mirrored through
$8000–$FFFF; registers of common ASIC mappers such as MMC1 and MMC3 are mirrored in groups. - In NROM-128 the 16 KiB of PRG ROM appears at both
$8000–$BFFFand$C000–$FFFF. - In most mappers, banks beyond the end of PRG or CHR ROM show earlier banks again. In UNROM, PRG banks 8 to 15 repeat banks 0 to 7. ROM sizes that are not a power of two can give more complicated mirrors.
- Palette RAM repeats through
$3F00–$3FFF(see palette colours). - Nametable mirroring is memory mirroring inside PPU
$2000–$2FFF, done on purpose.
The four nametables
A nametable is 1,024 bytes: 30 rows of 32 tile numbers (960 bytes, $3C0) and a 64-byte attribute table. One nametable is a 256 × 240 pixel screen. The PPU has four logical nametables in a 2 × 2 square: $2000 top left, $2400 top right, $2800 bottom left, $2C00 bottom right. The console holds only 2 KiB of VRAM (CIRAM), enough for two. Hardware on the cartridge sets address bit 10 of CIRAM (CIRAM A10) and so decides which physical nametable each logical one shows.
When a direction is mirrored, the picture simply wraps to the same nametable. It is repeated, not flipped. The letters A, B, C and D below are screens of 1,024 bytes.
The common layouts
| Layout | Logical screens ($2000, $2400, $2800, $2C00) | Tilemap | Wiring |
|---|---|---|---|
| Horizontal mirroring (a vertical arrangement of the nametables) | A A B B | 32 × 60 tiles | CIRAM A10 = PPU A11. On Nintendo boards, the solder pad “V” (for vertical arrangement) is shorted. |
| Vertical mirroring (a horizontal arrangement) | A B A B | 64 × 30 tiles | CIRAM A10 = PPU A10. On Nintendo boards, the pad “H” is shorted. |
| Single-screen (two choices, lower A or upper B) | A A A A, or B B B B | two 32 × 30 tilemaps | Mapper-controlled (MMC1, AxROM, TLSROM): a register output drives CIRAM A10 (AxROM latches PRG D4 with a 74HC161). Fixed: CIRAM A10 tied to ground or Vcc. |
| Four-screen | A B C D | 64 × 60 tiles | Extra RAM on the cartridge (see below). |
Horizontal mirroring
Mostly for games that scroll only vertically or in all directions. Scrolling sideways is hard to do smoothly, because the data at the right shows at once on the left. Hardware clipping of the left screen edge can hide the tile glitches, but attribute tables have a resolution of 2 × 2 tiles, so there are always attribute glitches at the left or right. The best that can be done is 4 pixels of wrong attributes on each side; most games did worse, so many NES games have colour glitches at the screen border. Some televisions hide up to 8 pixels on each side by overscan. Solid black sprites on the right border can hide it (Alfred Chicken does this) but cost sprites per line (7 instead of 8) and OAM space.
Vertical mirroring
Mostly for games that scroll sideways. Also used by games that scroll vertically and never more than one screen sideways (Lode Runner, Bomberman, Fire Emblem, Crystal Mines), so nothing has to be loaded when moving sideways. Games scrolling both ways without a status bar use it too: data at the top shows at the bottom at once, and NTSC overscan can hide the glitch (it appears on PAL sets). The best case is 4 pixels with wrong tiles and 4 with wrong colour on both sides. A raster split can hide it (Jurassic Park, M.C. Kids).
Single-screen
Switching between the two screens lets a status bar sit in one nametable and the playfield in the other, switching mirroring and scroll at the right line, so the playfield can extend equally in any direction. Address formulas for updates get simpler. Horizontal scrolling shows the same glitches as horizontal mirroring, but with a status bar nothing glitches vertically, because the data that falls off the top or bottom lands in the area hidden by the bar. The board of iNES mapper 218 wires CIRAM A10 to PPU A10, A11, A12 or A13, so a game can keep tiles in CIRAM without any CHR ROM or CHR RAM.
Four-screen
Very few games use it. With RAM on the cartridge: Rad Racer II, Gauntlet, Napoleon Senki, Rocman X (Sachen) and every Vs. System game. With ROM nametables: Final Lap and King of Kings. Mappers known with four screens: MMC3 (Rad Racer II), iNES 206 (a subset of the MMC3, Gauntlet), iNES 77 (RAM across the PPU space, with CHR-RAM and ROM, Napoleon Senki), the Vs. System (twice the VRAM, most visible as iNES 99), Namco 163 and the JY Company mapper (1 KiB CHR-ROM pages freely placed in the four screens), and the homebrew UNROM 512 and GTROM. Others can do uncommon four-screen layouts: VRC6 (1 KiB CHR-ROM pages anywhere), and MMC5 (its internal RAM as a third nametable and a generated blank fourth page).
The iNES header can ask for four nametables for any mapper that does not clash with it, if the emulator supports it. Ways to build the extra RAM:
- Add 2 KiB of RAM and combine it with the console’s CIRAM through a decoder, giving one 4 KiB block at
$2000–$2FFF. - Add an 8 KiB 6264 RAM in place of CIRAM. This wastes CIRAM and leaves 4 KiB of unused memory at
$3000–$3EFF, but needs one chip, and 8 KiB parts are cheaper today. - Add a larger RAM and map it across the whole PPU space: 8 KiB of pattern tables at
$0000–$1FFFand 4 KiB of nametables at$2000–$2FFFin one chip.
Unusual layouts
- Diagonal: CIRAM A10 = PPU A11 xor PPU A10. Changing scroll direction needs no switch between horizontal and vertical mirroring.
- L-shaped: CIRAM A10 = PPU A11 or PPU A10. Used in Sachen’s 374N (iNES 243) and the 8259 family. Allows scrolling in four directions as long as the direction changes only at screen boundaries.
- Three-screen layouts (A C B C vertical, A B C C horizontal, A B B C diagonal) and a fixed one-screen layout from
$2000. - Arbitrary arrangements come from TxSROM (a variant of the MMC3, iNES 119), the MMC5 and the Namco 163, and from mappers with ROM nametables.
- Unusual cases: Castlevania III and Laser Invasion use the third nametable RAM of the MMC5; After Burner uses the ROM nametables of Sunsoft-4 (iNES 68) but only supports 1, H and V arrangements; Mighty Morphin Power Rangers III and IV (JY Company) use ROM nametables in a three-screen horizontal layout, with the lower screen as the status bar.
Which layout for which scrolling
| Scrolling | Mirroring | Examples | Comment |
|---|---|---|---|
| None | any | Donkey Kong, Tennis | One fixed screen: any type will do. |
| Horizontal only | vertical | Super Mario Bros., Gimmick! | A status bar at the top is easy with a sprite 0 hit. |
| Vertical only | horizontal | Ice Climber, Gun.Smoke | Without a status bar horizontal mirroring is best; with one, vertical or single-screen give a place for the bar and the seam is hidden under it. |
| Alternating horizontal and vertical | mapper switches H/V | Metroid, Air Fortress | One axis at a time; the direction changes only when a new screen is reached. |
| Limited bidirectional | horizontal or vertical | Super Mario Bros. 3, Fire Emblem | One axis is limited to two screens. Unlimited horizontal scrolling gives unavoidable attribute glitches at one side; unlimited vertical scrolling can be hidden by NTSC overscan. |
| Unlimited bidirectional | various | Castlevania II, Battletoads, Crystalis, Final Fantasy | A game-specific solution. |
Status bars usually need a split at a timed place: most easily a mapper IRQ, or a sprite 0 hit. See scrolling internals.
Sources
The NESdev Wiki text is available under CC BY-SA 3.0. This page is written in our own words from the raw wikitext kept in samples/nes/sources/hardware. The wiki’s diagrams are pictures and are not copied. Which mapper switches which layout is on each mapper’s row on iNES: mappers.