Display bus error information on failed BE trap

This commit is contained in:
pjht 2023-11-03 18:44:52 -05:00
parent cb12ab55c2
commit 601e29b634
Signed by: pjht
GPG Key ID: 7B5F6AFBEC7EE78E

View File

@ -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;