added ability to specify additional assembler options in custom target configurations

This commit is contained in:
Irmen de Jong 2025-02-01 16:09:43 +01:00
parent 67bc0b6931
commit f335251c2b
13 changed files with 26 additions and 19 deletions

View File

@ -35,6 +35,7 @@ interface ICompilationTarget: IStringEncoding, IMemSizer {
var golden: GoldenRam
val libraryPath: Path?
val customLauncher: List<String>
val additionalAssemblerOptions: String?
fun initializeMemoryAreas(compilerOptions: CompilationOptions)
fun getFloatAsmBytes(num: Number): String

View File

@ -12,6 +12,7 @@ class AtariTarget: ICompilationTarget, IStringEncoding by Encoder, IMemSizer by
override val defaultEncoding = Encoding.ATASCII
override val libraryPath = null
override val customLauncher: List<String> = emptyList()
override val additionalAssemblerOptions = null
companion object {
const val NAME = "atari"

View File

@ -19,6 +19,7 @@ class C128Target: ICompilationTarget, IStringEncoding by Encoder, IMemSizer by N
override val defaultEncoding = Encoding.PETSCII
override val libraryPath = null
override val customLauncher: List<String> = emptyList()
override val additionalAssemblerOptions = null
companion object {
const val NAME = "c128"

View File

@ -12,6 +12,7 @@ class C64Target: ICompilationTarget, IStringEncoding by Encoder, IMemSizer by No
override val defaultEncoding = Encoding.PETSCII
override val libraryPath = null
override val customLauncher: List<String> = emptyList()
override val additionalAssemblerOptions = null
companion object {
const val NAME = "c64"

View File

@ -27,6 +27,7 @@ class ConfigFileTarget(
override val BSSGOLDENRAM_END: UInt,
override val libraryPath: Path,
override val customLauncher: List<String>,
override val additionalAssemblerOptions: String?,
val ioAddresses: List<UIntRange>,
val zpScratchB1: UInt,
val zpScratchReg: UInt,
@ -107,6 +108,8 @@ class ConfigFileTarget(
if(customLauncherStr?.isNotBlank()==true)
(customLauncherStr+"\n").lines().map { it.trimEnd() }
else emptyList()
val assemblerOptionsStr = props.getProperty("assembler_options", "").trim()
val assemblerOptions = if(assemblerOptionsStr.isBlank()) null else assemblerOptionsStr
return ConfigFileTarget(
configfile.nameWithoutExtension,
@ -122,6 +125,7 @@ class ConfigFileTarget(
props.getInteger("bss_goldenram_end"),
libraryPath,
customLauncher,
assemblerOptions,
ioAddresses,
props.getInteger("zp_scratch_b1"),
props.getInteger("zp_scratch_reg"),

View File

@ -19,6 +19,7 @@ class Cx16Target: ICompilationTarget, IStringEncoding by Encoder, IMemSizer by N
override val defaultEncoding = Encoding.PETSCII
override val libraryPath = null
override val customLauncher: List<String> = emptyList()
override val additionalAssemblerOptions = null
companion object {
const val NAME = "cx16"

View File

@ -11,6 +11,7 @@ class Neo6502Target: ICompilationTarget, IStringEncoding by Encoder, IMemSizer b
override val defaultEncoding = Encoding.ISO
override val libraryPath = null
override val customLauncher: List<String> = emptyList()
override val additionalAssemblerOptions = null
companion object {
const val NAME = "neo"

View File

@ -19,6 +19,7 @@ class PETTarget: ICompilationTarget, IStringEncoding by Encoder, IMemSizer by No
override val defaultEncoding = Encoding.PETSCII
override val libraryPath = null
override val customLauncher: List<String> = emptyList()
override val additionalAssemblerOptions = null
companion object {
const val NAME = "pet32"

View File

@ -12,6 +12,7 @@ class VMTarget: ICompilationTarget, IStringEncoding by Encoder, IMemSizer by Nor
override val defaultEncoding = Encoding.ISO
override val libraryPath = null
override val customLauncher: List<String> = emptyList()
override val additionalAssemblerOptions = null
companion object {
const val NAME = "virtual"

View File

@ -29,11 +29,8 @@ internal class AssemblyProgram(
ProgramType.CBMPRG -> {
// CBM machines .prg generation.
// add "-Wlong-branch" to see warnings about conversion of branch instructions to jumps (default = do this silently)
val command = mutableListOf("64tass", "--ascii", "--case-sensitive", "--long-branch",
"-Wall", // "-Wno-strict-bool", "-Werror",
"--dump-labels", "--vice-labels", "--labels=$viceMonListFile"
)
"-Wall", "--no-monitor", "--dump-labels", "--vice-labels", "--labels=$viceMonListFile")
if(options.warnSymbolShadowing)
command.add("-Wshadow")
@ -44,7 +41,7 @@ internal class AssemblyProgram(
command.add("--quiet")
if(options.asmListfile) {
command.addAll(listOf("--list=$listFile", "--no-monitor"))
command.add("--list=$listFile")
}
val outFile = when (options.output) {
@ -65,6 +62,7 @@ internal class AssemblyProgram(
}
else -> throw AssemblyError("invalid output type")
}
command.addAll(listOf("--output", outFile.toString(), assemblyFile.toString()))
assemblerCommand = command
@ -73,10 +71,7 @@ internal class AssemblyProgram(
// Atari800XL .xex generation.
// TODO are these options okay for atari?
val command = mutableListOf("64tass", "--ascii", "--case-sensitive", "--long-branch",
"-Wall", // "-Werror", "-Wno-strict-bool"
"--no-monitor"
)
val command = mutableListOf("64tass", "--ascii", "--case-sensitive", "--long-branch", "-Wall", "--no-monitor")
if(options.warnSymbolShadowing)
command.add("-Wshadow")
@ -113,10 +108,7 @@ internal class AssemblyProgram(
}
// TODO are these options okay for neo?
val command = mutableListOf("64tass", "--case-sensitive", "--long-branch",
"-Wall", // "-Werror", "-Wno-strict-bool"
"--no-monitor"
)
val command = mutableListOf("64tass", "--ascii", "--case-sensitive", "--long-branch", "-Wall", "--no-monitor")
if(options.warnSymbolShadowing)
command.add("-Wshadow")
@ -143,6 +135,9 @@ internal class AssemblyProgram(
else -> throw AssemblyError("invalid program type")
}
if(options.compTarget.additionalAssemblerOptions!=null)
assemblerCommand.add(options.compTarget.additionalAssemblerOptions!!)
val proc = ProcessBuilder(assemblerCommand).inheritIO().start()
val result = proc.waitFor()
if (result == 0 && compTarget.name !in targetWithoutBreakpointsForEmulator) {

View File

@ -36,5 +36,5 @@ library = ./libraries/tinyc64
# and instead outputs whatever is specified here. (You can use \n here for newline and \ for line continuantions)
custom_launcher =
# TODO should the 64tass arguments be in here too perhaps? So that the "program" parameter that now selects 1 of a few fixed sets of arguments, can be removed?
# TODO should an emulator command line also be in here perhaps? So that -emu will work too.
# additional options passed to the assembler program
assembler_options =

View File

@ -36,5 +36,5 @@ library = ./libraries/tinycx16
# and instead outputs whatever is specified here. (You can use \n here for newline and \ for line continuantions)
custom_launcher =
# TODO should the 64tass arguments be in here too perhaps? So that the "program" parameter that now selects 1 of a few fixed sets of arguments, can be removed?
# TODO should an emulator command line also be in here perhaps? So that -emu will work too.
# additional options passed to the assembler program
assembler_options =

View File

@ -36,5 +36,5 @@ library = ./libraries/tinypet
# and instead outputs whatever is specified here. (You can use \n here for newline and \ for line continuantions)
custom_launcher =
# TODO should the 64tass arguments be in here too perhaps? So that the "program" parameter that now selects 1 of a few fixed sets of arguments, can be removed?
# TODO should an emulator command line also be in here perhaps? So that -emu will work too.
# additional options passed to the assembler program
assembler_options =