Skip to content

A simple Nintendo Entertainment System (NES) emulator written in Rust.

License

Notifications You must be signed in to change notification settings

AntoineRR/nesmulator-core

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

81 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Nesmulator core

Description

A simple Nintendo Entertainment System (NES) emulator written in Rust language.

This repository only contains the core of the NES emulation. It doesn't provide any GUI by itself. For a full GUI project using this crate, check out nesmulator-gui.

Final goal

I do not plan to make this emulator compatible with every NES game. My goal is to be able to emulate games like Zelda, Dragon Warrior, and Castlevania. I would also like to pass most of the tests from some tests roms listed in the NES dev wiki (see TESTS.md).

Current progress

  • CPU is emulated and passes most tests
  • PPU is emulated and passes most tests
  • APU is emulated
  • First controller is emulated (see controls below)
  • A cartridge in the iNES format can be loaded into the emulator
  • Mapper 0, 1, 2 and 3 are implemented
  • A palette in the .pal format can be loaded into the emulator, otherwise a default palette is hardcoded into the emulator
  • ROM from cartridges that had a saving system can save the game in a file with the .sav extension
  • The current state of the emulator can be saved and loaded back at any moment, allowing saving games that do not support saves otherwise

How to use

The nesmulator-gui repository can be used as a reference for using this crate.

This crate is not published on crates.io (yet?), so to use it in one of your projects, add the following to your Cargo.toml:

nesmulator_core = { git = "https://github.com/AntoineRR/nesmulator-core" }

An example usage of this crate is provided in src/bin/main.rs. It will attempt to load the nestest.nes ROM and run it on automation until completion. To run this example, you first have to downolad the nestest.nes ROM and change the rom_path variable in src/bin/main.rs to link to its location on your computer. Then, run the following command:

cargo run --release

This will display the logs of the CPU.

Tests

See TESTS.md for details about tests.

To do

  • Pass more tests
  • Improve mapper 1
  • Improve general architecture to remove Rc
  • Expose API to retrieve instructions that are being executed

License

This code is distributed under the MIT license.

References

About

A simple Nintendo Entertainment System (NES) emulator written in Rust.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages