diff --git a/codeGenCpu6502/src/prog8/codegen/cpu6502/AsmGen.kt b/codeGenCpu6502/src/prog8/codegen/cpu6502/AsmGen.kt index 5056e8f7a..01f174e8b 100644 --- a/codeGenCpu6502/src/prog8/codegen/cpu6502/AsmGen.kt +++ b/codeGenCpu6502/src/prog8/codegen/cpu6502/AsmGen.kt @@ -311,7 +311,7 @@ class AsmGen(internal val program: Program, is Subroutine -> programGen.translateSubroutine(stmt) is InlineAssembly -> translate(stmt) is BuiltinFunctionCallStatement -> builtinFunctionsAsmGen.translateFunctioncallStatement(stmt) - is FunctionCallStatement -> functioncallAsmGen.translateFunctionCallStatement(stmt) // TODO try to remove this last usage of FunctionCallStatement node in the codegen. + is FunctionCallStatement -> functioncallAsmGen.translateFunctionCallStatement(stmt) is Assignment -> assignmentAsmGen.translate(stmt) is Jump -> { val (asmLabel, indirect) = getJumpTarget(stmt) diff --git a/codeGenCpu6502/src/prog8/codegen/cpu6502/AsmOptimizer.kt b/codeGenCpu6502/src/prog8/codegen/cpu6502/AsmOptimizer.kt index b6f603f02..5deeb5406 100644 --- a/codeGenCpu6502/src/prog8/codegen/cpu6502/AsmOptimizer.kt +++ b/codeGenCpu6502/src/prog8/codegen/cpu6502/AsmOptimizer.kt @@ -59,7 +59,7 @@ internal fun optimizeAssembly(lines: MutableList, machine: IMachineDefin numberOfOptimizations++ } - // TODO more assembly optimizations + // TODO more assembly peephole optimizations return numberOfOptimizations } diff --git a/codeGenCpu6502/src/prog8/codegen/cpu6502/ProgramAndVarsGen.kt b/codeGenCpu6502/src/prog8/codegen/cpu6502/ProgramAndVarsGen.kt index 7da356855..d20d1ff5b 100644 --- a/codeGenCpu6502/src/prog8/codegen/cpu6502/ProgramAndVarsGen.kt +++ b/codeGenCpu6502/src/prog8/codegen/cpu6502/ProgramAndVarsGen.kt @@ -439,7 +439,7 @@ internal class ProgramAndVarsGen( val result = mutableListOf() val vars = allocator.zeropageVars.filter { it.value.dt==DataType.STR } for (variable in vars) { - val svar = symboltable.lookup(variable.key) as StStaticVariable // TODO faster in flat lookup table + val svar = symboltable.flat.getValue(variable.key) as StStaticVariable if(svar.initialStringValue!=null) result.add(ZpStringWithInitial(variable.key, variable.value, svar.initialStringValue!!)) } @@ -450,7 +450,7 @@ internal class ProgramAndVarsGen( val result = mutableListOf() val vars = allocator.zeropageVars.filter { it.value.dt in ArrayDatatypes } for (variable in vars) { - val svar = symboltable.lookup(variable.key) as StStaticVariable // TODO faster in flat lookup table + val svar = symboltable.flat.getValue(variable.key) as StStaticVariable if(svar.initialArrayValue!=null) result.add(ZpArrayWithInitial(variable.key, variable.value, svar.initialArrayValue!!)) } diff --git a/codeGenCpu6502/src/prog8/codegen/cpu6502/assignment/AssignmentAsmGen.kt b/codeGenCpu6502/src/prog8/codegen/cpu6502/assignment/AssignmentAsmGen.kt index 6649b5f75..cd847cc55 100644 --- a/codeGenCpu6502/src/prog8/codegen/cpu6502/assignment/AssignmentAsmGen.kt +++ b/codeGenCpu6502/src/prog8/codegen/cpu6502/assignment/AssignmentAsmGen.kt @@ -630,8 +630,6 @@ internal class AssignmentAsmGen(private val program: Program, } private fun fallbackToStackEval(assign: AsmAssignment) { - // TODO DON'T STACK-EVAL... perhaps by using a temp var? so that it becomes augmentable assignment expression? - // or don't try to solve it here in this one case and rather rewrite the whole stack based value evaluation. // this routine is called for assigning a binaryexpression value: // - if it's a boolean comparison expression and the workaround isn't possible (no origTarget ast node) // - for all other binary expressions. diff --git a/examples/test.p8 b/examples/test.p8 index 9fd30a7dc..0c15b341a 100644 --- a/examples/test.p8 +++ b/examples/test.p8 @@ -3,29 +3,11 @@ main { sub start() { - &bool b1 = $0200 - &uword mu1 = $0300 - &uword mu2 = $0302 + str @zp zpstr = "irmen" + ubyte[3] @zp zparr = [1,2,3] - &ubyte[4] marray = $0300 - &uword[4] mwarray= $0300 - &float[4] mfarray = $0400 - - mu1 = mu2 - b1 = true - bool b2 = true - bool b3 - - b2 = b2 and b1 - txt.print_ub(b2) - txt.nl() - - ubyte ub1 = 1 - ubyte ub2 = 2 - ubyte ub3 - - ub2 = ub2 + ub1 - txt.print_ub(ub2) + txt.print(zpstr) + txt.print_ub(zparr[2]) }