Factor out duplicate setting of address in fp_update
This commit is contained in:
parent
406382c33a
commit
7bdc489259
12
src/state.rs
12
src/state.rs
@ -108,25 +108,19 @@ impl EmuState {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let cycle = self.cpu.get_mem_cycle();
|
let cycle = self.cpu.get_mem_cycle();
|
||||||
|
self.fp_state.set_addr(cycle.address());
|
||||||
self.fp_state.set_status(cycle.get_status());
|
self.fp_state.set_status(cycle.get_status());
|
||||||
match cycle {
|
match cycle {
|
||||||
MemCycle::Fetch(a) | MemCycle::Read(a) | MemCycle::StackRead(a) => {
|
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]);
|
self.fp_state.set_data(self.mem[a as usize]);
|
||||||
}
|
}
|
||||||
MemCycle::Write(a, _) | MemCycle::StackWrite(a, _) | MemCycle::Out(a, _) => {
|
MemCycle::Write(_, _) | MemCycle::StackWrite(_, _) | MemCycle::Out(_, _) | MemCycle::Hlta => {
|
||||||
self.fp_state.set_addr(a);
|
|
||||||
self.fp_state.set_data(0xff);
|
self.fp_state.set_data(0xff);
|
||||||
}
|
}
|
||||||
MemCycle::In(a) => {
|
MemCycle::In(_) => {
|
||||||
self.fp_state.set_addr(a);
|
|
||||||
self.fp_state.set_data(0);
|
self.fp_state.set_data(0);
|
||||||
}
|
}
|
||||||
MemCycle::Inta(_) => todo!(),
|
MemCycle::Inta(_) => todo!(),
|
||||||
MemCycle::Hlta => {
|
|
||||||
self.fp_state.set_addr(0xffff);
|
|
||||||
self.fp_state.set_data(0xff);
|
|
||||||
}
|
|
||||||
MemCycle::IntaHlt(_) => todo!(),
|
MemCycle::IntaHlt(_) => todo!(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user