Fctor out repeated update_fp calls in handle_fp_interaction
This commit is contained in:
parent
0c76aab81c
commit
a98a9c3d8b
13
src/state.rs
13
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,14 +91,13 @@ 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn update_fp(&mut self) {
|
||||
if !self.fp_state.power() {
|
||||
|
Loading…
Reference in New Issue
Block a user