Exemplo n.º 1
0
 def test_set_reg_to_literal(self):
     """ Sets a register to a literal """
     # SET A, 0x10
     self.cpu.ram[0].value = pack_instruction(op_code=OPCODE.SET,
                                              a=Value.reg(REG.A),
                                              b=Value.literal(0x10))
     self.emulator.dispatch()
     self.assertTrue(self.cpu.registers[REG.A].value == 0x10, "Register value error")
Exemplo n.º 2
0
    def test_set_pc(self):
        """ Sets PC """

        self.cpu.ram[0].value = pack_instruction(op_code=OPCODE.SET,
                                                 a=Value.pc(),
                                                 b=Value.literal(0x5))
        self.emulator.dispatch()

        self.assertEqual(self.cpu.PC.value, 0x5, "PC Loading failed")
Exemplo n.º 3
0
    def test_set_sp(self):
        """ Sets SP """

        # SET SP, 0x02
        self.cpu.ram[0].value = pack_instruction(op_code=OPCODE.SET,
                                                 a=Value.sp(),
                                                 b=Value.literal(0x02))
        self.emulator.dispatch()

        self.assertTrue(self.cpu.SP.value == 0x2, "SP Loading failed")