From bf71fabe0e4fcd59f44259a7c2500e25fc142298 Mon Sep 17 00:00:00 2001 From: Irmen de Jong Date: Sun, 16 Jan 2022 18:09:09 +0100 Subject: [PATCH] fix codegen mistake for zp allocated loop vars --- .../prog8/codegen/target/cpu6502/codegen/ForLoopsAsmGen.kt | 4 ++-- docs/source/todo.rst | 2 -- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/codeGeneration/src/prog8/codegen/target/cpu6502/codegen/ForLoopsAsmGen.kt b/codeGeneration/src/prog8/codegen/target/cpu6502/codegen/ForLoopsAsmGen.kt index c0566e8d4..bb466c649 100644 --- a/codeGeneration/src/prog8/codegen/target/cpu6502/codegen/ForLoopsAsmGen.kt +++ b/codeGeneration/src/prog8/codegen/target/cpu6502/codegen/ForLoopsAsmGen.kt @@ -293,7 +293,7 @@ $loopLabel sty $indexVar // allocate index var on ZP if possible val result = asmgen.zeropage.allocate(listOf(indexVar), DataType.UBYTE, null, stmt.position, asmgen.errors) result.fold( - success = { zpAddr-> asmgen.out("""$indexVar = $zpAddr ; auto zp UBYTE""") }, + success = { (address,_)-> asmgen.out("""$indexVar = $address ; auto zp UBYTE""") }, failure = { asmgen.out("$indexVar .byte 0") } ) } else { @@ -334,7 +334,7 @@ $loopLabel sty $indexVar // allocate index var on ZP if possible val result = asmgen.zeropage.allocate(listOf(indexVar), DataType.UBYTE, null, stmt.position, asmgen.errors) result.fold( - success = { zpAddr-> asmgen.out("""$indexVar = $zpAddr ; auto zp UBYTE""") }, + success = { (address,_)-> asmgen.out("""$indexVar = $address ; auto zp UBYTE""") }, failure = { asmgen.out("$indexVar .byte 0") } ) } else { diff --git a/docs/source/todo.rst b/docs/source/todo.rst index ed332e62e..5d816f6b1 100644 --- a/docs/source/todo.rst +++ b/docs/source/todo.rst @@ -3,8 +3,6 @@ TODO For next compiler release (7.7) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -- fix crash after enter in bdmusic (caused by ZP branch) -- fix crash in sorting (caused by ZP branch) - if zp option = dontuse, give error if any variable has @requirezp Need help with