Beispiel #1
0
    def test_op_jg_specials(self):
        op = opcodes.op_jg()
        op.operands = [0x7, 0x4]
        op.optypes = [opcodes.TYPE_SMALL, opcodes.TYPE_SMALL]
        op.branch_loc = 0x00
        op.branch_condition = True

        self.mymox.ResetAll()
        self.cpu.ret(0)
        self.mymox.ReplayAll()
        op.operands = [0x7, 0x4]
        op.execute(self.cpu)
        self.mymox.VerifyAll()
        self.mymox.ResetAll()
        op.branch_loc = 0x01
        self.cpu.ret(1)
        self.mymox.ReplayAll()
        op.execute(self.cpu)
        self.mymox.VerifyAll()
Beispiel #2
0
    def test_op_jg(self):
        op = opcodes.op_jg()
        op.operands = [0x7, 0x4]
        op.optypes = [opcodes.TYPE_SMALL, opcodes.TYPE_SMALL]
        op.branch_loc = 0x0C
        op.branch_condition = True

        self.mymox.ResetAll()
        # No interactions expected
        self.mymox.ReplayAll()
        op.operands = [0x7, 0x9]
        op.execute(self.cpu)
        self.mymox.VerifyAll()

        self.mymox.ResetAll()
        self.cpu.get_pc().AndReturn(0x00)
        self.cpu.set_pc(0x0A)
        self.mymox.ReplayAll()

        op.operands = [0x7, 0x4]
        op.execute(self.cpu)
        self.mymox.VerifyAll()

        self.mymox.ResetAll()
        # No interactions expected
        self.mymox.ReplayAll()

        op.branch_condition = False
        op.execute(self.cpu)
        self.mymox.VerifyAll()

        self.mymox.ResetAll()
        self.cpu.get_pc().AndReturn(0x00)
        self.cpu.set_pc(0x0A)
        self.mymox.ReplayAll()

        op.operands = [0x7, 0x9]
        op.execute(self.cpu)
        self.mymox.VerifyAll()