mirror of
https://github.com/KarolS/millfork.git
synced 2025-01-03 19:31:02 +00:00
Add LITTLE_ENDIAN and BIG_ENDIAN features
This commit is contained in:
parent
e0cd000b99
commit
1d024eae76
@ -57,6 +57,10 @@ The following features are defined based on the chosen CPU and compilation optio
|
||||
* `INIT_RW_MEMORY` – 1 if the option `ram_init_segment` is defined, 0 otherwise.
|
||||
See [the ROM vs RAM guide](../api/rom-vs-ram.md) for more information.
|
||||
|
||||
* `BIG_ENDIAN` – 1 if the platform is big-endian, 0 otherwise (currently all supported platforms are little-endian)
|
||||
|
||||
* `LITTLE_ENDIAN` – 1 if the platform is little-endian, 0 otherwise (currently all supported platforms are little-endian)
|
||||
|
||||
* `OPTIMIZE_FOR_SIZE`, `OPTIMIZE_FOR_SPEED`, `OPTIMIZE_INLINE`, `OPTIMIZE_IPO`
|
||||
– 1 if given optimization setting is enabled, 0 otherwise
|
||||
|
||||
|
@ -214,6 +214,8 @@ case class CompilationOptions(platform: Platform,
|
||||
"CPUFEATURE_6502_ILLEGALS" -> toLong(platform.cpuFamily == CpuFamily.M6502 && flag(CompilationFlag.EmitIllegals)),
|
||||
"CPUFEATURE_Z80_ILLEGALS" -> toLong(flag(CompilationFlag.EmitZ80Opcodes) && flag(CompilationFlag.EmitIllegals)),
|
||||
"CPUFEATURE_8085_ILLEGALS" -> toLong(flag(CompilationFlag.EmitIntel8080Opcodes) && flag(CompilationFlag.EmitIllegals)),
|
||||
"BIG_ENDIAN" -> toLong(Cpu.isBigEndian(platform.cpu)),
|
||||
"LITTLE_ENDIAN" -> toLong(!Cpu.isBigEndian(platform.cpu)),
|
||||
"INIT_RW_MEMORY" -> toLong(platform.ramInitialValuesBank.isDefined),
|
||||
"SYNTAX_INTEL" -> toLong(platform.cpuFamily == CpuFamily.I80 && flag(CompilationFlag.UseIntelSyntaxForInput)),
|
||||
"SYNTAX_ZILOG" -> toLong(platform.cpuFamily == CpuFamily.I80 && !flag(CompilationFlag.UseIntelSyntaxForInput)),
|
||||
@ -269,6 +271,11 @@ object CpuFamily extends Enumeration {
|
||||
case Cpu.Motorola6809 => M6809
|
||||
}
|
||||
}
|
||||
|
||||
def isBigEndian(family: CpuFamily.Value): Boolean = family match {
|
||||
case M6502 | I80 | I86 | ARM => false
|
||||
case M6800 | M6809 | M68K => true
|
||||
}
|
||||
}
|
||||
|
||||
object Cpu extends Enumeration {
|
||||
@ -475,6 +482,8 @@ object Cpu extends Enumeration {
|
||||
case CpuFamily.M6809 => 2
|
||||
case _ => ???
|
||||
}
|
||||
|
||||
def isBigEndian(cpu: Cpu.Value): Boolean = CpuFamily.isBigEndian(CpuFamily.forType(cpu))
|
||||
}
|
||||
|
||||
object CompilationFlag extends Enumeration {
|
||||
|
Loading…
Reference in New Issue
Block a user