Skip to content

A cycle-accurate NES emulator written in Rust 🦀

Notifications You must be signed in to change notification settings

AdamBlance/nes-emu

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Summary

A cycle-accurate NES emulator written in Rust 🦀 with an egui frontend. Cycle-accuracy in this context means that the hardware is emulated one CPU cycle at a time (rather than one CPU instruction at a time). This supports the emulation of games that depend on hardware quirks (open bus behaviour, dummy reads, tight interrupt timings) without relying on game-specific hacks.

smb3gif

Features

  • Cycle-accurate emulation with full audio/video support (CPU, PPU and APU implemented)
  • Controller support with configurable button mappings
  • "Rewind" save-state feature (shown below ⬇️)
  • Adjustable emulation speed
  • CPU debugger (in development)

rewindgif

Supported Games

Games with any of the following mappers are supported. This covers over 1000 NES games.

A handful of games are known to not work (one of which is Battletoads) due to a bug in my sprite 0 hit detection.

Installation

Compiled binaries aren't yet available, so you must build from source. First install Rust if you haven't already.

git clone https://github.com/AdamBlance/nes-emu.git
cd nes-emu
cargo build --release

A specific version of Rust nightly (as defined in rust-toolchain.toml) should be automatically installed when attempting to build (as the emulator depends on unstable features).

Run with cargo run --release. Note that without the --release flag the emulator will not perform well.

If the emulator is struggling to keep up, try uncommenting the following lines in Cargo.toml and building again.

[profile.release]
lto = "fat"
codegen-units = 1

The compilation will take a long time but this should yield a binary that performs better.

References

This project is not based on any existing emulator and was not developed with reference to any existing emulator code. It has been written to match the behaviour of NES hardware as described by/on/in:

About

A cycle-accurate NES emulator written in Rust 🦀

Topics

Resources

Stars

Watchers

Forks

Languages