示例#1
0
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_opcode(0x0, o, a,)]
    else:
        return [from_opcode(0x0, o, a,), first_word]
示例#2
0
def instruction(self, op, a, b):
    # 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_opcode(o, a, b)] + not_nones
示例#3
0
 def assertParses(self, given, expected):
     self.assertEquals(self.parse(given), [from_opcode(*expected[:3])] +
             expected[3:])
示例#4
0
 def test_from_opcode(self):
     for code, (eo, ea, eb) in instructions.items():
         self.assertEquals(from_opcode(eo, ea, eb), code)