added altirra as atari emu2

This commit is contained in:
Irmen de Jong 2022-02-25 19:16:37 +01:00
parent 6cce47b2f1
commit 530e109433
4 changed files with 41 additions and 51 deletions

View File

@ -2,7 +2,6 @@ package prog8.codegen.target.atari
import prog8.codegen.target.c64.normal6502instructions import prog8.codegen.target.c64.normal6502instructions
import prog8.compilerinterface.* import prog8.compilerinterface.*
import java.io.IOException
import java.nio.file.Path import java.nio.file.Path
@ -31,24 +30,29 @@ class AtariMachineDefinition: IMachineDefinition {
} }
override fun launchEmulator(selectedEmulator: Int, programNameWithPath: Path) { override fun launchEmulator(selectedEmulator: Int, programNameWithPath: Path) {
if(selectedEmulator!=1) { val emulatorName: String
System.err.println("The atari target only supports the main emulator (atari800).") val cmdline: List<String>
return when(selectedEmulator) {
1 -> {
emulatorName = "atari800"
cmdline = listOf(emulatorName, "-xl", "-xl-rev", "2", "-nobasic", "-run", "${programNameWithPath}.xex")
}
2 -> {
emulatorName = "altirra"
cmdline = listOf("Altirra64.exe", "${programNameWithPath.normalize()}.xex")
}
else -> {
System.err.println("Atari target only supports atari800 and altirra emulators.")
return
}
} }
for(emulator in listOf("atari800")) { // TODO monlist?
println("\nStarting Atari800XL emulator $emulator...")
val cmdline = listOf(emulator, "-xl", "-nobasic", "-run", "${programNameWithPath}.xex") println("\nStarting Atari800XL emulator $emulatorName...")
val processb = ProcessBuilder(cmdline).inheritIO() val processb = ProcessBuilder(cmdline).inheritIO()
val process: Process val process: Process = processb.start()
try { process.waitFor()
process=processb.start()
} catch(x: IOException) {
continue // try the next emulator executable
}
process.waitFor()
break
}
} }
override fun isIOAddress(address: UInt): Boolean = address==0u || address==1u || address in 0xd000u..0xdfffu // TODO override fun isIOAddress(address: UInt): Boolean = address==0u || address==1u || address in 0xd000u..0xdfffu // TODO

View File

@ -3,7 +3,6 @@ package prog8.codegen.target.c128
import prog8.codegen.target.c64.normal6502instructions import prog8.codegen.target.c64.normal6502instructions
import prog8.codegen.target.cbm.Mflpt5 import prog8.codegen.target.cbm.Mflpt5
import prog8.compilerinterface.* import prog8.compilerinterface.*
import java.io.IOException
import java.nio.file.Path import java.nio.file.Path
@ -37,21 +36,13 @@ class C128MachineDefinition: IMachineDefinition {
return return
} }
for(emulator in listOf("x128")) { println("\nStarting C-128 emulator x128...")
println("\nStarting C-128 emulator $emulator...") val viceMonlist = viceMonListName(programNameWithPath.toString())
val viceMonlist = viceMonListName(programNameWithPath.toString()) val cmdline = listOf("x128", "-silent", "-moncommands", viceMonlist,
val cmdline = listOf(emulator, "-silent", "-moncommands", viceMonlist, "-autostartprgmode", "1", "-autostart-warp", "-autostart", "${programNameWithPath}.prg")
"-autostartprgmode", "1", "-autostart-warp", "-autostart", "${programNameWithPath}.prg") val processb = ProcessBuilder(cmdline).inheritIO()
val processb = ProcessBuilder(cmdline).inheritIO() val process: Process = processb.start()
val process: Process process.waitFor()
try {
process=processb.start()
} catch(x: IOException) {
continue // try the next emulator executable
}
process.waitFor()
break
}
} }
override fun isIOAddress(address: UInt): Boolean = address==0u || address==1u || address in 0xd000u..0xdfffu override fun isIOAddress(address: UInt): Boolean = address==0u || address==1u || address in 0xd000u..0xdfffu

View File

@ -2,7 +2,6 @@ package prog8.codegen.target.cx16
import prog8.codegen.target.cbm.Mflpt5 import prog8.codegen.target.cbm.Mflpt5
import prog8.compilerinterface.* import prog8.compilerinterface.*
import java.io.IOException
import java.nio.file.Path import java.nio.file.Path
@ -30,16 +29,16 @@ class CX16MachineDefinition: IMachineDefinition {
} }
override fun launchEmulator(selectedEmulator: Int, programNameWithPath: Path) { override fun launchEmulator(selectedEmulator: Int, programNameWithPath: Path) {
val emulatorName: String val emulator: String
val extraArgs: List<String> val extraArgs: List<String>
when(selectedEmulator) { when(selectedEmulator) {
1 -> { 1 -> {
emulatorName = "x16emu" emulator = "x16emu"
extraArgs = emptyList() extraArgs = emptyList()
} }
2 -> { 2 -> {
emulatorName = "box16" emulator = "box16"
extraArgs = listOf("-sym", viceMonListName(programNameWithPath.toString())) extraArgs = listOf("-sym", viceMonListName(programNameWithPath.toString()))
} }
else -> { else -> {
@ -48,19 +47,11 @@ class CX16MachineDefinition: IMachineDefinition {
} }
} }
for(emulator in listOf(emulatorName)) { println("\nStarting Commander X16 emulator $emulator...")
println("\nStarting Commander X16 emulator $emulator...") val cmdline = listOf(emulator, "-scale", "2", "-run", "-prg", "${programNameWithPath}.prg") + extraArgs
val cmdline = listOf(emulator, "-scale", "2", "-run", "-prg", "${programNameWithPath}.prg") + extraArgs val processb = ProcessBuilder(cmdline).inheritIO()
val processb = ProcessBuilder(cmdline).inheritIO() val process: Process = processb.start()
val process: Process process.waitFor()
try {
process=processb.start()
} catch(x: IOException) {
continue // try the next emulator executable
}
process.waitFor()
break
}
} }
override fun isIOAddress(address: UInt): Boolean = address==0u || address==1u || address in 0x9f00u..0x9fffu override fun isIOAddress(address: UInt): Boolean = address==0u || address==1u || address in 0x9f00u..0x9fffu

View File

@ -1,7 +1,11 @@
%import textio %import textio
;%address $2000 %address $2000
main { main {
sub start() { sub start() {
txt.print("Hello!\nWorld\n")
repeat {
}
} }
} }