diff --git a/src/main.rs b/src/main.rs index cf576fb..9edc3c3 100644 --- a/src/main.rs +++ b/src/main.rs @@ -171,7 +171,14 @@ fn main() -> Result<(), anyhow::Error> { let pc = state.cpu.pc(); out += &disas_fmt(&mut state.cpu, pc, &state.symbol_tables).0; } - state.cpu.step(); + match state.cpu.step() { + Ok(_) => (), + Err(bus_error) => { + println!("{bus_error}"); + state.cpu.stopped=true; + break; + } + } } if args.get_flag("print_regs") { out += &format!("{}\n", state.cpu); @@ -214,7 +221,14 @@ fn main() -> Result<(), anyhow::Error> { let pc = state.cpu.pc(); out += &disas_fmt(&mut state.cpu, pc, &state.symbol_tables).0; } - state.cpu.step(); + match state.cpu.step() { + Ok(_) => (), + Err(bus_error) => { + println!("{bus_error}"); + state.cpu.stopped=true; + break; + } + } } out += &format!("{}\n", state.cpu); let pc = state.cpu.pc();