NES / Guides

How a NES emulator works

Three short guides from my emulator project. Read the code, change something, and run it in the browser.

Start with the CPU if you are new to emulation. Each guide has a small program you can run without installing anything or finding a game ROM.

01

The 6502, for web developers

A couple of registers, a few bytes, and something you can actually run.

CPU · 8 min read
02

From a tile to your first NES background pixel

How the PPU turns sixteen bytes of tile data into an image of 8 by 8 pixels.

PPU · 9 min read
03

Memory-mapped I/O: when a write talks to hardware

STA always stores a byte. The address decides who receives it.

BUS · 8 min read

About these guides

I’m Matias Salles. I built a NES emulator, first in Ruby and then in Crystal, and wrote Building Your First Emulator while working through the project. These guides cover a few parts of that process. The book uses Crystal; the browser examples run on my Rust/WebAssembly port.

More of my projects on the blog · Source code (Crystal)