diff --git a/src/arch/z80/backend/generic.py b/src/arch/z80/backend/generic.py index 630db6514..08bb9286e 100644 --- a/src/arch/z80/backend/generic.py +++ b/src/arch/z80/backend/generic.py @@ -345,7 +345,7 @@ def _cast(ins: Quad): xsB = sB = YY_TYPES[tB] # Type sizes if tA in ("u8", "i8") and tB == "bool": - return [] # bytes are booleans already (0 = False, not 0 = True) + return [*Bits8.get_oper(ins[4]), "push af"] # bytes are booleans already (0 = False, not 0 = True) output = [] if tA in ("u8", "i8", "bool"): diff --git a/tests/functional/arch/zx48k/bool_crash.asm b/tests/functional/arch/zx48k/bool_crash.asm index 342deb639..0c3f73144 100644 --- a/tests/functional/arch/zx48k/bool_crash.asm +++ b/tests/functional/arch/zx48k/bool_crash.asm @@ -38,7 +38,7 @@ _ReadKeys: push ix ld ix, 0 add ix, sp - pop af + ld a, (_pldx) ld hl, (_pldx - 1) or h jp z, .LABEL.__LABEL1