Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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 🦀
- Host: GitHub
- URL: https://github.com/joao-conde/jc-nes
- Owner: joao-conde
- License: mit
- Created: 2020-12-17T23:23:28.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2023-09-27T13:31:36.000Z (about 1 year ago)
- Last Synced: 2024-04-19T19:21:12.298Z (8 months ago)
- Topics: emulator, nintendo-entertainment-system, rust
- Language: Rust
- Homepage:
- Size: 5.97 MB
- Stars: 10
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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)
...
}
}
```