def nonbasic_instructions(self, op, a): # parse the opcode first, so it Defers right of the bat if this is an # illegal opcode o = self.special_opcode(op) a, first_word = self.values.parse(a) if first_word == None: return [from_instruction(0x0, o, a,)] else: return [from_instruction(0x0, o, a,), first_word]
def instruction(self, op, b, a): # parse the opcode first, so it Defers right of the bat if this is an # illegal opcode o = self.opcode(op) # get the value codes and extra words for each argument a, first_word = self.values.parse(a) b, second_word = self.values.parse(b) # filter out Nones not_nones = list(n for n in (first_word, second_word) if n != None) return [from_instruction(o, b, a)] + not_nones
def test_from_instruction(self): for code, (eo, eb, ea) in instructions.items(): self.assertEquals(from_instruction(eo, eb, ea), code)