rust_chip8_opengl/
lib.rs

1//! CHIP-8 emulation library
2//!
3//! Simple library for emulating CHIP-8 programs, or running individual opcodes.
4//! Also can be used as a proper emulator, either rendering the ROM using opengl or in the terminal.
5//!
6//! ```
7//! extern crate rust_chip8_opengl;
8//! use rust_chip8_opengl::processor::Processor;
9//! fn main() {
10//!   let mut p = Processor::new();
11//!
12//!   // Execute individual opcodes
13//!   p.execute(0x60FF);
14//!   p.execute(0x6118);
15//!   assert_eq!(p.get_register_value(0x0), 0xFF);
16//!   assert_eq!(p.get_register_value(0x1), 0x18);
17//!
18//!   // Load a program and execute it step by step
19//!   let program = [0x6005, 0x6105, 0x8014];
20//!   // load_program also available for u8
21//!   p.load_program_u16(&program);
22//!   p.step();
23//!   p.step();
24//!   p.step();
25//!   assert_eq!(p.get_register_value(0x0), 0xA);
26//! }
27//! ```
28mod errors;
29#[doc(hidden)]
30pub mod interfaces;
31#[doc(hidden)]
32pub mod processor;
33
34pub use self::errors::OpcodeError;
35pub use self::processor::Processor;