Skip to content

Nintendo Entertainment System

The Famicom, and the grey box it became

Nintendo's 8-bit console launched in Japan as the Famicom in July 1983 and reached America as the NES in 1985-86. A 6502-based Ricoh CPU, a tile-and-sprite picture chip and a lockout chip in every console made it fast to play, strict to program and tightly controlled. Nintendo counts 61.91 million sold.

When Mattel launched the Nintendo in Britain in the summer of 1987, CRASH opened its review by marvelling at the size of it: “no larger than a lunch box”, lighter than a Spectrum power pack, “and yet the Nintendo features 52 colours, 256 by 240 pixel resolution and 64 sprites”. By then the machine was four years old. Nintendo had launched it in Japan as the Family Computer, or Famicom, on 15 July 1983, and CRASH passed on the rumour that it had sold about ten million there.

The Famicom was built to be cheap. Its lead designer, Masayuki Uemura, recalled in a 2013 interview that the team had to make severe cuts to the parts list to bring the price down to ¥14,800. Inside were two custom chips made by Ricoh: a 6502 processor with a sound generator on the same die, and a picture chip that assembled the screen from tiles and sprites by itself. The result played what CRASH called “virtually flawless arcade conversions”, and it demanded a particular discipline from anyone who programmed it.

Nintendo counts 61.91 million Famicoms and NESes sold worldwide, and 500 million games.

Fast facts

  • Launch: Japan, 15 July 1983 (Famicom, ¥14,800). USA, New York test market autumn 1985, national release 1986. Britain, summer 1987 (Mattel, £129.99, soon cut to £99.99).
  • CPU: Ricoh 2A03 (NTSC) or 2A07 (PAL), a 6502 core at 1.79 MHz or 1.66 MHz, with decimal mode disabled.
  • RAM: 2K of work RAM, plus 2K of video RAM for the background maps.
  • Graphics: Ricoh 2C02 (NTSC) or 2C07 (PAL) picture processing unit (PPU). 256×240 pixels, 52 colours, 64 sprites with no more than eight on a line.
  • Sound: five channels built into the CPU chip (APU): two pulse, one triangle, one noise and one sample channel.
  • Media: ROM cartridges, which could carry their own bank-switching hardware.
  • Designer: a Nintendo team led by Masayuki Uemura.
  • Sales: 61.91 million consoles (Nintendo’s figure).

From Famicom to NES

The Famicom was red and white. Uemura recalled that the plan had been a cheap steel case, abandoned because it was too weak, and that the red was the company president’s choice: “He often wore a scarf with a similar color because he said it was his favorite.” One of its controllers had a microphone built in, which some games used; in Kid Icarus a player could haggle with shopkeepers by speaking to them. A keyboard and a Family BASIC cartridge let owners write their own programs. In February 1986 Nintendo added the Famicom Disk System, which put games on rewritable disks.

America was harder. The home video game market there had collapsed in the 1983 crash, and shops did not want another console. Nintendo of America redesigned the machine as a grey box with a front-loading slot, renamed it the Nintendo Entertainment System, and called its cartridges “Game Paks”. To reach toy shops it packed in a light gun, the Zapper, and a toy robot, R.O.B. In the autumn of 1985 it test-marketed the machine in the New York area. Sales there disappointed; a test in Los Angeles in February 1986 did better, and the NES went on sale nationwide during 1986.

R.O.B. had no cable. In Gyromite, the second controller sat in the robot’s base, and the robot received its orders from the television: “The screen flashes to indicate that data has been sent,” CRASH explained, and R.O.B. moved left, right, up or down to press the controller’s buttons with spinning tops.

The NES also carried a lockout chip, the 10NES. A matching chip in every licensed cartridge had to answer it correctly, or the console held itself in reset and the power light blinked. The Famicom had no such chip. As Compute!’s Gazette explained in 1990, “Nintendo game cartridges must contain a proprietary chip. Since Nintendo is the only producer of this chip, it’s able to control the quality of the games produced for the NES.” Nintendo also made the cartridges. Retro Gamer’s 2005 history of the machine describes the terms that came with that control: Nintendo decided how many copies of a game were made and how many games a publisher could release each year, and it required NES games to stay exclusive to the console for five years. David Sheff, who worked from the licence terms, gives a shorter period: a licensee could not release a game on any other system “for two years from the time they were introduced”. Tengen, a label of Atari Games, found a way round the chip, and Atari Games sued Nintendo, alleging that it was a monopoly.

