Nintendo Entertainment
System Documentation
Version 1.0
August 2004
Patrick Diskin
Abstract
Preface
The Nintendo Entertainment System (NES) was the world’s most widely used videogames
console during the 1980s. From its initial release in 1983 until it was discontinued in 1995 the
console brought gaming into more homes than ever before and paved the way for the
videogame industry as it stands today.
Although technology has improved dramatically since the NES, many excellent games were
only released on that format and so are unplayable on more modern systems. However
these games have been able to survive and continue to be played thanks to emulation, which
simulates the workings of one system in order to allow software created for it to be used on a
modern system.
This document describes both the hardware in the NES and some of the devices used with it.
It also briefly discusses emulation and issues relating to this. Much of the contents of this
document appeared earlier in [1].
The document makes use of the hexadecimal and binary numbering systems. The reader is
assumed to have some knowledge of these numbering systems but a brief explanation of
some issues is presented in Appendix A.
Acknowledgements
The information contained within this document is based on the work of the many others
involved in NES emulation. I would like to acknowledge the authors of all the documents
listed in the References section but particularly:
• Andrew John Jacobs for his invaluable information on the 6502 processor [2], [3] and [4].
• Chris Covell for ‘NES Technical / Emulation / Development FAQ’ [5].
• Firebug for ‘Comprehensive NES Mapper Document’ [6].
• Jeremy Chadwick for ‘Nintendo Entertainment System Documentation’ [7].
• Loopy for ‘The Skinny on NES Scrolling’ [8].
• Marat Fayzullin for ‘Nintendo Entertainment System Architecture’ [9].
• Everybody involved with nesdev.parodius.com.
2
1 - Introduction
1.1 Nintendo Entertainment System History
In 1889, Fusajiro Yamauchi founded Nintendo Koppai and began manufacturing Japanese
playing cards, hanafuda, in Kyoto [10]. By 1950, when Hiroshi Yamauchi became president,
Nintendo was a successful manufacturer of both western and Japanese playing cards. In
1963, after several name changes, the company settled on Nintendo Co. Ltd. (NCL). By
1970, the company was producing electronic games and in 1973 they introduced a laser clay
shooting system which they hoped would replace bowling as a major pastime [11].
Nolan Bushnell was a student at the University of Utah when he first had the idea of a coin
operated computer game. Pong, which was released in 1972, quickly became a hit and
inspired the release of a wave of arcade games. Bushnell’s company, Atari, wanted to
replicate this success by releasing a system to play games in homes. By 1976 several
companies had tried, and failed, to release a successful console. Bushnell was aware that
Atari lacked the capital to produce a console and sold the company to Warner
Communications, retaining the position of chairman [12].
In 1977, Atari released the Atari Video Computer System (VCS), an 8-bit console which
succeeded in opening up the home console market, aided by the home version of Space
Invaders, released in 1980. Bushnell disagreed with the direction Warner were taking and left
the company in 1978.
In 1979, Nintendo made their first attempt to break into the arcade game market but by 1981
their success had been limited. Hiroshi Yamauchi asked Nintendo graphic artist, Shigeru
Miyamoto, to design a new game. The result was Donkey Kong in which players controlled a
carpenter called Jumpman and tried to rescue a captive girl from Donkey Kong, a large ape.
Jumpman was renamed Mario after the landlord of Nintendo’s newly created American
subsidiary, later to be called Nintendo of America Inc. (NOA), run by Yamauchi’s son in law,
Minoru Arakawa.
By 1982, third party development had led to several sub-standard games being released for
Atari’s VCS and competition with other consoles was leading to saturation of the market. By
1984 the industry was suffering enormous losses and most product lines were discontinued.
Nintendo, meanwhile, had enjoyed success in the arcade market and in the home market
with the Colour TV Game 6. The Japanese console market was still doing well and Yamauchi
felt that Nintendo could become the market leaders through a combination of quality games
and improved hardware sold at a lower price than competitors (profit would be made on the
games).
Figure 1-1. The Nintendo Entertainment System and the Famicom [13].
3
The Famicom (Family Computer) became an enormous success in Japan and in 1983,
Minoru Arakawa offered Atari the chance to produce the system in America. When it became
clear that Atari did not have the resources to proceed the deal fell through. Atari was divided
up and sold by Warner while Nintendo decided to produce and market the Famicom in
America themselves under the name Nintendo Entertainment System (NES). The console
was also redesigned to appeal to western children as shown in figure 1-1.
Despite early resistance from retailers fearing further losses after the industry crash the
previous year, the NES became available in America in 1985. As a result of strict quality
controls on third party software, combined with Nintendo’s own games (including Super
Mario Bros., The Legend of Zelda and Metroid) the console became a huge success.
In 1987, the NES became the top selling toy in America, while The Legend of Zelda became
the first NES game to achieve sales of one million units. In America alone, revenues for
Super Mario Bros. 3 were in excess of $500 million with over 7 million units sold and 4 million
in Japan [14]. In 1991, Nintendo earned about $1.5 million for each of its 5,000 employees.
The company’s profit in the early 1990s exceeded that of the American film industry. Such
was Nintendo’s effect on American culture that a 1990 survey showed that Mario was more
recognized by children than Mickey Mouse.
Sega released the 16-bit Genesis (Mega Drive in Europe) in 1989 and, due to the success of
Sonic the Hedgehog, the console became very popular. That same year, Nintendo were
busy with the release of their handheld console, the Game Boy but would enter the 16-bit
market with the Super Famicom in 1990. The console was released in America in 1991 as
the Super Nintendo Entertainment System (SNES) and due to incompatibility with the NES
hardware, signalled a move away from the old system.
Figure 1-2. Redesigned NES
released in 1993 [15].
In 1993, Nintendo released a redesigned version of the NES (as shown in figure 1-2) but the
last NES game, Wario’s Woods was released in late 1994 and the system was officially
discontinued in 1995 [16]. By this time over 60 million NES consoles and 500 million games
had been sold worldwide.
The SNES featured a 65816 processor which was largely compatible with the NES’ 6502
processor. However the graphics and sound on the new system were incompatible [5]. This
made it impossible for games created for the old system to run on its successor. As a result
the software created for the NES could no longer be used by people who did not already
4
have a NES, preventing many people from using the software. In addition, all hardware has a
limited lifespan and eventually there will be no working NES consoles to still play the games
on. The games themselves often featured battery backed RAM to enable progress to be
saved and Nintendo only predicted the battery life as five years. There are multiple options
which allow the continued use of NES games and these are described here.
1.2 Conversion
Although the exact implementations of computer systems is different, many of the principles
are the same. A PC cannot execute the instructions written for the NES because it does not
understand them. However, it is likely that comparable instructions do exist for the PC.
Therefore, it is possible to rewrite the software for a different system and to replicate the
graphics and sound of the original. Converting the software in this way is essentially
simulation [17]. The software appears to behave the same as the original but the
implementation may be quite different.
Converting the software has the advantage that the resulting software will perform well, since
it is produced for the target architecture. However, the process is time consuming and needs
to be done for each game individually.
1.3 Emulation
Emulation is the process of simulating hardware to enable the software developed for it to be
used on an otherwise incompatible system. The following definition is by the British
Computer Society and is taken from [18]:
“Emulation is a very precise form of simulation which should mimic exactly the
behaviour of the circumstances that it is simulating. An emulator may enable
one type of computer to operate as if it were a different type of computer.“
Emulation is often used by the videogame industry to allow developers to begin writing
software for a new system before it is released. However, it can also be used to allow the
continuing use of old systems.
Hardware emulation involves producing a system with hardware compatible with the original.
In the case of the NES it would be possible to produce a system using a compatible
processor and to allow it to play the original game cartridges. This technique can also
provide good performance, provided compatibility is ensured, but few people have the skills
and resources required to construct the system.
Using hardware simulation software it is possible to half implement this technique. Software
is available which allows simulation of a detailed hardware design and this can be used to
recreate the system from a design without having to produce a real implementation. Such a
system is described in [19].
Software emulation requires producing software which will emulate the functions of a given
system. There are three approaches to software emulation [17]:
•
Interpretation involves reading in the next instruction for the system being emulated,
translating it to an instruction (or a number of instructions) for the target architecture and
executing it. Though this is accurate, due to translating during execution the process can
lead to noticeable degradation of performance compared to the original system if the
speed of the target system is low.
5
• Static translation involves reading in the whole of the source program and translating it
for the target system, producing a program that is executable on that system. However it
is not always possible to determine how a program will execute from a static analysis of
it. Branch instructions, for example, often depend on the contents of memory locations
which can only be determined at run-time [20].
• Dynamic translation works in much the same way as static translation but occurs while
executing the program. This allows it to account for branch and jump instructions and to
produce accurate code [20].
The NES is perhaps the most widely emulated console with a number of emulators already
available of varying quality. Writing a NES emulator remains a very challenging project,
requiring a detailed understanding of how the system works. A fairly comprehensive list of
available NES emulators can be found at [21] although many of these have been
discontinued. The basics of writing an emulator are described by [17] and [22], both of which
focus specifically on the NES.
1.4 Legal
Emulation is considered to be something of a legal grey area. Emulators are not illegal,
provided all the information used in the development is legally obtained and does not contain
any proprietary code. However, it is illegal to run any software which you do not own a
licence for.
Copying NES games is possible with the correct hardware. Such copiers dump the contents
of the game cartridges to a disk to enable access by a computer. There are a wide variety of
copiers, which function in different ways. Figure 1-3 shows ChameleonNES which copies the
contents of a cartridge to a PC via a USB port. Copyright law typically allows for a backup
copy to be made, however this does not apply to games stored on permanent semiconductor
chips such as those used by the NES. These copying devices are illegal.
Figure 1-3. ChameleonNES cartridge copier [23].
Most emulator users download games from the Internet since they do not have access to the
required copying hardware. These websites usually cover themselves with an agreement
that you can only download a file if you own the original game or if you will delete it within 24
hours. This may make the process look legal but, since the copies are illegal, it is clearly not.
Even if the law allowed for making a backup copy of a NES game, copies can only be made
and used by the original owner, so downloading files off the Internet would still be illegal.
6
Processing Unit
This only applies to games which were originally made for the NES itself. Many developers
have produced games since which have been released freely on the Internet. Downloading
these is acceptable. As for original NES games, using them will remain illegal until either the
developers grant permission for their use or the copyright expires, which is 75 years after
they were made.
Nintendo are very much against emulation. The company acted against the developers of
UltraHLE [24], an emulator for their Nintendo 64 console, which they claimed violated
copyright. Nintendo’s objection was understandable as the console was still in use when
UltraHLE was released. The presence of Nintendo 64 emulators represented a threat to
Nintendo’s income however, many believe that the law should make an exception for
systems which are no longer in production and from which Nintendo no longer make any
money. Despite emulation’s ability to keep old games alive Nintendo refuse to release the
copyright on old games so their use remains illegal.
For more information on the legal issues of emulation, the reader is directed to Nintendo’s
own FAQ on the subject [25]. This is highly biased and ignores the legal uses of emulation.
For a detailed response and clarification on this, the reader should look at [26].
1.5 NES Hardware Overview
Hiroshi Yamauchi’s
to
design a console which would be
cheaper than the competition resulted in
Nintendo deciding to use an outdated
Central
(CPU).
Although a 16-bit processor would have
coped with ease, to keep the price low
they decided to use a variant of the 8-bit
6502 processor, developed by MOS
technology in 1975. The chip would be
sufficient to run the programs but would
be unable to generate the graphics
required so the company decided to use
a second chip as a dedicated Picture
Processing Unit (PPU), responsible for
calculating and displaying the graphics.
Figure 1-4 shows
the
motherboard with the CPU and PPU
indicated.
Nintendo designed the basic features required from the chips but found it difficult to find a
company willing to produce such highly customised chips for the low price they were looking
for. Ricoh agreed to manufacture the chips after Nintendo guaranteed them a three-million
chip order. By the end of 1986 Nintendo was Ricoh’s largest customer, accounting for
between 60 and 70 percent of the company’s semiconductor sales [10]. The functionality of
the CPU is discussed in Part 2, that of the PPU is discussed in Part 3.
Both chips feature their own internal memory, in the form of RAM. Games were usually
stored on ROM chips within the game cartridges, which could be accessed by the CPU when
the cartridges where inserted into the system. The hardware used for games is discussed in
Part 4.
The NES used memory mapped I/O to allow the processor to communicate with the other
components, the PPU and the input devices. Memory mapped I/O is a technique where data
Figure 1-4. The NES motherboard [27].
the
top of
instructions
PPU
CPU
7
can be transferred to a device via a write to a specific location in memory. Input devices are
discussed in Part 5, the function of the memory mapped I/O is discussed throughout the
document and specifically in Appendix B.
8