A simple Nintendo Entertainment System (NES) emulator written in Rust language.
This repository only contains the core of the NES emulation. It doesn't provide any GUI by itself. For a full GUI project using this crate, check out nesmulator-gui.
I do not plan to make this emulator compatible with every NES game. My goal is to be able to emulate games like Zelda, Dragon Warrior, and Castlevania. I would also like to pass most of the tests from some tests roms listed in the NES dev wiki (see TESTS.md).
- CPU is emulated and passes most tests
- PPU is emulated and passes most tests
- APU is emulated
- First controller is emulated (see controls below)
- A cartridge in the iNES format can be loaded into the emulator
- Mapper 0, 1, 2 and 3 are implemented
- A palette in the .pal format can be loaded into the emulator, otherwise a default palette is hardcoded into the emulator
- ROM from cartridges that had a saving system can save the game in a file with the .sav extension
- The current state of the emulator can be saved and loaded back at any moment, allowing saving games that do not support saves otherwise
The nesmulator-gui repository can be used as a reference for using this crate.
This crate is not published on crates.io (yet?), so to use it in one of your projects, add the following to your Cargo.toml
:
nesmulator_core = { git = "https://github.com/AntoineRR/nesmulator-core" }
An example usage of this crate is provided in src/bin/main.rs
. It will attempt to load the nestest.nes
ROM and run it on automation until completion. To run this example, you first have to downolad the nestest.nes ROM and change the rom_path
variable in src/bin/main.rs
to link to its location on your computer. Then, run the following command:
cargo run --release
This will display the logs of the CPU.
See TESTS.md for details about tests.
- Pass more tests
- Improve mapper 1
- Improve general architecture to remove
Rc
- Expose API to retrieve instructions that are being executed
This code is distributed under the MIT license.