cpu.rs: Refactor for modularity

- Break into submodules
  - Move bus into submodule of CPU
  - Keep program and charset rom inside CPU
  - Take only the screen on the external Bus
  - Refactor the disassembler into an instruction definition and the actual "Dis" item
This commit is contained in:
2023-04-23 12:10:02 -05:00
parent 33da1089a2
commit c1219e60f0
11 changed files with 1094 additions and 992 deletions

View File

@@ -11,7 +11,6 @@ fn setup_environment() -> (CPU, Bus) {
cpu.flags = Flags {
debug: true,
pause: false,
monotonic: Some(10),
..Default::default()
};
(
@@ -36,10 +35,10 @@ struct SuiteTest {
fn run_screentest(test: SuiteTest, mut cpu: CPU, mut bus: Bus) {
// Set the test to run
bus.write(0x1ffu16, test.test);
bus.load_region(Program, test.data).unwrap();
cpu.load_program_bytes(test.data).unwrap();
// The test suite always initiates a keypause on test completion
while !(cpu.flags.keypause || cpu.flags.pause) {
cpu.multistep(&mut bus, 100).unwrap();
while !(cpu.flags.is_paused()) {
cpu.multistep(&mut bus, 10).unwrap();
}
// Compare the screen to the reference screen buffer
bus.print_screen().unwrap();

View File

@@ -192,7 +192,7 @@ mod cpu {
}
mod dis {
use chirp::cpu::disassembler::Insn;
use chirp::cpu::instruction::Insn;
use imperative_rs::InstructionSet;
#[test]