Arriving late in Britain

Mattel put the machine into British shops in mid-1987, four years after the Famicom. Through 1986 the British press wrote about it as something still to come. In October 1986 a Your Computer reader asked when it would be available in the UK, and in December the magazine could only guess that it would be “probably in the region of £100”. The launch advertisement ran in CRASH, ZZAP!64 and The Games Machine through 1987: “For the first time in the UK direct from Japan comes Nintendo”. It claimed that 9½ million Japanese homes had one and that 27 Game Paks were available in the UK.

The basic set cost £129.99 with Super Mario Bros., which according to CRASH had “sold almost six million copies to date”. The deluxe set cost £199.99 with the Zapper, R.O.B., Gyromite and Duck Hunt. The prices did not last. In the same issue that carried its review, CRASH’s news pages reported the basic set cut to £99.99 and the deluxe to £155, “following trade criticism of the high original prices”.

CRASH’s reviewers did not agree about it. Ciaran Brennan found the machine “ugly and childish” and the software “pretty dismal”, mostly “variations of the Donkey Kong theme”. Michael Dunn thought it “one of the better things to have happened to the games world recently”. Roger Kean asked why a Spectrum owner should buy one, and answered that it was worth it if “virtually flawless arcade conversions” were what you wanted. Otherwise, he wrote, the Spectrum had original games of its own, such as The Sentinel and Head Over Heels. Mattel’s line was that the software so far used “approximately 20% of the machine’s capabilities”.

Technical specifications

Processor: the 2A03

The Ricoh 2A03 (NTSC) and 2A07 (PAL) contain a 6502 core. It runs at 1.789773 MHz in NTSC machines, the 21.477 MHz master clock divided by twelve, and at 1.662607 MHz in PAL machines, which divide a 26.6 MHz master clock by sixteen. The same chip holds the sound generator, the controller ports and a DMA unit for copying sprite data.

Registers and addressing modes are the 6502’s, so code written for the Commodore 64 or BBC Micro looks familiar. The exception is decimal mode. SED and CLD still set and clear the D flag, but ADC and SBC ignore it, so binary-coded decimal arithmetic has to be done by hand. Game scores are often stored one decimal digit per byte for this reason.

Memory map

The CPU sees 2K of work RAM, mirrored four times up to $1FFF.

Address Contents
$0000-$00FF Zero page
$0100-$01FF Stack
$0200-$07FF General RAM; many programs keep a copy of sprite memory at $0200
$2000-$2007 PPU registers, mirrored up to $3FFF
$4000-$4017 APU, sprite DMA and controller registers
$4020-$FFFF Cartridge: PRG ROM from $8000, optional PRG RAM at $6000-$7FFF, mapper registers
$FFFA-$FFFF NMI, reset and IRQ vectors

The CPU cannot see video memory. Everything on screen is reached through eight PPU registers.

Graphics: the PPU

The Ricoh 2C02 (NTSC) and 2C07 (PAL) draw a 256×240 picture. NTSC televisions usually crop some of the top and bottom lines.

  • Background: a nametable of 32×30 tile numbers, plus an attribute table that chooses one of four palettes for each 16×16-pixel area. Tile shapes come from pattern tables in CHR ROM or CHR RAM on the cartridge. There is no built-in character set.
  • Scrolling: the PPU scrolls smoothly in both directions, pixel by pixel. Ricoh’s specification describes a scrolling area of four screens, but the console has video RAM for only two nametables; cartridges wire it as horizontal or vertical mirroring, or add more.
  • Sprites: 64 in object attribute memory (OAM), 8×8 or 8×16 pixels, each four bytes: Y position, tile number, attributes (palette, flips, priority) and X position. Only eight can appear on one line. Ricoh’s specification states that limit as a design parameter. The PPU has a status flag meant to signal more than eight on a line, but a hardware bug makes it unreliable, giving “both false positives and false negatives”.
  • Colours: a six-bit colour code, with 52 distinct colours: twelve hues at four brightness levels, plus four monotone shades. Both Ricoh’s specification and Mattel’s launch material gave 52. Thirty-two bytes of palette memory at $3F00 choose the colours for four background palettes and four sprite palettes, three colours each plus a shared background colour.
  • Sprite 0 hit: bit 6 of $2002 is set when an opaque pixel of the first sprite overlaps an opaque background pixel. Programs wait for it to change the scroll partway down the screen, so a status bar stays still while the playfield scrolls.

