fixing conditionals

This commit is contained in:
Loic Nageleisen 2012-04-08 18:25:00 +02:00
parent 930a04473c
commit 060ed1662f

View file

@ -135,24 +135,32 @@ def XOR(c, a, b):
def IFE(c, a, b): def IFE(c, a, b):
"""performs next instruction only if a==b""" """performs next instruction only if a==b"""
if a() == b(): if a() == b():
c.skip = False
else:
c.skip = True c.skip = True
@opcode(0xD) @opcode(0xD)
def IFN(c, a, b): def IFN(c, a, b):
"""performs next instruction only if a!=b""" """performs next instruction only if a!=b"""
if a() != b(): if a() != b():
c.skip = False
else:
c.skip = True c.skip = True
@opcode(0xE) @opcode(0xE)
def IFG(c, a, b): def IFG(c, a, b):
"""performs next instruction only if a>b""" """performs next instruction only if a>b"""
if a() > b(): if a() > b():
c.skip = False
else:
c.skip = True c.skip = True
@opcode(0xF) @opcode(0xF)
def IFB(c, a, b): def IFB(c, a, b):
"""performs next instruction only if (a&b)!=0""" """performs next instruction only if (a&b)!=0"""
if (a() & b()) != 0: if (a() & b()) != 0:
c.skip = False
else:
c.skip = True c.skip = True