fix(cpu): reimplement instruction handling
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2021-08-14 17:23:45 -05:00
parent 7e65d82fef
commit 5d6df46a2d
2 changed files with 80 additions and 78 deletions

View File

@@ -9,7 +9,7 @@ use self::table::{
};
use self::table::{Group1RegisterPair, Group2RegisterPair, Group3RegisterPair, Register};
use crate::bus::{Bus, BusIo};
use crate::cpu::{Cpu, Flags, HaltState, ImeState, Register as CpuRegister, RegisterPair};
use crate::cpu::{Cpu, Flags, HaltKind, ImeState, Register as CpuRegister, RegisterPair};
#[allow(clippy::upper_case_acronyms)]
#[derive(Clone, Copy)]
@@ -588,14 +588,14 @@ impl Instruction {
}
Instruction::HALT => {
// HALT | Enter CPU low power consumption mode until interrupt occurs
use HaltState::*;
use HaltKind::*;
let halt_state = match *cpu.ime() {
let kind = match *cpu.ime() {
ImeState::Enabled => ImeEnabled,
_ if cpu.int_request() & cpu.int_enable() != 0 => SomePending,
_ => NonePending,
};
cpu.halt(halt_state);
cpu.halt(kind);
Cycle::new(4)
}
Instruction::ADC(source) => match source {