|
|
@ -91,17 +91,17 @@ def test_rlc_r(r): |
|
|
|
|
|
|
|
def test_rlc_hl(): |
|
|
|
cpu = CPU() |
|
|
|
cpu.deref_hl_set(0x80) |
|
|
|
cpu.hl = 0x80 |
|
|
|
|
|
|
|
RLC_HL().exec(cpu) |
|
|
|
|
|
|
|
assert cpu.deref_hl() == 0x01 |
|
|
|
assert cpu.hl == 0x01 |
|
|
|
assert cpu.state.carry == 1 |
|
|
|
assert cpu.state.cycles == 16 |
|
|
|
|
|
|
|
RLC_HL().exec(cpu) |
|
|
|
|
|
|
|
assert cpu.deref_hl() == 0x02 |
|
|
|
assert cpu.hl == 0x02 |
|
|
|
assert cpu.state.carry == 0 |
|
|
|
assert cpu.state.cycles == 32 |
|
|
|
|
|
|
@ -126,17 +126,17 @@ def test_rl_r(r): |
|
|
|
|
|
|
|
def test_rl_hl(): |
|
|
|
cpu = CPU() |
|
|
|
cpu.deref_hl_set(0x80) |
|
|
|
cpu.hl = 0x80 |
|
|
|
|
|
|
|
RL_HL().exec(cpu) |
|
|
|
|
|
|
|
assert cpu.deref_hl() == 0x00 |
|
|
|
assert cpu.hl == 0x00 |
|
|
|
assert cpu.state.carry == 1 |
|
|
|
assert cpu.state.cycles == 16 |
|
|
|
|
|
|
|
RL_HL().exec(cpu) |
|
|
|
|
|
|
|
assert cpu.deref_hl() == 0x01 |
|
|
|
assert cpu.hl == 0x01 |
|
|
|
assert cpu.state.carry == 0 |
|
|
|
assert cpu.state.cycles == 32 |
|
|
|
|
|
|
@ -162,17 +162,17 @@ def test_rrc_r(r): |
|
|
|
def test_rrc_hl(): |
|
|
|
cpu = CPU() |
|
|
|
cpu.set_reg16(R16.HL, 0x1234) |
|
|
|
cpu.deref_hl_set(0x01) |
|
|
|
cpu.hl = 0x01 |
|
|
|
|
|
|
|
RRC_HL().exec(cpu) |
|
|
|
|
|
|
|
assert cpu.deref_hl() == 0x80 |
|
|
|
assert cpu.hl == 0x80 |
|
|
|
assert cpu.state.carry == 1 |
|
|
|
assert cpu.state.cycles == 16 |
|
|
|
|
|
|
|
RRC_HL().exec(cpu) |
|
|
|
|
|
|
|
assert cpu.deref_hl() == 0x40 |
|
|
|
assert cpu.hl == 0x40 |
|
|
|
assert cpu.state.carry == 0 |
|
|
|
assert cpu.state.cycles == 32 |
|
|
|
|
|
|
@ -198,17 +198,17 @@ def test_rr_r(r): |
|
|
|
def test_rr_hl(): |
|
|
|
cpu = CPU() |
|
|
|
cpu.set_reg16(R16.HL, 0x1234) |
|
|
|
cpu.deref_hl_set(0x01) |
|
|
|
cpu.hl = 0x01 |
|
|
|
|
|
|
|
RR_HL().exec(cpu) |
|
|
|
|
|
|
|
assert cpu.deref_hl() == 0x00 |
|
|
|
assert cpu.hl == 0x00 |
|
|
|
assert cpu.state.carry == 1 |
|
|
|
assert cpu.state.cycles == 16 |
|
|
|
|
|
|
|
RR_HL().exec(cpu) |
|
|
|
|
|
|
|
assert cpu.deref_hl() == 0x80 |
|
|
|
assert cpu.hl == 0x80 |
|
|
|
assert cpu.state.carry == 0 |
|
|
|
assert cpu.state.cycles == 32 |
|
|
|
|
|
|
@ -235,18 +235,18 @@ def test_sla_r(r): |
|
|
|
def test_sla_hl(): |
|
|
|
cpu = CPU() |
|
|
|
cpu.set_reg16(R16.HL, 0x1234) |
|
|
|
cpu.deref_hl_set(0xFF) |
|
|
|
cpu.hl = 0xFF |
|
|
|
|
|
|
|
SLA_HL().exec(cpu) |
|
|
|
|
|
|
|
assert cpu.deref_hl() == 0xFE |
|
|
|
assert cpu.hl == 0xFE |
|
|
|
assert cpu.state.carry == 1 |
|
|
|
assert cpu.state.cycles == 16 |
|
|
|
|
|
|
|
cpu.deref_hl_set(0x01) |
|
|
|
cpu.hl = 0x01 |
|
|
|
SLA_HL().exec(cpu) |
|
|
|
|
|
|
|
assert cpu.deref_hl() == 0x02 |
|
|
|
assert cpu.hl == 0x02 |
|
|
|
assert cpu.state.carry == 0 |
|
|
|
assert cpu.state.cycles == 32 |
|
|
|
|
|
|
@ -266,11 +266,11 @@ def test_swap_r(r): |
|
|
|
def test_swap_hl(): |
|
|
|
cpu = CPU() |
|
|
|
cpu.set_reg16(R16.HL, 0x1234) |
|
|
|
cpu.deref_hl_set(0xAB) |
|
|
|
cpu.hl = 0xAB |
|
|
|
|
|
|
|
SWAP_HL().exec(cpu) |
|
|
|
|
|
|
|
assert cpu.deref_hl() == 0xBA |
|
|
|
assert cpu.hl == 0xBA |
|
|
|
assert cpu.state.carry == 0 |
|
|
|
assert cpu.state.cycles == 16 |
|
|
|
|
|
|
@ -297,18 +297,18 @@ def test_sra_r(r): |
|
|
|
def test_sra_hl(): |
|
|
|
cpu = CPU() |
|
|
|
cpu.set_reg16(R16.HL, 0x1234) |
|
|
|
cpu.deref_hl_set(0xFF) |
|
|
|
cpu.hl = 0xFF |
|
|
|
|
|
|
|
SRA_HL().exec(cpu) |
|
|
|
|
|
|
|
assert cpu.deref_hl() == 0xFF |
|
|
|
assert cpu.hl == 0xFF |
|
|
|
assert cpu.state.carry == 1 |
|
|
|
assert cpu.state.cycles == 16 |
|
|
|
|
|
|
|
cpu.deref_hl_set(0x02) |
|
|
|
cpu.hl = 0x02 |
|
|
|
SRA_HL().exec(cpu) |
|
|
|
|
|
|
|
assert cpu.deref_hl() == 0x01 |
|
|
|
assert cpu.hl == 0x01 |
|
|
|
assert cpu.state.carry == 0 |
|
|
|
assert cpu.state.cycles == 32 |
|
|
|
|
|
|
@ -335,17 +335,17 @@ def test_srl_r(r): |
|
|
|
def test_srl_hl(): |
|
|
|
cpu = CPU() |
|
|
|
cpu.set_reg16(R16.HL, 0x1234) |
|
|
|
cpu.deref_hl_set(0xFF) |
|
|
|
cpu.hl = 0xFF |
|
|
|
|
|
|
|
SRL_HL().exec(cpu) |
|
|
|
|
|
|
|
assert cpu.deref_hl() == 0x7F |
|
|
|
assert cpu.hl == 0x7F |
|
|
|
assert cpu.state.carry == 1 |
|
|
|
assert cpu.state.cycles == 16 |
|
|
|
|
|
|
|
cpu.deref_hl_set(0x02) |
|
|
|
cpu.hl = 0x02 |
|
|
|
SRL_HL().exec(cpu) |
|
|
|
|
|
|
|
assert cpu.deref_hl() == 0x01 |
|
|
|
assert cpu.hl == 0x01 |
|
|
|
assert cpu.state.carry == 0 |
|
|
|
assert cpu.state.cycles == 32 |