This is my NES emulator implementation written in Rust. My main goal of this project is to practice the language 😄
You can check out the web version at: https://selassje.github.io/nes-rs/
- faithfull implementation, down to single pixel rendering, based on NESDev
- control of the emulation speed
- state serialization support
- customizable key mappings (currently only keyboard is supported)
- fullscreen mode support
- currently supported mappers:
- 1, 2, 4, 7, 66, 71, 227
NES Button | Player1 | Player2 |
---|---|---|
A | Q | Keypad 4 |
B | E | Keypad 5 |
Select | C | Keypad 6 |
Start | Space | Keypad + |
Up | W | Up Arrow |
Down | S | Down Arrow |
Left | A | Left Arrow |
Right | D | Right Arrow |
The CI tested targets are x86_64-pc-windows-msvc and x86_64-unknown-linux-gnu
Before running cargo build for those targets you will need to build the SDL2 lib via the help of cargo-vcpkg
cargo install cargo-vcpkg
cargo vcpkg build
cargo build --release
Target wasm32-unknown-emscripten is also supported. In that case, instead of building SDL2, Emscripten SDK is required which provides SDL2 as well as OpenGL ports. The Emscripten SDK version known to work with this project is 2.0.9.
I recommend using cargo-web to build and run the emscripten target
cargo web start --release
Automatic testing is done by running test ROMS from https://github.com/christopherpow/nes-test-roms and comparing generated frames with the expected ones