From 310219e5d78f1ad4973751e9cbd2e33f70677ba1 Mon Sep 17 00:00:00 2001 From: Irmen de Jong Date: Sun, 31 Jul 2022 15:37:36 +0200 Subject: [PATCH] make sure memory slabs block is at the bottom of the asm file to not allocate needless space in the resulting prg --- .../prog8/codegen/cpu6502/ProgramAndVarsGen.kt | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/codeGenCpu6502/src/prog8/codegen/cpu6502/ProgramAndVarsGen.kt b/codeGenCpu6502/src/prog8/codegen/cpu6502/ProgramAndVarsGen.kt index 09463c027..8bf4fe579 100644 --- a/codeGenCpu6502/src/prog8/codegen/cpu6502/ProgramAndVarsGen.kt +++ b/codeGenCpu6502/src/prog8/codegen/cpu6502/ProgramAndVarsGen.kt @@ -44,6 +44,15 @@ internal class ProgramAndVarsGen( if(errors.noErrors()) { program.allBlocks.forEach { block2asm(it) } + + // the global list of all floating point constants for the whole program + asmgen.out("; global float constants") + for (flt in allocator.globalFloatConsts) { + val floatFill = compTarget.machine.getFloat(flt.key).makeFloatFillAsm() + val floatvalue = flt.key + asmgen.out("${flt.value}\t.byte $floatFill ; float $floatvalue") + } + memorySlabs() footer() } @@ -170,14 +179,6 @@ internal class ProgramAndVarsGen( } private fun footer() { - // the global list of all floating point constants for the whole program - asmgen.out("; global float constants") - for (flt in allocator.globalFloatConsts) { - val floatFill = compTarget.machine.getFloat(flt.key).makeFloatFillAsm() - val floatvalue = flt.key - asmgen.out("${flt.value}\t.byte $floatFill ; float $floatvalue") - } - // program end asmgen.out("prog8_program_end\t; end of program label for progend()") }