diff --git a/src/main/scala/millfork/compiler/mos/PseudoregisterBuiltIns.scala b/src/main/scala/millfork/compiler/mos/PseudoregisterBuiltIns.scala index 94e4478a..e59f2a9c 100644 --- a/src/main/scala/millfork/compiler/mos/PseudoregisterBuiltIns.scala +++ b/src/main/scala/millfork/compiler/mos/PseudoregisterBuiltIns.scala @@ -38,7 +38,7 @@ object PseudoregisterBuiltIns { val result = ListBuffer[AssemblyLine]() var hard = Option.empty[List[AssemblyLine]] val niceReads = mutable.ListBuffer[(List[AssemblyLine], List[AssemblyLine])]() - var constant: Constant = NumericConstant(0, 2) + var constant: Constant = Constant.WordZero var counter = 0 for ((subtract, read) <- reads) { read match { diff --git a/src/main/scala/millfork/compiler/z80/ZBuiltIns.scala b/src/main/scala/millfork/compiler/z80/ZBuiltIns.scala index aa5c2afa..535d5418 100644 --- a/src/main/scala/millfork/compiler/z80/ZBuiltIns.scala +++ b/src/main/scala/millfork/compiler/z80/ZBuiltIns.scala @@ -188,7 +188,7 @@ object ZBuiltIns { } def compile16BitSum(ctx: CompilationContext, params: List[(Boolean, Expression)], decimal: Boolean): List[ZLine] = { - var const: Constant = NumericConstant(0, 2) + var const: Constant = Constant.WordZero var hasConst = false var result = mutable.ListBuffer[ZLine]() if (decimal) { @@ -222,7 +222,7 @@ object ZBuiltIns { case _ => if (result.isEmpty) { result += ZLine.ldImm16(ZRegister.HL, const) - const = NumericConstant(0, 2) + const = Constant.WordZero hasConst = false } if (ctx.options.flag(CompilationFlag.EmitExtended80Opcodes)) { diff --git a/src/main/scala/millfork/env/Constant.scala b/src/main/scala/millfork/env/Constant.scala index e25b05ca..c0fec224 100644 --- a/src/main/scala/millfork/env/Constant.scala +++ b/src/main/scala/millfork/env/Constant.scala @@ -5,6 +5,7 @@ import millfork.output.DivisibleAlignment object Constant { val Zero: Constant = NumericConstant(0, 1) + val WordZero: Constant = NumericConstant(0, 2) val One: Constant = NumericConstant(1, 1) def apply(i: Long): Constant = NumericConstant(i, minimumSize(i)) diff --git a/src/main/scala/millfork/env/Environment.scala b/src/main/scala/millfork/env/Environment.scala index 33706974..8ac50a5f 100644 --- a/src/main/scala/millfork/env/Environment.scala +++ b/src/main/scala/millfork/env/Environment.scala @@ -473,7 +473,7 @@ class Environment(val parent: Option[Environment], val prefix: String, val cpuFa addUnexpandedWordConstant(s"segment.$segment.length") addUnexpandedByteConstant(s"segment.$segment.bank") } - addThing(ConstantThing("$0000", NumericConstant(0, 2), p), None) + addThing(ConstantThing("$0000", Constant.WordZero, p), None) addThing(FlagBooleanType("set_carry", BranchingOpcodeMapping(Opcode.BCS, IfFlagSet(ZFlag.C), MOpcode.BCS), BranchingOpcodeMapping(Opcode.BCC, IfFlagClear(ZFlag.C), MOpcode.BCC)),