Sunrest is a NES emulator written with the purpose of learning Rust and understanding how an emulator works.
Usage: sunrest [OPTIONS] <ROM>
Arguments:
<ROM> Path to a ROM file
Options:
--volume <num> Volume of the audio
--speed <num> Speed of the emulation
--replay <FILE> Path to the replay file
--record <FILE> Path to save the replay file
-h, --help Print help
The emulation is not accurate, games might display various glitches
Keyboard Key | Nes Pad |
---|---|
A | Left |
S | Down |
D | Right |
W | Up |
J | A |
K | B |
Enter | start |
Backspace | select |
[ | save state |
] | load state |
Beside the command line arguments, the emulator can be configured using environment variables.
The following environment variables are supported:
env | description |
---|---|
SUNREST_SPEED | emulator speed ratio (default: 1.0) |
SUNREST_VOLUME | audio volume (default: 1.0) |
- Only the iNes v1 format (
.nes
) is supported for ROMs.
The implemented mappers and the list supported ROMs for each mapper are:
To ensure optimal performance, make sure to build the emulator with the --release
flag enabled.
Without this flag, the emulator may run too slowly.
cargo build --release
There are some optional tests (marked as ignore
) relying on test ROMs available at
nes-test-roms.
To run these tests, follow the steps below:
- Clone the nes-test-roms repository to your local machine.
- Set the
NES_TEST_ROMS_PATH
environment variable to the path where you cloned thenes-test-roms
repository. - Run the tests, ensuring that you enable the ignored tests.
git clone https://github.com/christopherpow/nes-test-roms $HOME/nes-test-roms
NES_TEST_ROMS_PATH=/$HOME/nes-test-roms cargo test -- --include-ignored
While creating this emulator, I heavily consulted the following sources:
- https://www.nesdev.org/ - The bible
- https://www.masswerk.at/6502/6502_instruction_set.html - 6502 instruction set documentation
- javidx9's NES Emulator From Scratch Youtube series
- https://github.com/ulfalizer/nesalizer - A NES emulator written in C++
- https://github.com/fogleman/nes - A NES emulator written in Go