๐Ÿ“ฆ MaxwellKnight / nes-emulator

A 6502 microprocessor emulator for the Nintendo Entertainment System (NES) written in C++.

โ˜… 3 stars โ‘‚ 0 forks ๐Ÿ‘ 3 watching โš–๏ธ GNU General Public License v3.0
๐Ÿ“ฅ Clone https://github.com/MaxwellKnight/nes-emulator.git
HTTPS git clone https://github.com/MaxwellKnight/nes-emulator.git
SSH git clone git@github.com:MaxwellKnight/nes-emulator.git
CLI gh repo clone MaxwellKnight/nes-emulator
Your Name Your Name hotfix: added cpu base test case 741d91d 10 months ago ๐Ÿ“ History
๐Ÿ“‚ dev View all commits โ†’
๐Ÿ“ .github
๐Ÿ“ imgs
๐Ÿ“ include
๐Ÿ“ src
๐Ÿ“ tests
๐Ÿ“ web
๐Ÿ“„ .gitignore
๐Ÿ“„ CMakeLists.txt
๐Ÿ“„ docker-compose.yml
๐Ÿ“„ Dockerfile
๐Ÿ“„ LICENSE
๐Ÿ“„ README.md
๐Ÿ“„ README.md

6502 Online Debugger

An interactive 6502 microprocessor emulator and debugger for the Nintendo Entertainment System (NES), providing educational insights into retro computing. Available at codeknight.dev.

6502 Debugger Screenshot

Features

  • 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

Getting Started

The debugger is accessible online at codeknight.dev, but you can also run it locally or contribute to its development.

Prerequisites

  • Docker and Docker Compose (for containerized development)
  • Modern web browser with WebAssembly support

Local Setup

Quick Start

# 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.

Local Development (without Docker)

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

Usage Guide

Basic Operation

  • 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

Memory and Register Inspection

  • 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

Architecture

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

License

This project is licensed under the GNU GPL v3 - see the LICENSE file for details.