A high-performance, feature-complete Nintendo Entertainment System (NES) emulator built with modern C++20 and SFML. This project implements cycle-accurate emulation of the NES console, including CPU, PPU, APU, and comprehensive memory mapper support for authentic retro gaming experiences.
This NES emulator is a sophisticated system-level emulation project that recreates the complete Nintendo Entertainment System hardware stack. Built with performance and accuracy in mind, it features cycle-accurate timing, authentic audio synthesis, and pixel-perfect graphics rendering with optional CRT shader effects.
Language: C++20
Graphics Library: SFML (Simple and Fast Multimedia Library)
Build System: GNU Make
Architecture: Modular component-based design with hardware abstraction
- 6502 CPU Emulation: Full cycle-accurate 6502 processor implementation with all documented opcodes
- Picture Processing Unit (PPU): Complete PPU emulation with sprite rendering, background tiles, and scrolling
- Audio Processing Unit (APU): Authentic audio synthesis with all 5 channels:
- 2x Pulse Wave Channels (Square waves)
- 1x Triangle Wave Channel
- 1x Noise Channel
- 1x Delta Modulation Channel (DMC)
- Memory Management: Sophisticated memory mapping system with multiple mapper implementations
- Controller Support: Authentic NES controller input handling with customizable key bindings
- NROM (Mapper 0): Basic mapper for simple games like Super Mario Bros.
- MMC1 (Mapper 1): Bank switching mapper supporting larger games
- UxROM (Mapper 2): UNROM and UOROM cartridge support
- CNROM (Mapper 3): Character ROM switching for graphics-heavy games
- MMC3 (Mapper 4): Advanced mapper with IRQ support for complex games
- AxROM (Mapper 7): 32KB program ROM switching with single-screen mirroring
- GxROM (Mapper 66): Dual program and character ROM switching
- Authentic Resolution: Native 256x240 pixel rendering scaled to 768x720
- CRT Shader Effects: Optional retro CRT monitor simulation with:
- Scanline simulation
- Phosphor glow effects
- Screen curvature distortion
- RGB shadow mask
- Real-time Audio: High-quality audio output with proper channel mixing
- Frame-perfect Timing: 60 FPS gameplay with authentic NES timing
- ROM Compatibility: Support for .nes ROM files with iNES header format
- Pause/Resume: Real-time emulation control (F2 to toggle)
- Single-step Debugging: Frame-by-frame execution for development (F3)
- Shader Toggle: Enable/disable CRT effects on-the-fly (F1)
- Cartridge RAM: Support for games with battery-backed SRAM
Mario.mp4
Megaman2.mp4
Zelda.mp4
- C++ Compiler: GCC or Clang with C++20 support
- SFML Libraries: Complete SFML development libraries
- libsfml-system
- libsfml-window
- libsfml-graphics
- libsfml-audio
- Build Tools: GNU Make
- System Libraries: pthread, math library (libm)
sudo apt update
sudo apt install build-essential libsfml-devsudo dnf install gcc-c++ make SFML-develsudo pacman -S gcc make sfml# Clone the repository
git clone https://github.com/mallory-scotton/nes-emulator.git
cd nes-emulator
# Build the emulator
make
# Run with a ROM file
./nes path/to/your/rom.nes./nes <ROM_FILE>| Key | Action |
|---|---|
ESC |
Exit emulator |
F1 |
Toggle CRT shader effects |
F2 |
Pause/Resume emulation |
F3 |
Step one frame (when paused) |
| NES Button | Keyboard Key |
|---|---|
| A | A |
| B | Z |
| SELECT | Right Shift |
| START | Enter |
| UP | ↑ |
| DOWN | ↓ |
| LEFT | ← |
| RIGHT | → |
The emulator supports standard iNES format ROM files (.nes extension) and is compatible with:
- Super Mario Bros. series
- The Legend of Zelda
- Mega Man series
- Tetris
- And hundreds of other commercial and homebrew titles
- Sample Rate: 44.1 kHz stereo output
- Latency: Low-latency real-time audio synthesis
- Channels: Full 5-channel NES APU emulation with authentic sound
make # Build the emulator
make re # Clean rebuild
make clean # Remove object files
make fclean # Complete cleanupThe Makefile supports several build configurations:
# Debug build with additional symbols
make DFLAGS="-g -DDEBUG"
# Optimized release build
make DFLAGS="-O3 -DNDEBUG"
# Build with warnings as errors
make WARNING_FLAGS="-Wall -Wextra -Werror"# Enable all warnings and debug information
make CXXFLAGS="-std=gnu++20 -g3 -Wall -Wextra -Wpedantic"- SFML: Complete multimedia framework
- Graphics rendering and display management
- Window management and event handling
- Audio output and real-time synthesis
- System utilities and timing
- Standard Libraries: pthread (threading), libm (mathematics)
- GCC/Clang: Modern C++ compiler with C++20 support
- GNU Make: Build system automation
- Git: Version control (for cloning)
- Minimum SFML Version: 2.5.0 or higher
- C++ Standard: C++20 (GNU extensions supported)
- Compiler Support: GCC 10+, Clang 12+
brew install sfml makepacman -S mingw-w64-x86_64-sfml mingw-w64-x86_64-gcc makeThis project is licensed under the MIT License - see the LICENSE.md file for complete details.
MIT License
Copyright (c) 2025 Mallory SCOTTON
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
We welcome contributions to the NES Emulator project! Please read our Contributing Guidelines and Code of Conduct for details on our development process and community standards.
- Fork the repository on GitHub
- Create a feature branch (
git checkout -b feature/amazing-feature) - Implement your changes following the coding standards
- Test thoroughly with various ROM files
- Commit your changes (
git commit -m 'Add amazing feature') - Push to your branch (
git push origin feature/amazing-feature) - Submit a Pull Request with detailed description
- C++20 Standard: Use modern C++ features and best practices
- Naming Conventions: Follow existing patterns (PascalCase for classes, camelCase for functions)
- Documentation: Include comprehensive code comments and documentation
- Modular Design: Maintain separation between emulation components
- Testing: Verify compatibility with multiple ROM files
- Performance: Maintain 60 FPS performance on target hardware
- Additional Mappers: Implement support for more cartridge types
- Performance Optimization: CPU and memory optimizations
- Audio Enhancements: Advanced audio filtering and effects
- Debugging Tools: Memory viewers, CPU state inspection
- Platform Support: macOS, Linux distribution improvements
- Documentation: User guides, technical documentation
Project Lead: Mallory Scotton
Email: [email protected]
GitHub: @mallory-scotton
Project Repository: nes-emulator
For technical questions, bug reports, or feature requests, please:
- Check existing issues on GitHub first
- Open a new issue with detailed information
- Contact directly for urgent matters or collaboration
- Bug Reports: Use GitHub Issues with detailed reproduction steps
- Feature Requests: Discuss proposed features in GitHub Discussions
- Technical Questions: Email with specific technical details
- Collaboration: Open to academic and research partnerships
NES Emulator - Bringing classic Nintendo gaming to modern systems through accurate hardware emulation
Coded with ❤️ by passionate developers for the retro gaming community