|
@ -717,7 +717,8 @@ class ADD_SP_DD(Insn): |
|
|
def exec(self, cpu: CPU) -> None: |
|
|
def exec(self, cpu: CPU) -> None: |
|
|
sp = cpu.get_reg16(R16.SP) + self.dd |
|
|
sp = cpu.get_reg16(R16.SP) + self.dd |
|
|
cpu.carry = 1 if sp > 0xFFFF or sp < 0 else 0 |
|
|
cpu.carry = 1 if sp > 0xFFFF or sp < 0 else 0 |
|
|
cpu.set_reg16(R16.SP, sp) |
|
|
|
|
|
|
|
|
cpu.set_reg16(R16.SP, sp & 0xFFFF) |
|
|
|
|
|
cpu.cycles += 16 |
|
|
|
|
|
|
|
|
def pretty(self) -> str: |
|
|
def pretty(self) -> str: |
|
|
return f"ADD SP, {self.dd}" |
|
|
return f"ADD SP, {self.dd}" |
|
@ -730,7 +731,8 @@ class LD_HL_SP_DD(Insn): |
|
|
def exec(self, cpu: CPU) -> None: |
|
|
def exec(self, cpu: CPU) -> None: |
|
|
sp = cpu.get_reg16(R16.SP) + self.dd |
|
|
sp = cpu.get_reg16(R16.SP) + self.dd |
|
|
cpu.carry = 1 if sp > 0xFFFF or sp < 0 else 0 |
|
|
cpu.carry = 1 if sp > 0xFFFF or sp < 0 else 0 |
|
|
cpu.set_reg16(R16.HL, sp) |
|
|
|
|
|
|
|
|
cpu.set_reg16(R16.HL, sp & 0xFFFF) |
|
|
|
|
|
cpu.cycles += 12 |
|
|
|
|
|
|
|
|
def pretty(self) -> str: |
|
|
def pretty(self) -> str: |
|
|
return f"LD HL, SP + {self.dd}" |
|
|
return f"LD HL, SP + {self.dd}" |
|
|