# NES Emulator — Play Online & Learn How to Build One > A fully playable NES emulator running in the browser, built from scratch and compiled to WebAssembly. Also the companion project for the book "Building Your First Emulator." Site: https://emulator.matiassalles99.codes ## What is this A NES (Nintendo Entertainment System) emulator that runs classic games directly in your browser. No downloads, no plugins — just load a .nes ROM file and play. It supports games like Super Mario Bros, The Legend of Zelda, Mega Man 2, Metroid, Contra, and dozens of other classics. Built from scratch with no emulation libraries. The emulator implements the full NES hardware stack: 6502 CPU (all 151 opcodes), PPU (Picture Processing Unit) for graphics, APU (Audio Processing Unit) for sound, and cartridge mappers for game compatibility. Compiled to WebAssembly for browser performance. Works on any modern browser that supports WebAssembly. ## The book This emulator is the project you build in "Building Your First Emulator" — a 280-page book that walks you through creating a NES emulator step by step, from a CPU that does nothing to running Super Mario Bros. The book covers: - All 151 CPU instructions of the 6502 processor, registers, flags, and interrupts - PPU graphics rendering pixel by pixel with just 2 KB of RAM - Real-time audio generation with the APU (square, triangle, noise waves) - Cartridge parsing (iNES format) and mapper implementation - Running real games: Mario, Zelda, Contra, and more Code first, theory after. Written in an informal, practical tone. No emulation or hardware experience needed. If you know Ruby, Python, or any similar language you can follow along — the book uses Crystal, which reads almost exactly like Ruby. Available in English and Spanish on Leanpub, both with free sample chapters. ## Controls - D-Pad: Arrow Keys - A button: Z - B button: X - Start: Enter - Select: Shift ## Author Matias Salles — software engineer, Ruby/Crystal developer. Born in Buenos Aires, raised in Montevideo, doing a master's in AI in Buenos Aires. ## Links - Emulator: https://emulator.matiassalles99.codes - Book (English): https://leanpub.com/nes-emulator-en - Book (Spanish): https://leanpub.com/nes-emulator-sp - Blog: https://matiassalles99.codes - Blog post about the book: https://matiassalles99.codes/posts/i-wrote-a-book/ - GitHub: https://github.com/matiassalles99