gc_nes_core

Crates.iogc_nes_core
lib.rsgc_nes_core
version0.1.0
sourcesrc
created_at2020-05-29 00:41:55.642817
updated_at2020-05-29 00:41:55.642817
descriptionSimple rust implementation of a NES emulator, built on top of my emulator_6502 crate.
homepage
repositoryhttps://github.com/GarettCooper/gc_nes_emulator
max_upload_size
id247212
size143,193
Garett Cooper (GarettCooper)

documentation

README

Crate Documentation

gc_nes_core

gc_nes_core is, as the name would suggest, the core of my Ninendo Entertainment System emulator. It provides an interface for dependent crates to load and run NES ROMs, provide input, and extract rendered image data. Audio is currently unsupported.

Using the Emulator

Add gc_nes_core as a dependency in Cargo.toml

[dependencies]
gc_nes_core = "0.1.0"

Dependent crates can use the emulator functionality as follows:

use gc_nes_core::cartridge::Cartridge;
use gc_nes_core::nes::Nes;


// Load a .nes file as a cartridge
let cartridge = Cartridge::load_from_file("/some/nes/rom.nes".as_ref()).expect("File read error");
// Create the NES with the cartridge loaded
let mut nes = Nes::new(cartridge);
// Run the NES until the next frame completes
let frame_buffer:&[u32; 61440] = nes.frame();
// Or run it cycle by cycle for a finer approach
nes.cycle();
// Provide input state:
nes.update_controller_one(Some(0b0001_0100));
nes.update_controller_two(None); // Disconnected controller

Current version: 0.1.0

Commit count: 90

cargo fmt