« NES / Famicom Architecture (index)

NES / Famicom Architecture

Chapter 4: CPU


Table of Contents

  1. A bit of context
  2. Core functionality
    1. Ricoh's licensing enigma
    2. Scrapped functions
  3. Memory
    1. Segmentation Fault
    2. Cartridge/game data
    3. Going beyond existing capabilities

The NES's CPU is a Ricoh 2A03 , which is based on the popular 8-bit MOS Technology 6502 and runs at 1.79 MHz (or 1.66 MHz in PAL systems). This is the central component that executes the code inside the game cartridge.

A bit of context

To understand the circuitry residing inside the NES' motherboard, we must first take a look at the state of the industry at the time. Interestingly, the CPU market in the late 70s and early 80s was quite diverse.

Image
A Commodore PET, carrying a 6502 CPU.

Image
A Tandy TRS-80, carrying a Z80 CPU.

The panorama of late-70s computers, also provided by The Centre for Computing History (Cambridge, UK).

If you were a startup aiming to build an affordable microcomputer for the western world, you had plenty of options available:

Faced with similar setbacks that Intel's employees went through, engineers at Motorola grew frustrated with the company's lack of interest in capitalising on the potential of the 6800 . So, they joined a small but ambitious silicon firm, MOS, where they worked on a redesigned version of the 6800 - the MOS 6502. While incompatible with the rest, the new chip was much, much cheaper to produce , and it was only a matter of time before iconic computer makers (Commodore, Tandy, Apple, Atari, Acorn, and so forth) chose the 6502 to power their machines.

Back in Japan, Nintendo needed something inexpensive yet familiar to develop for, so they selected the 6502. Ricoh, their CPU supplier, successfully produced a 6502-compatible clone.

Core functionality

To understand how capable this console is, let's first check what the original MOS 6502 offers:

As you can see, the remarkable engineering behind the 6502 allowed MOS to sell a compelling product at an extremely affordable price.

Ricoh's licensing enigma

How Ricoh managed to clone the 6502 isn't clear to this day. One would expect MOS to have licensed the chip design to Ricoh, but there are many contradictions to this:

Scrapped functions

The Ricoh 2A03 omits the Binary-Coded Decimal (BCD) mode originally included in the 6502 . BCD encodes each decimal digit of a number as a separate 4-bit binary. The 6502 uses 8-bit 'words' - meaning that each word stores two decimal digits.

As an example for the curious, the decimal number 42 is represented as:

We could go on and on talking about it, but to give an outline: BCD is useful for applications that require treating each decimal place separately (for instance, a digital clock). However, it requires more storage since each 8-bit word can only encode up to the decimal number 99 - whereas traditional binary can encode up to 255.

In any case, Ricoh deliberately broke BCD mode in its chip by severing the control lines that activate it. This was presumably done to avoid paying royalties to MOS, since BCD was patented by them (and the legislation that enabled copyrighting integrated circuit layouts in the United States wasn't enacted until 1984 ).

Memory

Both Ricoh 2A03 and MOS 6502 feature an 8-bit data bus and a 16-bit address bus, which allow them to access up to 64 KB of memory. So, how did Nintendo fill that memory space?

On one side, the motherboard contains a chip providing 2 KB of Static RAM (SRAM) . Nintendo calls this area 'Work RAM' (WRAM) and can be used to store:

On the other side, the components of the system are memory-mapped , meaning that they are accessed using memory addresses and therefore occupy part of the CPU's address space. Consequently, the Ricoh 2A03's memory space is filled with addresses pointing to the game cartridge, WRAM, the PPU, the APU and two controllers (don't worry about each component, as they are explained throughout this article).

Segmentation Fault

Inherited from MOS' design, this console also features a special 'anomaly' called Open Bus: If an instruction tries to read from an unmapped or invalid address, the last value read is supplied instead . If this goes unhandled by the program, execution may continue in an unpredictable state.

Cartridge/game data

Just in case you don't know, NES games are distributed in the form of cartridges, and the cartridge's buses connect directly to the CPU.

Nintendo wired up the cartridge lines in a way that only 49120 Bytes (~ 49.97 KB) of cartridge data can be accessed . Now, what do I mean by 'cartridge data'? Well, any chip connected to those buses, for instance:

The existence of different combinations stems from the fact that the CPU doesn't care about what kind of component it is reading from; it only sees memory locations. So, it is up to game studios to choose (or devise) a feasible layout to fit in their game.

Image
PCB of Super Mario Bros .

Image
The same PCB with important parts labelled. The meaning of the 'Lockout' chip is explained in the 'Anti-piracy' section.

For example, Nintendo's 'Super Mario Bros' used a layout they call NES-NROM-256 and consists of 32 KB of program ROM and 8 KB of 'Character ROM' for graphics (we'll see more about it in the 'Graphics' section) . NES-NROM-256 was also prepared to house up to 3 KB of extra WRAM, though the game doesn't make use of it.

Going beyond existing capabilities

One of the major limitations of 16-bit address buses (affecting 3rd and 4th-generation consoles) is their compact address space. Nowadays, 32-bit computers can address up to 4 GB of memory (and 64-bit machines lavishly enjoy up to 16 exabytes), so this is no longer a concern, but back then, the NES only had a 64 KB address space, and a significant portion was consumed by the memory-mapped hardware (something competitors avoided).

So, did this mean that game studios could only develop games that stayed within the 49.97 KB limit? Absolutely not! If history has taught us anything, it is that there's always a clever solution to a challenging problem, and this issue was tackled with a Mapper.

Image
Simplified representation of how a mapper extends the addressing capabilities of the CPU. With the inclusion of a mapper, the CPU can access extra banks (groups of addresses) of a large Program ROM. Although the game/program has the new task of manually switching between banks whenever needed.

Image
The same setup but without a mapper installed. While simpler and inexpensive, the CPU can only access a finite number of banks.

A mapper is an extra chip included in the cartridge that sits between the memory chips and the console's address lines. Its primary job is to extend the address space, allowing developers to fit more chips. This is achieved through bank switching: memory addresses are grouped into banks, and the mapper provides switches (controlled via memory addresses) to alternate between them. Now, the CPU still perceives the same amount of memory, so it is the game (programmed with a mapper present) in charge of operating it. Due to their cost-effectiveness, mappers were the order of the day in 80s-to-early-90s technology.

Image
PCB of Super Mario Bros 2 . Super Mario Bros 3 also uses this layout but bundles a 256 KB Program ROM instead.

Image
The same picture with important parts labelled. At first, I thought the extra WRAM was for storing saves, but then I realised there are no saves in this game (and there isn't a battery either). In reality, that RAM chip is used to store a decompressed level.

Back to the NES, games like 'Super Mario Bros 2' and 'Super Mario Bros 3' shipped with the 'MMC3' mapper (made by Nintendo) in their cartridges. For comparison, MMC3 provided up to 512 KB of space for the Program ROM, up to 256 KB for Character memory and up to 8 KB for extra WRAM . You can now see why 'Super Mario Bros 3' differs significantly in quality compared to the first instalment.

All in all, while this console may appear limited while examining its internal features, Nintendo made sure it could adapt as technology evolves. On the other side, while this technique helped to keep the costs of the console down, it shifted part of the burden to the game cartridge. So, game quality and cartridge costs were two concerns game studios had to balance.


Previous: 3. Models and variants

Next: 5. Graphics


Rodrigo Copetti © 2026 RSS Feed

Switch to modern edition

Home · Writings · Support · About author · About website