diff --git a/codeGeneration/src/prog8/compiler/target/cpu6502/codegen/AsmGen.kt b/codeGeneration/src/prog8/compiler/target/cpu6502/codegen/AsmGen.kt index a1920e138..74b259797 100644 --- a/codeGeneration/src/prog8/compiler/target/cpu6502/codegen/AsmGen.kt +++ b/codeGeneration/src/prog8/compiler/target/cpu6502/codegen/AsmGen.kt @@ -1098,8 +1098,9 @@ class AsmGen(private val program: Program, val booleanCondition = stmt.condition as BinaryExpression if (stmt.elsepart.isEmpty()) { - if(stmt.truepart.statements.singleOrNull() is Jump) { - translateCompareAndJumpIfTrue(booleanCondition, stmt.truepart.statements[0] as Jump) + val jump = stmt.truepart.statements.singleOrNull() + if(jump is Jump && !jump.isGosub) { + translateCompareAndJumpIfTrue(booleanCondition, jump) } else { val endLabel = makeLabel("if_end") translateCompareAndJumpIfFalse(booleanCondition, endLabel) @@ -1612,6 +1613,8 @@ $label nop""") } private fun translateCompareAndJumpIfTrue(expr: BinaryExpression, jump: Jump) { + require(!jump.isGosub) + if(expr.operator !in ComparisonOperators) throw AssemblyError("must be comparison expression") diff --git a/docs/source/todo.rst b/docs/source/todo.rst index 307f7fbe9..8fc6cb51b 100644 --- a/docs/source/todo.rst +++ b/docs/source/todo.rst @@ -3,10 +3,8 @@ TODO For next compiler release (7.6) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -fix imageviewer pcx decoding, broken since if/goto changes... -also wormfood: worm freezes when you press fire... -also petaxian: gameplay doesn't work at all anymore -also textelite: after showing map, it just exits +fix imageviewer crashes... +also textelite: after showing map, it continues to show the market without keyboard entry... Blocked by an official Commander-x16 v39 release