cpu/decoder - Use variable instead calculating twice

This commit is contained in:
madmaurice 2023-08-29 23:04:31 +02:00
parent 43088a7f99
commit e893d2b9f5

View file

@ -86,12 +86,13 @@ void Cpu::executeInstruction()
else if((op & 0xC0) == 0x80) // ADD, ADC, SUB, ABC, CP, AND, OR, XOR
{
AluOp aluop = (AluOp)((op >> 3) & 0x3);
u8 reg = op & 0x7;
u8 rhs;
switch(op & 0x7)
switch(reg)
{
case 0x6: rhs = bus->read8(state.HL); mcycles = 2; break;
default: rhs = state.reg8(op & 0x7); break;
default: rhs = state.reg8(reg); break;
}
aluop8(aluop, rhs);