diff --git a/compiler/src/prog8/compiler/target/c64/codegen/BuiltinFunctionsAsmGen.kt b/compiler/src/prog8/compiler/target/c64/codegen/BuiltinFunctionsAsmGen.kt index 0e062d184..438fbeaeb 100644 --- a/compiler/src/prog8/compiler/target/c64/codegen/BuiltinFunctionsAsmGen.kt +++ b/compiler/src/prog8/compiler/target/c64/codegen/BuiltinFunctionsAsmGen.kt @@ -87,10 +87,6 @@ internal class BuiltinFunctionsAsmGen(private val program: Program, private val AsmAssignTarget.fromRegisters(resultRegister ?: RegisterOrPair.AY, null, program, asmgen) val assign = AsmAssignment(src, target, false, fcall.position) asmgen.translateNormalAssignment(assign) - - // remove the variable for the name, it's not used as a variable only as a tag for the assembler. - val nameDecl = scope.statements.single { it is VarDecl && it.name==nameRef.nameInSource.single() } - asmgen.removals.add(Pair(nameDecl, scope)) asmgen.slabs[name] = size } diff --git a/docs/source/todo.rst b/docs/source/todo.rst index 867e7299e..4aa3977a2 100644 --- a/docs/source/todo.rst +++ b/docs/source/todo.rst @@ -3,6 +3,7 @@ TODO ==== - add sound to the cx16 tehtriz +- hoist all variable declarations up to the subroutine scope *before* even the constant folding takes place (to avoid undefined symbol errors when referring to a variable from another nested scope in the subroutine) - refactor the asmgen into their own submodule? - refactor the compiler optimizers into their own submodule? - optimize swap of two memread values with index, using the same pointer expression/variable, like swap(@(ptr+1), @(ptr+2)) @@ -13,7 +14,6 @@ TODO - add a f_seek() routine for the Cx16 that uses its seek dos api? - optimizer: detect variables that are written but never read - mark those as unused too and remove them, such as uword unused = memory("unused222", 20) - also remove the memory slab allocation - add a compiler option to not remove unused subroutines. this allows for building library programs -- hoist all variable declarations up to the subroutine scope *before* even the constant folding takes place (to avoid undefined symbol errors when referring to a variable from another nested scope in the subroutine) - make it possible to use cpu opcodes such as 'nop' as variable names by prefixing all asm vars with something such as 'v_' - option to load the built-in library files from a directory instead of the embedded ones (for easier library development/debugging) - c64: make the graphics.BITMAP_ADDRESS configurable (VIC banking) diff --git a/examples/test.p8 b/examples/test.p8 index 3ebab9c8c..31548edce 100644 --- a/examples/test.p8 +++ b/examples/test.p8 @@ -6,45 +6,7 @@ main { sub start() { + uword zzz=memory("derp", 2000) txt.print("hello") - txt.print("hello2") - txt.print("hello") - txt.print("hello2") - txt.nl() - txt.print("1") - txt.print("1") - txt.nl() - txt.print("12") - txt.print("12") - txt.nl() - txt.print("123") - txt.print("123") - txt.nl() - - derp.derp2() - txt.chrout('!') - - sys.wait(3*60) - } -} - -derp { - - sub derp2 () { - txt.print("hello") - txt.print("hello2") - txt.print("hello") - txt.print("hello2") - txt.nl() - txt.print("1") - txt.print("1") - txt.nl() - txt.print("12") - txt.print("12") - txt.nl() - txt.print("123") - txt.print("123") - txt.nl() - } }