diff --git a/src/processor/instructions/primitives.rs b/src/processor/instructions/primitives.rs index 23550ad..d3fbd8c 100644 --- a/src/processor/instructions/primitives.rs +++ b/src/processor/instructions/primitives.rs @@ -106,12 +106,6 @@ impl CPU { .set_low(self.reg.af.get_low().bitand(!(1 << flag as u8))); } - pub(crate) fn toggle_flag(&mut self, flag: Flags) { - self.reg - .af - .set_low(self.reg.af.get_low().bitxor(1 << flag as u8)); - } - pub(crate) fn set_or_clear_flag(&mut self, flag: Flags, state: bool) { if state { self.set_flag(flag) @@ -170,18 +164,6 @@ impl CPU { return result; } - pub(crate) fn sub_u16s(&mut self, first: u16, second: u16) -> u16 { - let (result, carry) = first.overflowing_sub(second); - self.set_flag(Flags::NSubtract); - self.set_or_clear_flag(Flags::Carry, carry); - self.set_or_clear_flag(Flags::Zero, result == 0x0); - self.set_or_clear_flag( - Flags::HalfCarry, - (((first & 0xFFF).wrapping_sub(second & 0xFFF)) & 0x1000) == 0x1000, - ); - return result; - } - pub(crate) fn dec_raw(&mut self, val: u8) -> u8 { let result = val.wrapping_sub(0x1); self.set_flag(Flags::NSubtract); diff --git a/src/processor/opcodes.rs b/src/processor/opcodes.rs index ce1a5b2..58ea47b 100644 --- a/src/processor/opcodes.rs +++ b/src/processor/opcodes.rs @@ -1,18 +1,8 @@ -use crate::verbose_println; -use std::ops::{BitAnd, BitOr, BitXor}; - use super::{as_signed, res, set, swap_nibbles, Flags, Reg8, SplitRegister, CPU}; impl CPU { #[allow(dead_code)] pub fn run_opcode(&mut self, opcode: u8) { - if self.memory.ime_scheduled > 0 { - self.memory.ime_scheduled = self.memory.ime_scheduled.saturating_sub(1); - if self.memory.ime_scheduled == 0 { - self.memory.ime = true; - } - } - match opcode { 0x00 => { // noop