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:
@@ -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();
|
||||
|
||||
@@ -192,7 +192,7 @@ mod cpu {
|
||||
}
|
||||
|
||||
mod dis {
|
||||
use chirp::cpu::disassembler::Insn;
|
||||
use chirp::cpu::instruction::Insn;
|
||||
use imperative_rs::InstructionSet;
|
||||
|
||||
#[test]
|
||||
|
||||
Reference in New Issue
Block a user