diff --git a/src/emulator/main.rs b/src/emulator/main.rs index 925aef5..8863c78 100644 --- a/src/emulator/main.rs +++ b/src/emulator/main.rs @@ -58,6 +58,20 @@ fn tick(state: &mut EmulatorState) { match instruction { 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 */ // INR 0x04 => arithmetic::inr(Register::B, state), @@ -90,20 +104,6 @@ fn tick(state: &mut EmulatorState) { 0xc6 => arithmetic::adi(next_byte(), state), // ADI 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), }