Skip to content

Repository files navigation

NES Emulator (in C++)

  • ✅ Added All 151 official opcodes with instructions.
  • ✅ Added Cartridge and Mapper000 support.
  • ✅ Added nestest to verify all 151 opcodes are working correctly.
  • ✅ Added PPU registers.
  • ✅ Added an SDL3 window and app loop.
  • ✅ Added PPU background rendering and scrolling.
  • ✅ Added controls.
  • ✅ Added PPU sprite rendering.
  • 🚀 First playable build!
    • Compatible with most Mapper000 ROMs (including Super Mario Bros.).
  • TODO: Add APU.
  • TODO: Add Mapper001 support.
  • TODO: Update README build instructions.
  • TODO: Improve performance.

emulator picture

Controls

NES Button Keyboard
A Z
B X
Select Left/Right Shift
Start Enter
Up Up Arrow
Down Down Arrow
Left Left Arrow
Right Right Arrow

Press ESC to exit the emulator.

Building and Running

Rendering uses SDL3, installed via vcpkg.

Prerequisites

  • A C++23 compiler:
    • Windows: MSVC / Visual Studio Build Tools with the "Desktop development with C++" workload
    • macOS: Xcode Command Line Tools (xcode-select --install), Xcode 16+ for full C++23 support
  • CMake and Ninja
    • macOS: brew install cmake ninja
    • Windows PowerShell: winget install -e --id Ninja-build.Ninja and winget install cmake
  • vcpkg, cloned and bootstrapped:
    git clone https://github.com/microsoft/vcpkg
    ./vcpkg/bootstrap-vcpkg.bat   # bootstrap-vcpkg.sh on Linux/macOS
    
  • The VCPKG_ROOT environment variable set to that clone's path

SDL3 itself does not need to be installed manually — it's declared in vcpkg.json and vcpkg installs it automatically on first configure.

Configure Build dir: cmake --preset default
Build app target: cmake --build cmake-build-debug --target nes_emulator
Run Emulator: ./cmake-build-debug/nes_emulator <rom_path>

Testing

Using doctest.h.

Build tests only: cmake --build cmake-build-debug --target nes_emulator_tests
Build and run tests: cmake --build cmake-build-debug --target run_tests

Resources

About

NES Emulator written in C++

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages