Skip to content

alanoliveira/sunrest

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

56 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Sunrest

Sunrest is a NES emulator written with the purpose of learning Rust and understanding how an emulator works.

Usage

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

Buttons

Keyboard Key Nes Pad
A Left
S Down
D Right
W Up
J A
K B
Enter start
Backspace select
[ save state
] load state

Settings

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)

Supported Roms

  • Only the iNes v1 format (.nes) is supported for ROMs.

The implemented mappers and the list supported ROMs for each mapper are:

mapper rom list
000 https://nescartdb.com/search/advanced?ines=0
001 https://nescartdb.com/search/advanced?ines=1
002 https://nescartdb.com/search/advanced?ines=2
003 https://nescartdb.com/search/advanced?ines=3
004 https://nescartdb.com/search/advanced?ines=4

Building

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

Tests

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:

  1. Clone the nes-test-roms repository to your local machine.
  2. Set the NES_TEST_ROMS_PATH environment variable to the path where you cloned the nes-test-roms repository.
  3. 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

Acknowledgments

While creating this emulator, I heavily consulted the following sources: