def test_next_word_register_both(self): """ [Next word + register] into [Next word + register] """ self.cpu.registers[REG.B].value = 0x10 self.cpu.registers[REG.C].value = 0x20 self.cpu.ram[0x40].value = 0xfeed # SET [0x0010 + B], [0x0020 + C] self.cpu.ram[0].value = pack_instruction(op_code=OPCODE.SET, a=Value.addr_reg_next_word(REG.B), b=Value.addr_reg_next_word(REG.C)) self.cpu.ram[1].value = 0x10 self.cpu.ram[2].value = 0x20 self.emulator.dispatch() self.assertEqual(self.cpu.ram[0x20].value, 0xfeed, "Register + offset failed") self.assertEqual(self.cpu.PC.value, 0x3, "PC not set correctly")
def test_next_word_register(self): """ [Next word + register] into register """ self.cpu.registers[REG.B].value = 0x10 self.cpu.ram[0x20].value = 0xfeed # SET C, [B + next word] self.cpu.ram[0].value = pack_instruction(op_code=OPCODE.SET, a=Value.reg(REG.C), b=Value.addr_reg_next_word(REG.B)) self.cpu.ram[1].value = 0x10 self.emulator.dispatch() self.assertTrue(self.cpu.registers[REG.C].value == 0xfeed, "Register + offset failed")