From 0b464e6ebc5156a42c564dd2916f0b31831f0761 Mon Sep 17 00:00:00 2001 From: velllu <91963404+velllu@users.noreply.github.com> Date: Wed, 6 Sep 2023 22:39:28 +0200 Subject: [PATCH] Added `IME` flag and `DI` instruction --- src/cpu.rs | 3 +++ src/flags.rs | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/src/cpu.rs b/src/cpu.rs index 82070a9..a097744 100644 --- a/src/cpu.rs +++ b/src/cpu.rs @@ -275,6 +275,9 @@ impl GameBoy { 0xAD => { self.xor_r(OneByteRegister::L); (1, 1) }, 0xAF => { self.xor_r(OneByteRegister::A); (1, 1) }, + // Interrupt stuff + 0xF3 => { self.flags.ime = true; (1, 1) }, + _ => panic!("Opcode {:x} not implemented yet", opcode), } } diff --git a/src/flags.rs b/src/flags.rs index c432e80..7c2bd8a 100644 --- a/src/flags.rs +++ b/src/flags.rs @@ -4,6 +4,10 @@ pub struct Flags { /// sets the zero flag pub zero: bool, + /// IME, standing for "Interrupt Master Enable" is basically a switch on whether + /// interrupts should be handled or not + pub ime: bool, + // TODO: Document this other flags pub substraction: bool, pub half_carry: bool, @@ -14,6 +18,7 @@ impl Flags { pub(crate) fn new() -> Self { Self { zero: false, + ime: false, substraction: false, half_carry: false, carry: false,