An interactive 6502 microprocessor emulator and debugger for the Nintendo Entertainment System (NES), providing educational insights into retro computing. Available at codeknight.dev.
- Full 6502 CPU Emulation: Accurately emulates all official 6502 opcodes and addressing modes
- Interactive Debugging: Step-by-step execution with register and memory inspection
- Memory Visualization: Real-time view of memory contents and changes
- Cross-platform: Runs in any modern browser thanks to WebAssembly
The debugger is accessible online at codeknight.dev, but you can also run it locally or contribute to its development.
- Docker and Docker Compose (for containerized development)
- Modern web browser with WebAssembly support
# Clone the repository
git clone https://github.com/MaxwellKnight/nes-emulator.git
cd nes-emulator
# Start development environment with web server
docker compose --profile dev up web-dev
# Build everything (native + WebAssembly)
docker compose run --rm dev
# Run tests
docker compose run --rm test
# Get an interactive shell
docker compose run --rm shell
Access the application at http://localhost:5173 during development or through the configured domain in production.
For those who prefer developing without containers:
-
Requirements:
- C++17 compatible compiler
- CMake 3.14 or newer
- Google Test framework
- Emscripten SDK (for WebAssembly compilation)
-
Building:
mkdir build && cd build cmake .. make
- Navigate to codeknight.dev
- Use the "Load ROM" to upload a binary or paste 6502 compiled binary code and click "Load Opcods"(online assembler masswerk.at)
- Use the debugger controls to:
- Step through code one instruction at a time
- Run code until a breakpoint
- Reset the emulator state
- The register panel shows current values of A, X, Y, SP, and status flags
- Memory can be viewed and edited in the memory panel
- Watch specific memory addresses by adding them to the watch list
The emulator is built with a focus on accuracy and educational value:
- Core 6502 CPU emulation written in C++
- WebAssembly compilation for browser execution
- Modern front-end interface built with HTML/CSS/JavaScript
This project is licensed under the GNU GPL v3 - see the LICENSE file for details.