6502 by dbhqGitHub

All machines

NES

1983, Nintendo, Ricoh 2A03 at 1.79 MHz (NTSC), 2A07 at 1.66 MHz (PAL).

Acceptance test NesAcceptanceTests: 159 passing.

It models the picture, drawn a dot at a time as the PPU draws it; the sound unit's five channels; two controllers; NTSC and PAL; and six cartridge boards: NROM, MMC1, UxROM, CNROM, AxROM and MMC3.

An original Nintendo Entertainment System from the front left and a little above, on white: a light grey box with a darker grey lower half, the cartridge slot's lid on top with the red Nintendo Entertainment System name, the power light and the POWER and RESET buttons at the front left, and controller ports 1 and 2 at the foot of the black band on the right.
Photograph: an original Nintendo Entertainment System, the North American console, taken 27 July 2016.By Evan-Amos. Source: commons.wikimedia.org. Licence: Public domain. Changes: resized and converted to WebP for this page.

The machine

The picture is the machine's own, pixel for pixel, as its PPU draws it, in the region's pixel shape: 8:7 on NTSC, wider on PAL. It models the picture, not a television: no scan lines, glow, curve or colour bleed.

With the screen focused, the keyboard is controller 1: Up arrow, Down arrow, Left arrow and Right arrow for the d-pad, Z for B, X for A, right Shift for Select and Enter for Start. Tab moves on and Escape lets go, so the page never keeps the keyboard. Gamepads work too, in the browser's standard layout: the bottom face button is A, the left one B, the middle pair Select and Start. The first gamepad is controller 1, the second controller 2.

The NES runs in your browser and needs JavaScript. Without it, the page is shown, but nothing runs.

Sound is off.

The region

Each cartridge starts in the region its file names, or NTSC when the file does not say. Changing it restarts the machine.

The cartridge

Start puts Lan Master in.

Drop a .nes file on the page, or press Load a .nes file. It is read in this tab and is not uploaded anywhere. Reset starts the game again and keeps the cartridge's RAM; Power off and on clears it.

Saving is not built, so a page reload loses battery RAM: a game's saved progress is gone when the page is reloaded or closed.

The game in it is Lan Master, by Shiru, released into the public domain. Commercial games are not bundled and never will be: load your own. Full rights: Whose game this is.

The picture chip runs one dot at a time, three dots for every CPU cycle on NTSC, so it needs a fast computer to run at full speed. The line under the screen says how fast this browser runs it, measured while it runs, and a computer that cannot keep up runs it slower than the real console and says so. Making it faster is issue 67.

NTSC and PAL, the two regions

The NES was sold in two kinds, and both are here: NTSC, for North America and Japan, and PAL, for Europe and Australia, whose CPU runs slower and which draws 50 pictures a second rather than about 60. Each cartridge starts in the region its file names, or NTSC when the file does not say, and the line under the region control says which and why.

Try it

Start puts Lan Master, by Shiru, in the console and switches it on. The acceptance test boots the same cartridge, from the same file, and checks its first picture against the one recorded.

  1. Press Start on the page.

    The machine switches on with Lan Master in it. The title fades in within a second, and its music plays: the name in a blue band, PD2011 Shiru under it, and a menu of START, CODE, SFX and BGM with a blinking square by START.

  2. Press Start or A on the pad.

    START is chosen and the first level begins: a board of wire pieces and computers, with the level, how much is connected and the time along the top.

  3. Move the square with the D-pad and turn the pieces.

    A and B turn the piece under the square a quarter turn, one each way, and Select turns it half way round. Connect every computer before the time runs out.

  4. Press Start during a level.

    The game pauses, with RESUME, RESTART and MAIN MENU and the level's pass code. Enter that code under CODE on the title screen to carry on from that level later.

The controls in Lan Master
On the padWhat it doesOn your keyboard
D-padMoves the square on the board; in the menu, moves up and downUp arrow, Down arrow, Left arrow and Right arrow
ATurns the piece a quarter turn; in the menu, choosesX
BTurns the piece a quarter turn the other way; in the menu, choosesZ
SelectTurns the piece half way round; in the menu, moves downright Shift
StartPauses and shows the pass code; in a menu, choosesEnter

To play something else, load your own .nes file with the button under the screen, or drop it on the page. It is read in this tab and not uploaded. The machine runs cartridges on the six boards most of the library used. A file it cannot run is refused with the reason, and the game already in carries on.

About the NES

What is modelled, and what is not

