tuanp.dev

Learn

Build something real, one working step at a time.

Free, long-form courses. Each part adds one thing that runs before you move on, and every part's code is there to compare with yours.

The finished emulator running paddle.nes: a brick wall around the edges, SCORE 001, a yellow ball and a blue bat.

Course · Rust · Emulation

Rust by building a NES emulator

Learn Rust and how a 1980s games console works, at the same time. You start with a three-byte program and finish with a processor, picture chip and controller that play a real cartridge.

For people who have written small programs in any language, but never Rust and never an emulator.

parts
20
lines of Rust
~1,200
per part
~1 hr
Start Part 1All 20 parts

All 20 parts

Milestones marked in blue.

  1. 01A CPU that can hold a numberComing Mon 30 Nov
  2. 02A CPU that can countComing Mon 30 Nov
  3. 03A CPU with a memoryComing Mon 30 Nov
  4. 04A CPU that can repeat itselfComing Mon 30 Nov
  5. 05A CPU that can walk through a listComing Mon 30 Nov
  6. 06Load a real cartridge fileComing Mon 30 Nov
  7. 07See the tiles hidden in the cartridgeComing Mon 30 Nov
  8. 08Put the picture on the screenComing Mon 30 Nov
  9. 09Open a real windowComing Mon 30 Nov
  10. 10Tidy the code into modulesComing Mon 30 Nov
  11. 11Check the CPU against a known-good oneComing Thu 3 Dec
  12. 12Teach the CPU every addressing modeComing Mon 7 Dec
  13. 13Subroutines and the rest of the flagsComing Thu 10 Dec
  14. 14Finish the instruction setComing Mon 14 Dec
  15. 15Keep time: sixty pictures a secondComing Thu 17 Dec
  16. 16Show the picture in colourComing Mon 21 Dec
  17. 17Things that move: spritesComing Thu 24 Dec
  18. 18Plug in a controller and playComing Mon 28 Dec
  19. 19Scroll a world wider than the screenComing Thu 31 Dec
  20. 20Get ready for other people's cartridgesComing Mon 4 Jan 2027