Video memory is reached through $2006 (address, written twice) and $2007 (data). With rendering on, it is safe to write only during vertical blank. The PPU can raise a non-maskable interrupt (NMI) when vertical blank begins, if bit 7 of $2000 is set.

Sound: the APU

Built into the 2A03:

  • two pulse channels with envelope and pitch sweep
  • a triangle channel, often used for bass
  • a noise channel for drums and explosions
  • a delta modulation channel (DMC) for sampled sound

Registers sit at $4000-$4013, with channel enables at $4015 and the frame counter at $4017. Famicom cartridges could add their own sound chips, such as Konami’s VRC6, because the Famicom’s cartridge slot has an audio input. The NES’s slot does not. Konami’s Akumajō Densetsu has two extra pulse channels and a sawtooth wave on the Famicom; its Western release, Castlevania III, was rebuilt with a Nintendo mapper and plays through the 2A03 alone.

Cartridges and mappers

The cartridge supplies the program (PRG ROM, at $8000-$FFFF) and the graphics (CHR ROM or RAM, feeding the PPU’s pattern tables). With only 32K of program space and 8K of graphics space in view, larger games carry a mapper that bank-switches ROM in and out. See Bank switching.

  • NROM (mapper 0): no banking; 16K or 32K PRG, 8K CHR. Super Mario Bros. fits in 32K of program and 8K of graphics.
  • MMC1 (1): a Nintendo memory management controller, loaded one bit at a time through a serial register.
  • UxROM (2) and CNROM (3): cheap boards that switch program or graphics banks.
  • MMC3 (4): program and graphics banking plus an interrupt counter for split screens. It is usually called a scanline counter. In fact it counts rising edges on PPU address line A12, which comes out at one per line when sprites and background use different pattern tables.
  • MMC5 (5): a Nintendo mapper with extra RAM, a palette choice for every tile and expansion sound (heard only on a Famicom).

Battery-backed RAM on the cartridge let the cartridge version of The Legend of Zelda save three games. In Japan, Metroid came out on the Disk System and saved to disk; its Western cartridge release used a password system instead.

Controllers

Two ports, read one bit at a time through $4016 (player 1) and $4017 (player 2). Writing 1 then 0 to $4016 latches the buttons; eight reads then return A, B, Select, Start, Up, Down, Left and Right. Other controllers included the Zapper, the Power Pad mat, R.O.B. and the Famicom’s microphone.

Programming the machine

Assembly only

The NES has no built-in language. A cartridge starts at the address in the reset vector, and games were written in 6502 assembly language that drove the PPU and APU through their registers. The code was written and assembled on other computers. In November 1987 Computer and Video Games reported that one development system in use was “the Commodore 64 with an interface board”.

Today the usual tools are the ca65 assembler and ld65 linker from the cc65 suite, or NESASM, producing iNES cartridge images for emulators and flash cartridges.

The frame loop

NES code is organised around the frame. With NMI enabled, the handler runs as vertical blank begins, updates the screen while it is safe to do so, and returns; the main loop runs the game and then waits for the next NMI.

The window is short. An NTSC frame has 20 lines of vertical blank, about 2,270 CPU cycles. Copying all 256 bytes of sprite memory through the DMA register at $4014 stops the CPU for 513 or 514 of those cycles, nearly a quarter of the time. Programs therefore prepare their screen changes during the frame, in a buffer, and copy them during vertical blank. PAL machines have 70 lines of vertical blank, so a routine that barely fits on an NTSC console has room to spare on a PAL one.

Starting from nothing

Before anything appears, a program has to wait for the PPU to warm up, load its palettes, fill a nametable and switch rendering on. There is no character set in ROM and no text mode. The PPU makes smooth scrolling and moving sprites cheap, and in return it makes the programmer set up everything it draws.

Quirks and limitations

Sprite flicker

The PPU draws only eight sprites on a line. A ninth, and any after it, are not drawn. Games with more objects in a row rotate which ones are drawn each frame, so every object is visible some of the time. The resulting sprite flicker is a familiar part of how NES games look.

The attribute grid

The attribute table chooses a palette for each 16×16 area, not for each 8×8 tile, so each block of four tiles shares its colours. One attribute byte covers a 32×32 area as four 2-bit fields. NES artists drew their backgrounds on this grid, much as Spectrum artists drew around attribute clash.

