From df995f7bc98d87a6962f119d0cb143660da45ed4 Mon Sep 17 00:00:00 2001 From: Irmen de Jong Date: Tue, 22 Sep 2020 01:05:07 +0200 Subject: [PATCH] fixed float zp problem on C64, added more zp locations to block list --- compiler/src/prog8/compiler/Main.kt | 2 +- .../src/prog8/compiler/target/c64/C64MachineDefinition.kt | 2 +- examples/turtle-gfx.p8 | 4 +--- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/compiler/src/prog8/compiler/Main.kt b/compiler/src/prog8/compiler/Main.kt index fdf15d2ca..de6c143c6 100644 --- a/compiler/src/prog8/compiler/Main.kt +++ b/compiler/src/prog8/compiler/Main.kt @@ -179,7 +179,7 @@ private fun optimizeAst(programAst: Program, errors: ErrorReporter) { // keep optimizing expressions and statements until no more steps remain val optsDone1 = programAst.simplifyExpressions() val optsDone2 = programAst.optimizeStatements(errors) - programAst.constantFold(errors) // because simplified statements and expressions could give rise to more constants that can be folded away: + programAst.constantFold(errors) // because simplified statements and expressions could give rise to more constants that can be folded away errors.handle() if (optsDone1 + optsDone2 == 0) break diff --git a/compiler/src/prog8/compiler/target/c64/C64MachineDefinition.kt b/compiler/src/prog8/compiler/target/c64/C64MachineDefinition.kt index 20dfd95b6..0ca5d84d5 100644 --- a/compiler/src/prog8/compiler/target/c64/C64MachineDefinition.kt +++ b/compiler/src/prog8/compiler/target/c64/C64MachineDefinition.kt @@ -147,7 +147,7 @@ internal object C64MachineDefinition: IMachineDefinition { if (options.zeropage == ZeropageType.FLOATSAFE) { // remove the zero page locations used for floating point operations from the free list free.removeAll(listOf( - 0x12, 0x26, 0x27, 0x28, 0x29, 0x2a, + 0x10, 0x11, 0x12, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x57, 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, 0x70, 0x71, 0x72, diff --git a/examples/turtle-gfx.p8 b/examples/turtle-gfx.p8 index 5f7b9c489..688eadbed 100644 --- a/examples/turtle-gfx.p8 +++ b/examples/turtle-gfx.p8 @@ -1,9 +1,7 @@ %target c64 %import floats %import graphics - -; TODO FIX OUTPUT when Optimizer is enabled (it's ok when compiling without optimization) - +%zeropage floatsafe main {