def get_paramater(self, mode):
    param = self.memory[self.instruction_ptr]
    self.instruction_ptr += 1
    if (mode == self.PARAM_MODE_POS):
        addr = self.check_addr(param)
        val = self.memory[addr]
    elif (mode == self.PARAM_MODE_REL):
        addr = (self.relative_base + param)
        addr = self.check_addr(addr)
        val = self.memory[addr]
    elif (mode == self.PARAM_MODE_IMD):
        val = param
    else:
        raise Exception(f'Unkown paramater mode: {param}')
    return val
def get_paramater(self, mode):
    param = self.memory[self.instruction_ptr]
    self.instruction_ptr += 1
    if (mode == self.PARAM_MODE_POS):
        addr = self.check_addr(param)
        val = self.memory[addr]
    elif (mode == self.PARAM_MODE_REL):
        addr = (self.relative_base + param)
        addr = self.check_addr(addr)
        val = self.memory[addr]
    elif (mode == self.PARAM_MODE_IMD):
        val = param
    else:
        raise Exception(f'Unkown paramater mode: {param}')
    return val