def test_asl(self, accumulator_state, expected): test_cpu = cpu.Cpu() test_cpu.accumulator = accumulator_state asl(test_cpu, cpu.AddressingMode.accumulator) assert test_cpu.accumulator == expected
def test_negative_flag(self, accumulator_state, expected): """Test that negative bit is set if the result is negative.""" test_cpu = cpu.Cpu() test_cpu.accumulator = accumulator_state asl(test_cpu, cpu.AddressingMode.accumulator) assert test_cpu.status.negative == expected
def test_zero_flag(self, accumulator_state, expected): """Test that result is zero.""" test_cpu = cpu.Cpu() test_cpu.accumulator = accumulator_state asl(test_cpu, cpu.AddressingMode.accumulator) assert test_cpu.status.zero == expected
def test_unaffected_flag(self, accumulator_state, flag_state): """Test that other flags are unchanged.""" test_cpu = cpu.Cpu() test_cpu.accumulator = accumulator_state test_cpu.status.interrupt_disable = flag_state test_cpu.status.decimal = flag_state test_cpu.status.break_ = flag_state test_cpu.status.overflow = flag_state asl(test_cpu, cpu.AddressingMode.accumulator) assert test_cpu.status.interrupt_disable == flag_state assert test_cpu.status.decimal == flag_state assert test_cpu.status.break_ == flag_state assert test_cpu.status.overflow == flag_state
def decode_instruction(self, opcode: int) -> None: # pragma: no cover """This function is currently a stub, will eventually be the only way to reference instructions.""" if opcode == 'PLACEHOLDER for add': addressing_mode = AddressingMode.immediate data = 0x0 add.add_with_carry(self, addressing_mode, data) elif opcode == 'PLACEHOLDER for and': addressing_mode = AddressingMode.immediate data = 0x0 and_.and_(self, addressing_mode, data) elif opcode == 'PLACEHOLDER for asl': addressing_mode = AddressingMode.immediate data = 0x0 asl.asl(self, addressing_mode) elif opcode == 'PLACEHOLDER for branch': data = 0x0 branch.branch_if_carry_clear(self, data) elif opcode == 'PLACEHOLDER for cmp': data = 0x0 cmp.cmp(self, data)