intel8080/
lib.rs

1//! Yet another Intel 8080 Emulator. It passes the TST8080, 8080PRE, CPUTEST and 8080EXM tests.
2//!
3//! Example for a small loop:
4//! ```rust
5//! use intel8080::cpu::CPU;
6//! let mut c = CPU::new(0xFFFF);
7//! c.pc = 0x0100;                      // sets pc to $100
8//! // Here we create a small machine code program for demo purpose.
9//! // Usually you will rather load an assembled code in memory (see below).
10//! c.bus.write_byte(0x0100, 0x3e);     // MVI A,$0F
11//! c.bus.write_byte(0x0101, 0x0F);
12//! c.bus.write_byte(0x0102, 0x3d);     // DCR A
13//! c.bus.write_byte(0x0103, 0xc2);     // JNZ $0102
14//! c.bus.write_word(0x0104, 0x0102);
15//! c.bus.write_byte(0x0106, 0xc9);     // RET
16//! loop {
17//!     c.execute();
18//!     if c.pc == 0x0000 { break }
19//! }
20//! ```
21//!
22//! Debug mode outputs CPU state and disassembled code to an internal string after each execute():
23//! ```text
24//! 3E 0f     MVI A,$0f
25//! PC : 0x0003	SP : 0xff00	S : 0	Z : 0	A : 0	P : 0	C : 0
26//! B : 0x00	C : 0x00	D : 0x00	E : 0x00	H : 0x00	L : 0x00 ...
27//! ```
28//!
29//! Includes a "cpmrun" example which loads and executes basic CP/M programs:
30//!
31//! ```text
32//! cargo run --release --example cpmrun bin/helloworld.bin
33//! ```
34//!
35//! You can also check my [Altair 8800 / 88-SIO / teletype emulator](https://github.com/nicolasbauw/Altair8800).
36//!
37//! The provided source code examples can be assembled with [Retro Assembler](https://enginedesigns.net/retroassembler/).
38//!
39
40mod bit;
41pub mod cpu;
42mod dasm;
43mod flags;
44pub mod bus;
45#[doc(hidden)]
46pub mod register;
47
48#[cfg(test)]
49mod tests;