special instructions should come first

This commit is contained in:
Martin Löffler 2023-01-25 22:48:25 +01:00
parent 7737ab8de5
commit 1b7b942dff
Signed by: FatalErrorCoded
GPG key ID: FFEF368AC076566A

View file

@ -58,6 +58,20 @@ fn tick(state: &mut EmulatorState) {
match instruction { match instruction {
0x00 => {} // NOP 0x00 => {} // NOP
/* Special */
0xfb => state.ei = true, // EI
0xf3 => state.ei = false, // DI
0x76 => {
if state.ei {
todo!()
} else {
// HLT
println!("HLT called after DI; exiting.");
print_state(state);
std::process::exit(0);
}
}
/* Maths */ /* Maths */
// INR // INR
0x04 => arithmetic::inr(Register::B, state), 0x04 => arithmetic::inr(Register::B, state),
@ -90,20 +104,6 @@ fn tick(state: &mut EmulatorState) {
0xc6 => arithmetic::adi(next_byte(), state), // ADI 0xc6 => arithmetic::adi(next_byte(), state), // ADI
0xce => arithmetic::aci(next_byte(), state), // ACI 0xce => arithmetic::aci(next_byte(), state), // ACI
/* Special */
0xfb => state.ei = true, // EI
0xf3 => state.ei = false, // DI
0x76 => {
if state.ei {
todo!()
} else {
// HLT
println!("HLT called after DI; exiting.");
print_state(state);
std::process::exit(0);
}
}
_ => not_implemented(state), _ => not_implemented(state),
} }