This commit is contained in:
Alex Janka 2023-02-02 11:00:47 +11:00
parent e4ba687968
commit 8fc35fa1e1
2 changed files with 0 additions and 28 deletions

View file

@ -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);

View file

@ -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