cpu/decoder - Implement LD HL, SP + e8
This commit is contained in:
parent
7180ae8c40
commit
4e506a4d3c
1 changed files with 14 additions and 0 deletions
|
@ -474,6 +474,20 @@ void Cpu::executeInstruction()
|
||||||
mcycles = 4;
|
mcycles = 4;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case 0xF8: // LD HL, SP + e8
|
||||||
|
{
|
||||||
|
u32 lhs = state.SP;
|
||||||
|
s32 rhs = (s8)readPC8();
|
||||||
|
u32 low_add = (lhs & 0x0FFF) + (rhs & 0x0FFF);
|
||||||
|
state.halfcarry = (low_add & 0x1000);
|
||||||
|
u32 res32 = lhs + rhs;
|
||||||
|
state.carry = (res32 & 0x10000);
|
||||||
|
state.HL = (u16)res32;
|
||||||
|
state.zero = false;
|
||||||
|
state.subtract = false;
|
||||||
|
mcycles = 3;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
panic("Unknown opcode 0x%x\n",op);
|
panic("Unknown opcode 0x%x\n",op);
|
||||||
|
|
Loading…
Reference in a new issue