Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 13 additions & 13 deletions src/arch/z80/backend/_16bit.py
Original file line number Diff line number Diff line change
Expand Up @@ -1102,20 +1102,20 @@ def jgezerou16(cls, ins: Quad) -> list[str]:
output.append("jp %s" % str(ins[2]))
return output

@classmethod
def jgezeroi16(cls, ins: Quad) -> list[str]:
"""Jumps if top of the stack (16bit) is >= 0 to arg(1)"""
value = ins[1]
if is_int(value):
if int(value) >= 0:
return ["jp %s" % str(ins[2])] # Always true
else:
return []

def _jgezeroi16(ins: Quad) -> list[str]:
"""Jumps if top of the stack (16bit) is >= 0 to arg(1)"""
value = ins[1]
if is_int(value):
if int(value) >= 0:
return ["jp %s" % str(ins[2])] # Always true
else:
return []

output = Bits16.get_oper(value)
output.append("add hl, hl") # Puts sign into carry
output.append("jp nc, %s" % str(ins[2]))
return output
output = Bits16.get_oper(value)
output.append("add hl, hl") # Puts sign into carry
output.append("jp nc, %s" % str(ins[2]))
return output


def _ret16(ins: Quad) -> list[str]:
Expand Down
3 changes: 1 addition & 2 deletions src/arch/z80/backend/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
from ._16bit import (
Bits16,
_fparam16,
_jgezeroi16,
_jnzero16,
_param16,
_ret16,
Expand Down Expand Up @@ -329,7 +328,7 @@ def _set_quad_table(self):
ICInstruction.JNZEROSTR: ICInfo(2, String.jnzerostr), # if str is not NULL and len(str) > 0, jmp LABEL
ICInstruction.JGEZEROI8: ICInfo(2, Bits8.jgezeroi8), # if X >= 0 jmp LABEL
ICInstruction.JGEZEROU8: ICInfo(2, Bits8.jgezerou8), # if X >= 0 jmp LABEL (ALWAYS TRUE)
ICInstruction.JGEZEROI16: ICInfo(2, _jgezeroi16), # if X >= 0 jmp LABEL
ICInstruction.JGEZEROI16: ICInfo(2, Bits16.jgezeroi16), # if X >= 0 jmp LABEL
ICInstruction.JGEZEROU16: ICInfo(2, Bits16.jgezerou16), # if X >= 0 jmp LABEL (ALWAYS TRUE)
ICInstruction.JGEZEROI32: ICInfo(2, Bits32.jgezeroi32), # if X >= 0 jmp LABEL (32bit, fixed)
ICInstruction.JGEZEROU32: ICInfo(2, Bits32.jgezerou32), # if X >= 0 jmp LABEL (32bit, fixed) (always true)
Expand Down