1
0
mirror of https://github.com/KarolS/millfork.git synced 2024-06-25 19:29:49 +00:00

Define Constant.WordZero

This commit is contained in:
Karol Stasiak 2019-10-23 11:03:55 +02:00
parent aa09bc90a4
commit 9beac45e99
4 changed files with 5 additions and 4 deletions

View File

@ -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 {

View File

@ -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)) {

View File

@ -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))

View File

@ -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)),