#chip8 #interpreter #hardware #run #traits #no-std #os-independent

no-std libchip8

An OS-independent chip8 interpreter library written in Rust

3 releases

0.1.2 Jun 20, 2019
0.1.1 Jun 20, 2019
0.1.0 Jun 20, 2019

#702 in Hardware support

Download history 16/week @ 2024-02-22 11/week @ 2024-02-29 1/week @ 2024-03-07 1/week @ 2024-03-14 36/week @ 2024-03-28 18/week @ 2024-04-04

54 downloads per month

MIT license

15KB
346 lines

libchip8

An OS-independent chip8 interpreter library written in Rust (no_std).

Once you implement OS-specific part, i.e. Hardware trait, you will get a complete chip8 interpreter for your environment.

struct Hardware;

// 1. Implement `libchip8::Hardware`
impl libchip8::Hardware for Hardware {
   ...
}

// 2. Run `Chip8` giving a rom binary.
let chip8 = libchip8::Chip8::new(Hardware);
chip8.run(include_bytes!("roms/invaders.ch8"));

Example

$ cargo run --example unix

This example is to run the chip8 interpreter on unix. It uses minifb for its graphics.

Also used for bare-metal chip8 project.


lib.rs:

libchip8

An OS-independent chip8 interpreter library written in Rust (no_std).

Once you implement OS-specific part, i.e. Hardware trait, you will get a complete chip8 interpreter for your environment.

struct Hardware;

// 1. Implement `libchip8::Hardware`
impl libchip8::Hardware for Hardware {
// ...
}

// 2. Run `Chip8` giving a rom binary.
let chip8 = libchip8::Chip8::new(Hardware);
chip8.run(include_bytes!("roms/invaders.ch8"));

Dependencies

~87KB