|
@ -902,6 +902,7 @@ class SLA_R(Insn): |
|
|
|
|
|
|
|
|
def exec(self, cpu: CPU) -> None: |
|
|
def exec(self, cpu: CPU) -> None: |
|
|
r = cpu.get_reg8(self.r) |
|
|
r = cpu.get_reg8(self.r) |
|
|
|
|
|
cpu.carry = 1 if r & (1 << 7) else 0 |
|
|
cpu.set_reg8(self.r, (r << 1) & 0xFF) |
|
|
cpu.set_reg8(self.r, (r << 1) & 0xFF) |
|
|
cpu.cycles += 8 |
|
|
cpu.cycles += 8 |
|
|
|
|
|
|
|
@ -913,6 +914,7 @@ class SLA_R(Insn): |
|
|
class SLA_HL(Insn): |
|
|
class SLA_HL(Insn): |
|
|
def exec(self, cpu: CPU) -> None: |
|
|
def exec(self, cpu: CPU) -> None: |
|
|
hl = cpu.deref_hl() |
|
|
hl = cpu.deref_hl() |
|
|
|
|
|
cpu.carry = 1 if hl & (1 << 7) else 0 |
|
|
cpu.deref_hl_set((hl << 1) & 0xFF) |
|
|
cpu.deref_hl_set((hl << 1) & 0xFF) |
|
|
cpu.cycles += 16 |
|
|
cpu.cycles += 16 |
|
|
|
|
|
|
|
@ -927,6 +929,7 @@ class SWAP_R(Insn): |
|
|
def exec(self, cpu: CPU) -> None: |
|
|
def exec(self, cpu: CPU) -> None: |
|
|
r = cpu.get_reg8(self.r) |
|
|
r = cpu.get_reg8(self.r) |
|
|
cpu.set_reg8(self.r, ((r << 4) & 0xFF) | (r >> 4)) |
|
|
cpu.set_reg8(self.r, ((r << 4) & 0xFF) | (r >> 4)) |
|
|
|
|
|
cpu.carry = 0 |
|
|
cpu.cycles += 8 |
|
|
cpu.cycles += 8 |
|
|
|
|
|
|
|
|
def pretty(self) -> str: |
|
|
def pretty(self) -> str: |
|
@ -938,6 +941,7 @@ class SWAP_HL(Insn): |
|
|
def exec(self, cpu: CPU) -> None: |
|
|
def exec(self, cpu: CPU) -> None: |
|
|
hl = cpu.deref_hl() |
|
|
hl = cpu.deref_hl() |
|
|
cpu.deref_hl_set(((hl << 4) & 0xFF) | (hl >> 4)) |
|
|
cpu.deref_hl_set(((hl << 4) & 0xFF) | (hl >> 4)) |
|
|
|
|
|
cpu.carry = 0 |
|
|
cpu.cycles += 16 |
|
|
cpu.cycles += 16 |
|
|
|
|
|
|
|
|
def pretty(self) -> str: |
|
|
def pretty(self) -> str: |
|
@ -950,6 +954,7 @@ class SRA_R(Insn): |
|
|
|
|
|
|
|
|
def exec(self, cpu: CPU) -> None: |
|
|
def exec(self, cpu: CPU) -> None: |
|
|
r = cpu.get_reg8(self.r) |
|
|
r = cpu.get_reg8(self.r) |
|
|
|
|
|
cpu.carry = 1 if r & (1 << 0) else 0 |
|
|
cpu.set_reg8(self.r, (r >> 1) | (r & (1 << 7))) |
|
|
cpu.set_reg8(self.r, (r >> 1) | (r & (1 << 7))) |
|
|
cpu.cycles += 8 |
|
|
cpu.cycles += 8 |
|
|
|
|
|
|
|
@ -961,6 +966,7 @@ class SRA_R(Insn): |
|
|
class SRA_HL(Insn): |
|
|
class SRA_HL(Insn): |
|
|
def exec(self, cpu: CPU) -> None: |
|
|
def exec(self, cpu: CPU) -> None: |
|
|
hl = cpu.deref_hl() |
|
|
hl = cpu.deref_hl() |
|
|
|
|
|
cpu.carry = 1 if hl & (1 << 0) else 0 |
|
|
cpu.deref_hl_set((hl >> 1) | (hl & (1 << 7))) |
|
|
cpu.deref_hl_set((hl >> 1) | (hl & (1 << 7))) |
|
|
cpu.cycles += 16 |
|
|
cpu.cycles += 16 |
|
|
|
|
|
|
|
@ -974,6 +980,7 @@ class SRL_R(Insn): |
|
|
|
|
|
|
|
|
def exec(self, cpu: CPU) -> None: |
|
|
def exec(self, cpu: CPU) -> None: |
|
|
r = cpu.get_reg8(self.r) |
|
|
r = cpu.get_reg8(self.r) |
|
|
|
|
|
cpu.carry = 1 if r & (1 << 0) else 0 |
|
|
cpu.set_reg8(self.r, r >> 1) |
|
|
cpu.set_reg8(self.r, r >> 1) |
|
|
cpu.cycles += 8 |
|
|
cpu.cycles += 8 |
|
|
|
|
|
|
|
@ -985,6 +992,7 @@ class SRL_R(Insn): |
|
|
class SRL_HL(Insn): |
|
|
class SRL_HL(Insn): |
|
|
def exec(self, cpu: CPU) -> None: |
|
|
def exec(self, cpu: CPU) -> None: |
|
|
hl = cpu.deref_hl() |
|
|
hl = cpu.deref_hl() |
|
|
|
|
|
cpu.carry = 1 if hl & (1 << 0) else 0 |
|
|
cpu.deref_hl_set(hl >> 1) |
|
|
cpu.deref_hl_set(hl >> 1) |
|
|
cpu.cycles += 16 |
|
|
cpu.cycles += 16 |
|
|
|
|
|
|
|
|