From 601e29b634ce96c5d16b3bea7a563789a042c0e6 Mon Sep 17 00:00:00 2001 From: pjht Date: Fri, 3 Nov 2023 18:44:52 -0500 Subject: [PATCH] Display bus error information on failed BE trap --- src/m68k.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/m68k.rs b/src/m68k.rs index 3f5540d..2117189 100644 --- a/src/m68k.rs +++ b/src/m68k.rs @@ -18,7 +18,7 @@ pub struct BusError; impl Display for BusError { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - f.write_str("Bus error") + f.write_str("bus error") } } @@ -54,7 +54,7 @@ pub struct DetailedBusError { impl Display for DetailedBusError { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { f.write_fmt(format_args!( - "Bus error {} 0x{:0>8x}", + "bus error {} 0x{:0>8x}", self.cause, self.address )) } @@ -230,6 +230,7 @@ impl M68K { return; }; if self.handling_bus_error { + println!("{} while handling bus error, halting", bus_error); self.stopped = true; self.stored_mem_cycles.clear(); self.use_stored_mem_cycles = false; @@ -248,7 +249,7 @@ impl M68K { }; let stored_mem_cycles_len = self.stored_mem_cycles.len(); let last_cycle = &self.stored_mem_cycles[stored_mem_cycles_len - 1]; - if self + if let Err(snd_bus_error) = self .berr_trap( write, ins, @@ -256,8 +257,8 @@ impl M68K { bus_error.address, last_cycle.try_get_write_data().unwrap_or(0), ) - .is_err() { + println!("{} while trapping to bus error handler for {}, halting", snd_bus_error, bus_error); self.stopped = true; self.stored_mem_cycles.clear(); self.use_stored_mem_cycles = false;