CMDs = ["eq", 'halt'] # , 'en', 'gt', 'lt', 'ge', 'le'] def CheckArg(operand): run = False if operand[0].isRegister(): if operand[1].isRegister(): run = True elif operand[0].isRegister(): if operand[1].isImmediate(): run = True else: raise BadOperand() return run def eq(self, operand): if CheckArg(operand) and operand[2].isRegister(): # 是否等于 a = operand[0].get() b = operand[1].get if a == b: operand[2].set(1) else: operand[2].set(0) def halt(self, operand): return False