Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/joao-conde/jc-nes

Nintendo Entertainment System (NES) emulator in Rust 🦀
https://github.com/joao-conde/jc-nes

emulator nintendo-entertainment-system rust

Last synced: about 1 month ago
JSON representation

Nintendo Entertainment System (NES) emulator in Rust 🦀

Awesome Lists containing this project

README

        

# Nintendo Entertainment System (NES) emulator

Nintendo Entertainment System (NES) emulator written in Rust 🦀.







# API Reference

Use the `Nes` struct to create an emulator instance and interact with it using the following API:

```rust
pub fn new() -> Nes;
pub fn load_rom(&mut self, rom: &[u8]);
pub fn reset(&mut self);
pub fn clock(&mut self);
pub fn get_frame(&mut self) -> Option<[u8; SCREEN_WIDTH * SCREEN_HEIGHT * 3]>;
pub fn btn_down(&mut self, controller: u8, btn: Button);
pub fn btn_up(&mut self, controller: u8, btn: Button);
```

Basic usage:

```rust
use jc_nes::{Button, Nes, SCREEN_HEIGHT, SCREEN_WIDTH};

let mut nes = Nes::new();
nes.load_rom(&rom);
nes.reset();

loop {
nes.clock();

// Your draw code
if let Some(screen) = nes.get_frame() {
...
}

// Your event processing
match event {
... => nes.btn_down(1, Button::Up)
... => nes.btn_down(1, Button::B)
... => nes.btn_up(1, Button::A)
... => nes.btn_up(2, Button::Down)
...
}
}
```