Skip to content

0xagvz/nes-emulator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NES Emulator

A cycle-accurate NES (Nintendo Entertainment System) emulator written in C++.

Requirements

  • C++17 or higher
  • CMake 3.10+
  • SDL2 (for graphics and input)
  • Make or Ninja build system

Building

cd build
cmake ..
make -j$(nproc)

Running

./nes_emulator <path_to_rom.nes>

Project Structure

src/
├── cpu.cpp/h        # 6502 CPU emulation with all 256 opcodes
├── ppu.cpp/h        # Graphics processing unit
├── bus.cpp/h        # Memory bus and addressing
├── cartridge.cpp/h  # ROM loading and cartridge management
├── ram.cpp/h        # RAM implementation
├── joypad.cpp/h     # Controller input handling
└── main.cpp         # Entry point

Testing

The emulator passes the nestest ROM validation tests, ensuring accurate CPU cycle timing and opcode implementation.

Controls

Key Action
Arrow Keys D-Pad
Z A Button
X B Button
Enter Start
Shift Select

To-Do

  • Implement APU support for audio emulation
  • Improve games compatibility
  • Add Xbox controller support
  • Fix clock synchronization issues

References