/nescore

NES emulator library written in Rust

Primary LanguageRust

NES Core

Build Status codecov nescore crate

NES emulator and tools

Image not found

Build

cargo build

Several ROM tests such as nestest, nes_instr_test and sprite_zero_hit are run as integration tests. They can be run with the following:

# Pull in test ROMs first
git submodule update --init --recursive
# Run all tests
cargo test

nescore

Core library for emulating the NES.

The basics so far:

use nescore::{Nes, Cartridge, Button};

fn main() {
    let mut nes: Nes = Cartridge::from_path("/path/to/rom").unwrap().into();

    // Run the NES for a single frame and return video/audio buffers.
    let (framebuffer, samplebuffer) = nes.emulate_frame();

    // Update display and audio on platform of your choice.
    // ...

    // Standard controller input: Press the 'A' button
    nes.input(Button::A, true);
}

Check out nescli for a full SDL example.

nescli

Some tooling for interacting with ROM files.

nescli run    <ROM> # Run the ROM file
nescli run -d <ROM> # Run the ROM file with CPU debug output

nescli info <ROM>   # Display cartridge header information
nescli img  <ROM>   # Dump CHR ROM to a PNG file

nescli audio <ROM>  # Just play ROM audio

nescore-retro

This is a libretro core made with nescore and libretro_backend.

retroarch -L /path/to/nescore_retro.<so/dll> /path/to/rom