[GB] CP Reg8 instruction supports all variants
@@ -1001,20 +1001,6 @@ impl CpuState {
self.instr_cp(val);
Some(InstrInfo::seq(2, 2))
}
- 0xbe => {
- // CP (HL)
- let val = self
- .reg(RegisterName::HL)
- .read_u8_with_mode(&self, AddressingMode::Deref);
- let a = self.reg(RegisterName::A);
-
- if debug {
- println!("CP {}{val:02x} with {a}", self.reg(RegisterName::HL));
- }
-
- self.instr_cp(val);
- Some(InstrInfo::seq(1, 2))
- }
0xf3 => {
// DI
let interrupt_controller = system.get_interrupt_controller();
@@ -1553,6 +1539,20 @@ impl CpuState {
// TODO(PT): Should be 2 for HL
InstrInfo::seq(1, 1)
}
+ "10111iii" => {
+ // CP Reg8
+ let (op, read_mode) = self.get_reg_from_lookup_tab1(i);
+ let val = op.read_u8_with_mode(&self, read_mode);
+ let a = self.reg(RegisterName::A);
+
+ if debug {
+ println!("CP {op} with {a}");
+ }
+
+ self.instr_cp(val);
+ // TODO(PT): Should be 2 for (HL)
+ InstrInfo::seq(1, 1)
+ }
_ => {
println!("<0x{:02x} is unimplemented>", instruction_byte);
self.print_regs();
