mirror of
https://github.com/KarolS/millfork.git
synced 2025-04-04 06:29:48 +00:00
Assembly statements should track their source location
This commit is contained in:
parent
46a523a763
commit
748aa0cf19
@ -109,7 +109,7 @@ case class M6809Parser(filename: String,
|
||||
for {
|
||||
_ <- !"}"
|
||||
elid <- elidable
|
||||
position <- position()
|
||||
position <- position("assembly statement")
|
||||
(op, addrModeOverride) <- asmOpcode
|
||||
(addrMode, param) <- op match {
|
||||
case TFR | EXG =>
|
||||
@ -132,7 +132,7 @@ case class M6809Parser(filename: String,
|
||||
case (None, Absolute(false)) if MOpcode.Branching(op) => Relative
|
||||
case (None, _) => addrMode
|
||||
}
|
||||
M6809AssemblyStatement(op, effAddrMode, param, elid)
|
||||
M6809AssemblyStatement(op, effAddrMode, param, elid).pos(position)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -78,6 +78,7 @@ case class MosParser(filename: String, input: String, currentDirectory: String,
|
||||
import Opcode._
|
||||
for {
|
||||
elid <- !"}" ~ elidable
|
||||
position <- position("assembly statement")
|
||||
op <- asmOpcode ~/ Pass
|
||||
param <- op match {
|
||||
case op if OpcodeClasses.SingleBitBranch(op) =>
|
||||
@ -94,7 +95,7 @@ case class MosParser(filename: String, input: String, currentDirectory: String,
|
||||
case _ => asmParameter
|
||||
}
|
||||
} yield {
|
||||
(op, param._1) match {
|
||||
((op, param._1) match {
|
||||
case (Opcode.SAX, AddrMode.Implied) => MosAssemblyStatement(Opcode.HuSAX, param._1, param._2, elid)
|
||||
case (Opcode.SBX, AddrMode.Immediate) => MosAssemblyStatement(Opcode.SBX, param._1, param._2, elid)
|
||||
case (Opcode.SAY, AddrMode.AbsoluteX) => MosAssemblyStatement(Opcode.SHY, param._1, param._2, elid)
|
||||
@ -107,7 +108,7 @@ case class MosParser(filename: String, input: String, currentDirectory: String,
|
||||
case (_, AddrMode.Absolute) if OpcodeClasses.SingleBit(op) => MosAssemblyStatement(op, AddrMode.ZeroPage, param._2, elid)
|
||||
case (_, AddrMode.Indirect) if op != Opcode.JMP && op != Opcode.JSR => MosAssemblyStatement(op, AddrMode.IndexedZ, param._2, elid)
|
||||
case _ => MosAssemblyStatement(op, param._1, param._2, elid)
|
||||
}
|
||||
}).pos(position)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -241,7 +241,7 @@ case class Z80Parser(filename: String,
|
||||
import ZOpcode._
|
||||
for {
|
||||
el <- elidable
|
||||
pos <- position()
|
||||
pos <- position("assembly statement")
|
||||
opcode: String <- identifier ~/ HWS
|
||||
tuple4: (ZOpcode.Value, ZRegisters, Option[Expression], Expression) <- opcode.toUpperCase(Locale.ROOT) match {
|
||||
case "RST" => asmExpression.map((RST, NoRegisters, None, _))
|
||||
@ -508,7 +508,7 @@ case class Z80Parser(filename: String,
|
||||
}
|
||||
} yield {
|
||||
val (actualOpcode, registers, offset, param) = tuple4
|
||||
Z80AssemblyStatement(actualOpcode, registers, offset, param, el)
|
||||
Z80AssemblyStatement(actualOpcode, registers, offset, param, el).pos(pos)
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user