Scroll and address share a latch

$2005 (scroll) and $2006 (VRAM address) share the PPU’s internal registers, and reading $2002 resets the toggle that decides which byte comes next. A program that writes to video memory has to set the scroll again afterwards, or the screen jumps.

No way to wait

The 6502 has no instruction that waits for an interrupt, so the main loop has to spin. A program that forgets to loop runs on into whatever bytes follow and can reach one of the undocumented opcodes that halt the CPU until reset.

Modern legacy

  • Emulation: Mesen is accurate and has an extensive debugger. FCEUX is widely used for tool-assisted runs. MiSTer FPGA cores recreate the hardware.
  • Homebrew: new NES games are written with cc65/ca65 and NESASM, composed in trackers such as FamiTracker, and played on real consoles from flash cartridges. The NESdev community documents the machine cycle by cycle.
  • Reissues: Nintendo released the Classic Mini NES and Famicom in 2016, and its Switch Online service includes a library of NES games.

Sources

  • Nintendo news release, 30 September 2016: the Family Computer’s Japanese release on 15 July 1983 and over 60 million sold (web). https://www.nintendo.co.jp/corporate/release/2016/160930.html
  • Nintendo Co., Ltd., Investor Relations, “Dedicated Video Game Sales Units”: 61.91 million consoles and 500.01 million games (web). https://www.nintendo.co.jp/ir/en/finance/hard_soft/index.html
  • “Famicom creator Masayuki Uemura had no faith in the game system’s success”, SoraNews24, 30 April 2013, reporting an interview in Shūeisha’s Shupure News: parts cuts to reach ¥14,800, the abandoned steel case and the red colour (web, secondary). https://soranews24.com/2013/04/30/famicom-creator-masayuki-uemura-had-no-faith-in-the-game-systems-success-colored-it-after-his-boss-scarf/
  • N64 Magazine issue 2, May 1997, Nintendo history feature: the Famicom built by a team led by Uemura; 500,000 sold in its first two months.
  • David Sheff, Game Over (1993; GamePress edition, 1999), chapter 10, “Game Masters”: the licence’s five games a year and two years’ exclusivity.
  • Retro Gamer issue 16, 2005, “The Family Computer” (John Szczepaniak) and the accompanying NES feature: the controller microphone and its use in Kid Icarus, Family BASIC and keyboard, the Disk System (February 1986), Metroid’s password system; the NES redesign, R.O.B., the Zapper and “Game Paks”; the national release in 1986; Nintendo’s control of cartridge manufacture, release numbers and exclusivity; the lockout chip; twenty years of production.
  • Retro Gamer issue 100, March 2012, p. 95: the New York test market in autumn 1985 and the Los Angeles test in February 1986.
  • Compute!’s Gazette, April 1990: the proprietary chip in every cartridge, and Tengen’s reverse-engineering and lawsuit.
  • Your Computer, October 1986 (letters) and December 1986: the NES as a forthcoming machine, “probably in the region of £100”.
  • CRASH issue 41, June 1987, and ZZAP!64 issue 27, July 1987: Nintendo launch advertisement, with 9½ million homes in Japan, 27 Game Paks and the £129.99 and £199.99 sets. The same advertisement ran in The Games Machine issue 1, October 1987.
  • CRASH issue 42, July 1987, pp. 102-103: review of the console, R.O.B. and Gyromite, the reviewers’ verdicts, Mattel’s “20%” claim; the news pages of the same issue report the price cuts.
  • Computer and Video Games issue 73, November 1987: the Commodore 64 development system, and “around eight million units in use”.
  • NESdev Wiki, pages “CPU”, “PPU”, “PPU registers”, “PPU OAM”, “PPU sprite evaluation”, “PPU palettes”, “PPU frame timing”, “APU”, “Standard controller”, “CIC lockout chip”, “MMC3” and “List of games with expansion audio” (community reference, web, secondary). https://www.nesdev.org/wiki/
  • Ricoh development specifications KA-A002-B (RP2C02) and KA-A003-B (RP2A03), October 1982, revised December 1982 (unpublished): the 6502 core and clock, 64 objects with eight per line, 52 colours as 48 plus four monotone, the four-screen scrolling area, and the scroll and address registers sharing one latch.

See also

Checked. Verified against primary sources and signed off by a person.