A cycle-accurate NES (Nintendo Entertainment System) emulator written in C.
This is a nearly 20-year-old hobby project that has been slowly worked on over the years. It has gone through many refactors as I got better at programming and gradually learned to love C over C++.
- MOS 6502 CPU emulation with cycle accuracy
- PPU (Picture Processing Unit) with sprite and background rendering
- APU (Audio Processing Unit) with pulse, triangle, noise, and DMC channels
- iNES ROM format loading
- SDL2 video and audio output
- Curses-based TUI for debug information
- Joystick/controller input via SDL2
- NROM (Mapper 0)
- MMC1 (Mapper 1)
- UxROM (Mapper 2)
- CNROM (Mapper 3)
- MMC3 (Mapper 4)
Requires Meson, SDL2, and ncurses.
meson setup builddir
meson compile -C builddir./builddir/nes <rom.nes>src/
CPU/ - MOS 6502 processor
PPU/ - Picture Processing Unit
APU/ - Audio Processing Unit (pulse, triangle, noise, DMC)
mapper/ - Cartridge mapper implementations
INES/ - iNES ROM format parser
UI/ - SDL2 video output and curses TUI
JS/ - Joystick input handling
util/ - Data structure utilities
Test ROMs are included as a git submodule:
git submodule update --init --recursive