<filename>vm/instruction_set.py<gh_stars>0
import logging

from instruction import Instruction


class Set_Instruction(Instruction):

    def __init__(self, register, value):
        self.register = register
        self.value = value

    def dump(self, vm_state):
        return "[{:04X}] SET {:0} {:0}".format(vm_state["instruction_pointer"]-3, self.register, self.value)

    def execute(self, vm_state):
        value = self._get_value(vm_state, self.value)
        self._set_value(vm_state, self.register, value)
