schip8 0.1.0

Interpreter backend for Chip-8 and Super-Chip
Documentation
  • Coverage
  • 68.57%
    24 out of 35 items documented0 out of 7 items with examples
  • Size
  • Source code size: 42.57 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 3.26 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 21s Average build duration of successful builds.
  • all releases: 21s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • skrewby/schip8
    1 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • skrewby

Schip8

A library with the aim to provide a simple CHIP-8 interpreter backend that can integrate into any graphics library or renderer of your choosing.

Examples

Quickstart

This is a basic skeleton of how to start implementing a frontend. It's recommended to use the [anyhow] crate as well.

use schip8::Chip8; 
use anyhow::{Context, Result};

fn main() -> Result<()> {
    let mut chip = Chip8::default();
    
    // The load_file function needs to be implemented
    let file = load_file("roms/TETRIS")?;    
    chip.load_rom(&file).context("Loading ROM file")?;

    // Use the frontend to make this loop run at 60 Hz
    loop {
        // Process input
        // ...

        chip.tick().context("Interpreter tick")?;

        // Render screen - check the examples for scaling demo 
        for y in 0..chip.screen.height {
            for x in 0..chip.screen.width {
                if chip.screen.get_pixel(x, y) {
                    // Draw
                }
            }
        }

        // Reset with chip.reset() if reset key is pressed

        if chip.should_play_sound() {
            // Play a tone
        } 
    }
}