fix if-gosub

This commit is contained in:
Irmen de Jong 2021-12-28 01:24:31 +01:00
parent 1c7c4fc3b0
commit 79405f47f6
2 changed files with 7 additions and 6 deletions

View File

@ -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")

View File

@ -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