mirror of
https://github.com/KarolS/millfork.git
synced 2025-01-03 19:31:02 +00:00
More output operators
This commit is contained in:
parent
8922beda00
commit
b2afddf05b
@ -166,10 +166,18 @@ For better debugging on NES, RAM segments should use bank number `$ff`.
|
||||
|
||||
* `startaddr` – little-endian 16-bit address of the first used byte of the compiled output (not necessarily the segment start)
|
||||
|
||||
* `startaddr_be` – the same, but big-endian
|
||||
|
||||
* `startpage` – the high byte of `startaddr`
|
||||
|
||||
* `endaddr` – little-endian 16-bit address of the last used byte of the compiled output (usually not the segment end)
|
||||
|
||||
* `endaddr_be` – the same, but big-endian
|
||||
|
||||
* `length` – little-endian 16-bit length of the compiled output; `endaddr - startaddr + 1`
|
||||
|
||||
* `length_be` – the same, but big-endian
|
||||
|
||||
* `allocated` – all used bytes
|
||||
|
||||
* `pagecount` – the number of pages used by all used bytes (including partially filled pages)
|
||||
|
@ -42,6 +42,8 @@ class Platform(
|
||||
def hasZeroPage: Boolean = cpuFamily == CpuFamily.M6502
|
||||
|
||||
def cpuFamily: CpuFamily.Value = CpuFamily.forType(this.cpu)
|
||||
|
||||
def isBigEndian: Boolean = CpuFamily.isBigEndian(cpuFamily)
|
||||
}
|
||||
|
||||
object Platform {
|
||||
@ -207,10 +209,14 @@ object Platform {
|
||||
val os = conf.getSection("output")
|
||||
val outputPackager = SequenceOutput(os.get(classOf[String], "format", "").split("[, \n\t\r]+").filter(_.nonEmpty).map {
|
||||
case "startaddr" => StartAddressOutput
|
||||
case "startaddr_be" => StartAddressOutputBe
|
||||
case "startpage" => StartPageOutput
|
||||
case "endaddr" => EndAddressOutput
|
||||
case "endaddr_be" => EndAddressOutputBe
|
||||
case "pagecount" => PageCountOutput
|
||||
case "allocated" => AllocatedDataOutput
|
||||
case "length" => AllocatedDataLength
|
||||
case "length_be" => AllocatedDataLengthBe
|
||||
case "d88" => D88Output
|
||||
case "tap" => TapOutput
|
||||
case n => n.split(":").filter(_.nonEmpty) match {
|
||||
|
@ -45,6 +45,13 @@ object StartAddressOutput extends OutputPackager {
|
||||
}
|
||||
}
|
||||
|
||||
object StartAddressOutputBe extends OutputPackager {
|
||||
def packageOutput(mem: CompiledMemory, bank: String): Array[Byte] = {
|
||||
val b = mem.banks(bank)
|
||||
Array(b.start.>>(8).toByte, b.start.toByte)
|
||||
}
|
||||
}
|
||||
|
||||
object StartPageOutput extends OutputPackager {
|
||||
def packageOutput(mem: CompiledMemory, bank: String): Array[Byte] = {
|
||||
val b = mem.banks(bank)
|
||||
@ -59,6 +66,13 @@ object EndAddressOutput extends OutputPackager {
|
||||
}
|
||||
}
|
||||
|
||||
object EndAddressOutputBe extends OutputPackager {
|
||||
def packageOutput(mem: CompiledMemory, bank: String): Array[Byte] = {
|
||||
val b = mem.banks(bank)
|
||||
Array(b.end.>>(8).toByte, b.end.toByte)
|
||||
}
|
||||
}
|
||||
|
||||
object PageCountOutput extends OutputPackager {
|
||||
def packageOutput(mem: CompiledMemory, bank: String): Array[Byte] = {
|
||||
val e = mem.banks(bank).end.>>(8)
|
||||
@ -72,4 +86,20 @@ object AllocatedDataOutput extends OutputPackager {
|
||||
val b = mem.banks(bank)
|
||||
b.output.slice(b.start, b.end + 1)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
object AllocatedDataLength extends OutputPackager {
|
||||
def packageOutput(mem: CompiledMemory, bank: String): Array[Byte] = {
|
||||
val b = mem.banks(bank)
|
||||
val size = b.end - b.start + 1
|
||||
Array(size.toByte, size.>>(8).toByte)
|
||||
}
|
||||
}
|
||||
|
||||
object AllocatedDataLengthBe extends OutputPackager {
|
||||
def packageOutput(mem: CompiledMemory, bank: String): Array[Byte] = {
|
||||
val b = mem.banks(bank)
|
||||
val size = b.end - b.start + 1
|
||||
Array(size.>>(8).toByte, size.toByte)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user