A Nintendo Entertainment System emulator written in C.
This is an implementation of the NES console developed and manufactured by Nintendo. The UI is built with Dear ImGui (via cimgui) and rendered through OpenGL 3.3, using SDL2 for windowing, input, and audio.
- Accurate emulation of the 6502 CPU, PPU, and APU
- Audio output with individual channel control (Pulse 1, Pulse 2, Triangle, Noise, DMC)
- Save states written automatically alongside the loaded ROM (
.nsaveformat) - Keyboard and gamepad (SDL GameController) input support
- Integrated debugger with:
- Step-by-step CPU execution and single-cycle stepping
- Breakpoint support
- CPU register viewer
- Memory viewer
- Pattern table, palette, sprite (OAM), and nametable viewers
- Audio channel waveform inspection
| Mapper | Name |
|---|---|
| 000 | NROM |
| 001 | MMC1 / SxROM |
| 002 | UxROM |
| 003 | CNROM |
| 066 | GxROM / MxROM |
| Library | Description |
|---|---|
| SDL2 | Windowing, input, audio |
| cimgui | C bindings for Dear ImGui (immediate-mode UI) |
The build system uses nob (a single-header C build tool).
Prerequisites:
- A GCC toolchain for Windows (e.g. MinGW-w64) with
g++available onPATH.
Steps:
- Compile the build tool (only needed once, or after
nob.cchanges):g++ -o nob.exe nob.c - Run the build:
nob.exe
The output binary is build/nes.exe. SDL2.dll is copied next to it automatically.
| Key | NES Button |
|---|---|
| Arrow keys | D-Pad |
A |
B |
S |
A |
Space |
Select |
Enter |
Start |
Gamepad input is also supported via SDL's GameController API.
build\nes.exe path\to\game.nes
- You can also drag and drop a
.nesor.nsavefile onto the emulator window. - Save states are written automatically next to the loaded ROM using the same base name with a
.nsaveextension and loaded automatically on the next run.
