From 86ce4c75ade7db63c97adb3bee386cb9d00ef741 Mon Sep 17 00:00:00 2001 From: Karol Stasiak Date: Sat, 23 Jun 2018 23:47:18 +0200 Subject: [PATCH] Take into account that the sole byte parameter is passed via the accumulator in more locations --- src/main/scala/millfork/Platform.scala | 4 +++- .../millfork/assembly/mos/opt/EmptyMemoryStoreRemoval.scala | 2 ++ src/main/scala/millfork/env/Environment.scala | 2 ++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main/scala/millfork/Platform.scala b/src/main/scala/millfork/Platform.scala index c82bc0e7..541a7c21 100644 --- a/src/main/scala/millfork/Platform.scala +++ b/src/main/scala/millfork/Platform.scala @@ -29,7 +29,9 @@ class Platform( val bankNumbers: Map[String, Int], val defaultCodeBank: String, val outputStyle: OutputStyle.Value - ) + ) { + def cpuFamily: CpuFamily.Value = CpuFamily.forType(this.cpu) +} object Platform { diff --git a/src/main/scala/millfork/assembly/mos/opt/EmptyMemoryStoreRemoval.scala b/src/main/scala/millfork/assembly/mos/opt/EmptyMemoryStoreRemoval.scala index b004fce4..28afea89 100644 --- a/src/main/scala/millfork/assembly/mos/opt/EmptyMemoryStoreRemoval.scala +++ b/src/main/scala/millfork/assembly/mos/opt/EmptyMemoryStoreRemoval.scala @@ -20,6 +20,8 @@ object EmptyMemoryStoreRemoval extends AssemblyOptimization[AssemblyLine] { override def optimize(f: NormalFunction, code: List[AssemblyLine], options: CompilationOptions): List[AssemblyLine] = { val paramVariables = f.params match { + case NormalParamSignature(List(MemoryVariable(_, typ, _))) if typ.size == 1 => + Set[String]() case NormalParamSignature(ps) => ps.map(_.name).toSet case _ => diff --git a/src/main/scala/millfork/env/Environment.scala b/src/main/scala/millfork/env/Environment.scala index 88f7eeda..87597110 100644 --- a/src/main/scala/millfork/env/Environment.scala +++ b/src/main/scala/millfork/env/Environment.scala @@ -101,6 +101,8 @@ class Environment(val parent: Option[Environment], val prefix: String) { val p = get[Type]("pointer") val params = nf.fold(List[String]()) { f => f.params match { + case NormalParamSignature(List(MemoryVariable(_, typ, _))) if typ.size == 1 && options.platform.cpuFamily == CpuFamily.M6502 => + Nil case NormalParamSignature(ps) => ps.map(p => p.name) case _ =>