mirror of
https://github.com/lloeki/python-dcpu_16.git
synced 2025-12-06 09:54:39 +01:00
fixing conditionals
This commit is contained in:
parent
930a04473c
commit
060ed1662f
1 changed files with 8 additions and 0 deletions
|
|
@ -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
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue