z80/
lib.rs

1#![allow(non_camel_case_types)]
2#![allow(non_upper_case_globals)]
3#![allow(unused_assignments)]
4#![allow(unused_mut)]
5
6//! A fast and accurate instruction-stepped Z80 emulator written in C11 and ported to Rust
7//!
8//! Basic usage:
9//! ```rust
10//!use z80::{Z80, Z80_io};
11//!
12//!struct IO {
13//!    pub mem: [u8; 0x10000],
14//!}
15//!
16//!impl Z80_io for IO {
17//!    fn read_byte(&self, addr: u16) -> u8 {
18//!        self.mem[addr as usize]
19//!    }
20//!
21//!    fn write_byte(&mut self, addr: u16, value: u8) {
22//!        self.mem[addr as usize] = value;
23//!    }
24//!}
25//!
26//!let mut cpu = Z80::new(IO {
27//!    mem: [0; 0x10000],
28//!});
29//!
30//!let rom = vec![0, 0, 0]; // etc
31//!
32//!for (i, byte) in rom.iter().enumerate() {
33//!    cpu.io.write_byte(i as _, *byte);
34//!}
35//!
36//!loop {
37//!    cpu.step();
38//!    break;
39//!}
40//!```
41
42mod z80;
43pub use self::z80::*;
44
45#[cfg(test)]
46mod z80_tests;