From 1cff8b26ce69b100fdaffb08165e102e063f7e80 Mon Sep 17 00:00:00 2001 From: pjht Date: Wed, 15 Mar 2023 19:01:44 -0500 Subject: [PATCH] Properly handle result of M68K::step --- src/main.rs | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) 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();