A NES (Nintendo Entertainment System) emulator written in Rust. It includes a cycle-accurate CPU, a somewhat accurate PPU and a less accurate APU. Because this emulator strives for accuracy, it is not the fastest emulator, although it does run at a healthy 60 FPS on my base model 2015 Macbook Air.
Please don't sue me Nintendo :(
- SDL2: graphics, sound, keyboard I/O
- Nightly Rust: this emulator makes heavy use of generators, which is currently only available on the nightly toolchain.
cargo run --release <rom>
Keyboard Map
Enter - Start
Space - Select
Up - Up
Down - Down
Left - Left
Z - A
X - B
- Second controller support
- Customizable keyboard mappings
- Debug views
- Save states
- NES 2.0 file formats (only INES file formats are supported)
- Additional mappers (only Mappers 0 and 2 are supported)
- Miscellaneous APU and PPU bugfixes.
I don't think I've received any questions about this emulator, so it doesn't quite make sense to add a FAQ. But I want a section to talk about some miscellaneous aspects of my emulator, so here goes.
NES opcodes are composed of a sequence of reads and writes. For instance, the ASL instruction looks like
1 PC R fetch opcode, increment PC
2 PC R fetch address, increment PC
3 address R read from effective address
4 address W write the value back to effective address,
5 address W shift the value left and write the new value to effective address
The state of the NES may change in-between any one of these steps. I use generators to ensure that each part of the NES is synchronized after every cycle.