Not modelled, each part with an issue that says what it would take:

  • The Dendy and the other Famicom clones: issue 61
  • The Famicom Disk System: issue 62
  • The Famicom's expansion audio: issue 63
  • The Zapper and other peripherals, the four-player adapters among them: issue 64
  • The unlicensed mappers, and the licensed ones beyond these six: issue 65
  • The analogue quirks of the picture, such as NTSC's colour fringes: issue 69
  • Saving the battery-backed RAM: issue 66

Saving is not built, so a page reload loses battery RAM: a game that saves its progress on the cartridge loses it when the page is reloaded or closed. The 3D models, the outside and the board, are a project of their own: issue 68.

The four photographs of the original, and their credits

Each is credited as its source gives it. Under each is what the 3D model took from it.

An original Nintendo Entertainment System from the front left and a little above, on white: a light grey box with a darker grey lower half, the cartridge slot's lid on top with the red Nintendo Entertainment System name, the power light and the POWER and RESET buttons at the front left, and controller ports 1 and 2 at the foot of the black band on the right.
Photograph: an original Nintendo Entertainment System, the North American console, taken 27 July 2016.By Evan-Amos. Source: commons.wikimedia.org. Licence: Public domain. Changes: resized and converted to WebP for this page.Used for the model: the outside model's front, top and left end, measured on the full-size original: the cartridge door, the vents, the buttons, the power light, the controller ports and the lean of the lower shell; the board model takes nothing from it.
An original Nintendo Entertainment System from above and behind, on white: the light grey top shell with a block of slotted vents at the left and the cartridge slot's flat lid to the right of it, over a darker grey lower shell, and in a recess at the lower left of the rear three connectors with short red words beneath: a round power socket, a small slide switch and a round socket with a white ring.
Photograph: the same North American console from above and behind, showing its rear connectors, taken 27 July 2016.By Evan-Amos. Source: commons.wikimedia.org. Licence: Public domain. Changes: resized and converted to WebP for this page.Used for the model: the outside model's rear, measured on the full-size original: its window, the places of the three connectors and their words, and the notch; and the lean of the lower shell, held out as a check.
The front of a PAL Nintendo Entertainment System's yellowed top shell, straight on against a pale background: a long cartridge slot lid at the left with the red words Nintendo and ENTERTAINMENT SYSTEM and, below them in italics, EUROPEAN VERSION, and a black band at the right.
Photograph: the yellowed top shell of a German (PAL) console, straight on from the front, taken 2 November 2022.By PantheraLeo1359531. Source: commons.wikimedia.org. Licence: CC BY 4.0. Changes: resized and converted to WebP for this page.Used for the model: the outside model's PAL console: its front words, including the line EUROPEAN VERSION, and a check of its front against the NTSC console's, measured on the full-size original.
The underside of a grey PAL Nintendo Entertainment System, model NESE-001, on an orange speckled carpet: two white labels, the larger at the upper left with the Nintendo Entertainment System name, German rating text and three marks (a house, TÜV GS and TÜV), the smaller at the right with the model, brand, a serial number heading with no number after it and a post office mark; four round feet near the corners, two vent grilles, the expansion port's cover and a black plate held by two screws at the bottom left.
Photograph: the underside of a German (PAL) console, the NESE-001, with its two labels, taken 2 November 2022.By PantheraLeo1359531. Source: commons.wikimedia.org. Licence: CC BY 4.0. Changes: resized and converted to WebP for this page.Used for the model: the outside model's PAL underside, measured on the full-size original rectified on its screw holes: its two labels and their words, the feet and the expansion port's cover.
Whose game this is

The NES has no system ROM: the console runs whatever cartridge is in it. Commercial games are not bundled and never will be: load your own, which is read in this tab and not uploaded. The cartridge Start puts in is Lan Master, a puzzle game by Shiru from 2011. He released it into the public domain in his own words, in its manual: "It is free of charge, released into Public Domain, and provided "as is", without warranty or responsibility of any kind." Its title screen says PD2011 Shiru. Our copy is the 2015 build, with rainwarrior's fix, from Shiru's own archive, lan_master.zip, as the Internet Archive kept it, because his own site's files could not be fetched on 6 October 2026. The address is https://web.archive.org/web/20160327132502id_/http://shiru.untergrund.net/files/nes/lan_master.zip; the SHA-256 is 79410cc133f1100d2fe5409fd49297a62afc748aeeb5faccb8fe69c68c16e6aa. It is kept in this repository under roms/ with where it came from, and checked by SHA-256 each time it is read.

The game is kept in the repository, in roms/, with where it came from. The site checks it against its hash when it is built, and serves it beside the emulator.