From a98a9c3d8b3edb34ab95baf74cf8fae9f636f2e6 Mon Sep 17 00:00:00 2001 From: pjht Date: Thu, 1 Feb 2024 18:48:45 -0600 Subject: [PATCH] Fctor out repeated update_fp calls in handle_fp_interaction --- src/state.rs | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/src/state.rs b/src/state.rs index 31da5f8..ba68fe9 100644 --- a/src/state.rs +++ b/src/state.rs @@ -50,7 +50,6 @@ impl EmuState { ActionSwitch::SingleStep => { if state == SwitchState::Up { self.run_cpu_cycle(); - self.update_fp(); } } ActionSwitch::Examine => { @@ -59,11 +58,9 @@ impl EmuState { self.cpu.finish_m_cycle(0xC3); // JMP self.cpu.finish_m_cycle(self.fp_state.ad_sws() as u8); self.cpu.finish_m_cycle((self.fp_state.ad_sws() >> 8) as u8); - self.update_fp(); } else if state == SwitchState::Down { // Assume M1 self.cpu.finish_m_cycle(0x0); // NOP - self.update_fp(); } } ActionSwitch::Deposit => { @@ -71,19 +68,16 @@ impl EmuState { // Assume M1 self.mem[self.cpu.get_mem_cycle().address() as usize] = self.fp_state.ad_sws() as u8; - self.update_fp(); } else if state == SwitchState::Down { // Assume M1 self.cpu.finish_m_cycle(0x0); // NOP self.mem[self.cpu.get_mem_cycle().address() as usize] = self.fp_state.ad_sws() as u8; - self.update_fp(); } } ActionSwitch::Reset => { if state == SwitchState::Up { self.cpu.reset(); - self.update_fp(); } } ActionSwitch::Protect => (), @@ -97,13 +91,12 @@ impl EmuState { self.audio_tx.send(AudioMessage::FanOn).unwrap(); self.running = false; self.cpu = I8080::new(); - self.update_fp(); } else { self.audio_tx.send(AudioMessage::FanOff).unwrap(); - self.update_fp(); } } } + self.update_fp(); } pub fn update_fp(&mut self) {