From 7bdc48925955a29c0e2a9986db1a8e8094862b68 Mon Sep 17 00:00:00 2001 From: pjht Date: Fri, 2 Feb 2024 13:42:20 -0600 Subject: [PATCH] Factor out duplicate setting of address in fp_update --- src/state.rs | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/src/state.rs b/src/state.rs index 8211607..5227a4b 100644 --- a/src/state.rs +++ b/src/state.rs @@ -108,25 +108,19 @@ impl EmuState { return; } let cycle = self.cpu.get_mem_cycle(); + self.fp_state.set_addr(cycle.address()); self.fp_state.set_status(cycle.get_status()); match cycle { MemCycle::Fetch(a) | MemCycle::Read(a) | MemCycle::StackRead(a) => { - self.fp_state.set_addr(a); self.fp_state.set_data(self.mem[a as usize]); } - MemCycle::Write(a, _) | MemCycle::StackWrite(a, _) | MemCycle::Out(a, _) => { - self.fp_state.set_addr(a); + MemCycle::Write(_, _) | MemCycle::StackWrite(_, _) | MemCycle::Out(_, _) | MemCycle::Hlta => { self.fp_state.set_data(0xff); } - MemCycle::In(a) => { - self.fp_state.set_addr(a); + MemCycle::In(_) => { self.fp_state.set_data(0); } MemCycle::Inta(_) => todo!(), - MemCycle::Hlta => { - self.fp_state.set_addr(0xffff); - self.fp_state.set_data(0xff); - } MemCycle::IntaHlt(_) => todo!(), } }