liveBook · Manning

Memory mapper

As explained in Classic Game Programming on the NES: Make your own retro video game

Hardware or logic in an NES cartridge that controls memory mapping and access to cartridge data.

A memory mapper is cartridge hardware or logic that controls which portions of cartridge memory the NES can access. It extends the console beyond its immediately available ROM space by swapping memory banks in and out of the addressable range. section 16.2.1

The NES can access only 64K of memory at once. A mapper selects different PRG ROM and CHR ROM sections when the program writes values to designated memory locations, allowing larger games and graphics sets. section 16.2.1

Depending on its design, a mapper can provide:

  • More space for program code and tile or sprite patterns. section 16.2.1
  • Additional sound capabilities and storage for saved progress through battery or EEPROM memory. section 16.5
  • Extra name-table RAM, extended attributes, or scanline interrupts for advanced graphics effects. section 16.2.4

Default mapper and read-only data

With the default mapper, two 16K ROM sections form one 32K accessible code area. Fixed values such as a palette and welcome text can be placed in the RODATA segment with .byte directives, while other mappers require additional sections to be swapped in and out. section 5.8

Figure 16.2 Example of expanded NES cartridge memory layout

Inspect the expanded cartridge layout to compare the standard NES memory arrangement with mapper-controlled additional sections. section 16.2.1

How Classic Game Programming on the NES: Make your own retro video game covers it

How deep it goes
Explains bank switching, selectable memory sections, and mapper features, but defers individual mapper configurations to further reference material.
Examples
Uses a default 32K ROM arrangement, a RODATA palette and welcome message, expanded cartridge layouts, extra name-table RAM, and scanline effects.
What it assumes
Assumes basic NES memory concepts and assembly sections while explaining mapper behavior from the console’s 64K address-space limit.
What you can do after
Operate mapper-controlled memory by selecting banks through designated memory locations and organizing fixed cartridge data in ROM segments.
How it connects
Connects memory mapping with bank switching, PRG ROM, CHR ROM, name tables, scanline interrupts, sound expansion, and EEPROM memory.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Classic Game Programming on the NES: Make your own retro video game. The section links point to the parts of the book it draws on.