from error import * CMDs = ["jmp", "jmp_if"] def jmp(self, operand): if operand[0].isImmediate(): if operand[0].get() > len(self.cmdMemory): raise AddressError() self.pc = operand[0].get() else: raise BadOperand() def jmp_if(self, operand): if operand[0].isImmediate(): if operand[1].isImmediate() or operand[1].isRegister(): if operand[0].get() > len(self.cmdMemory): raise AddressError() if operand[1].get() == 1: self.pc = operand[0].get() else: raise BadOperand()