A Nintendo Entertainment System (NES) emulator built in Rust.
Note
This project was created purely as a hobby, a personal challenge, and an opportunity to practice low-level programming and system architecture in Rust. So for the foreseeable future it is not intended to compete with established emulators but rather serves as a proof of concept and a deep learning experience regarding low-level programming and the NES hardware.
Make sure you have Rust and Cargo installed on your system.
# Clone the repository
git clone https://github.com/Polar-404/NES_Emulator.git
# Navigate to the directory
cd NES_Emulator
# Compile and run
cargo run --release| NES Button | Primary | Secondary |
|---|---|---|
| D-Pad Up | W |
Up Arrow |
| D-Pad Down | S |
Down Arrow |
| D-Pad Left | A |
Left Arrow |
| D-Pad Right | D |
Right Arrow |
| A | J |
Z |
| B | K |
X |
| Select | N |
C |
| Start | M |
V |
System Commands:
- Volume Up:
+ - Volume Down:
- - Pause/Menu:
Esc - Change Color Palette:
.(Period) - Paste ROM Path:
Ctrl + V
-
Ricoh 2A03 (6502) CPU (including indirect JMP bug support).
-
PPU (Picture Processing Unit).
-
Partial APU (Audio Processing Unit).
-
Controller input implemented.
-
Supported mappers:
-
NROM (Mapper 0)
-
MMC1 (Mapper 1)
-
-
Rust: Main language used for the project.
-
Macroquad: Core library for graphics rendering and input handling.
-
Cpal: Library for audio processing and output.
-
Ringbuf: Lock-free circular buffer for audio.
-
Arboard: System clipboard access.
-
Others:
image,lazy_static,sysinfo.
As this is an ongoing learning project, several areas still need improvement:
-
User Interface: Improve the start menu and add more graphics and audio configuration options.
-
Audio (APU): Implement the DMC (Delta Modulation Channel).
-
Synchronization: Sync audio with FPS to maintain a more stable frame rate, faithful to the original console.
-
Mappers: Add support for more mappers (e.g., MMC3) to increase game compatibility.
-
Saves: Implement Save/Load states functionality.
-
Code Quality: Refactor and clean up the codebase, and potentially add documentation and internationalization (EN/PT-BR).
-
Accuracy & Testing: Fix known bugs (e.g., failing test 3 in
official_only.nes) and run/create more accuracy tests. -
Unofficial Opcodes: Implement undocumented 6502 instructions.
-
Scripting: Implement user script support with Lua.
-
More Palettes: Implement the ability for the user to insert their own palettes via interface and/or a designated folder with
.palfiles (maybe even.hexfiles). -
Custom Graphics Pipeline: Transition from Macroquad to OpenGL/Glow for
- lower input latency
- better frame synchronization.
- Custom CRT/NTSC shaders.
-
WebAssembly (WASM): Browser-based emulation — play directly without installing anything.
This project would not have been possible without the incredible emulation community and the educational resources available online. Special thanks to:
-
Nesdev: The Nesdev wiki and community are the absolute standard for NES development. Practically all technical knowledge here came from them.
-
javidx9 (OneLoneCoder): His excellent video series on creating an NES emulator was the starting point and main architectural inspiration.
-
bugzmanov/nes_ebook: The e-book "Writing NES Emulator in Rust" was a fundamental reference. Parts of the CPU implementation and Design Patterns were heavily based on his code to understand Rust's nuances applied to emulation.
Distributed under the MIT License. Feel free to study, modify, and use this code in your own experiments.
