diff --git a/codeGenTargets/src/prog8/codegen/target/atari/AtariMachineDefinition.kt b/codeGenTargets/src/prog8/codegen/target/atari/AtariMachineDefinition.kt index 974a5190b..952f872e0 100644 --- a/codeGenTargets/src/prog8/codegen/target/atari/AtariMachineDefinition.kt +++ b/codeGenTargets/src/prog8/codegen/target/atari/AtariMachineDefinition.kt @@ -2,7 +2,6 @@ package prog8.codegen.target.atari import prog8.codegen.target.c64.normal6502instructions import prog8.compilerinterface.* -import java.io.IOException import java.nio.file.Path @@ -31,24 +30,29 @@ class AtariMachineDefinition: IMachineDefinition { } override fun launchEmulator(selectedEmulator: Int, programNameWithPath: Path) { - if(selectedEmulator!=1) { - System.err.println("The atari target only supports the main emulator (atari800).") - return + val emulatorName: String + val cmdline: List + 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")) { - println("\nStarting Atari800XL emulator $emulator...") - val cmdline = listOf(emulator, "-xl", "-nobasic", "-run", "${programNameWithPath}.xex") - val processb = ProcessBuilder(cmdline).inheritIO() - val process: Process - try { - process=processb.start() - } catch(x: IOException) { - continue // try the next emulator executable - } - process.waitFor() - break - } + // TODO monlist? + + println("\nStarting Atari800XL emulator $emulatorName...") + val processb = ProcessBuilder(cmdline).inheritIO() + val process: Process = processb.start() + process.waitFor() } override fun isIOAddress(address: UInt): Boolean = address==0u || address==1u || address in 0xd000u..0xdfffu // TODO diff --git a/codeGenTargets/src/prog8/codegen/target/c128/C128MachineDefinition.kt b/codeGenTargets/src/prog8/codegen/target/c128/C128MachineDefinition.kt index 5ec482709..47e273d5f 100644 --- a/codeGenTargets/src/prog8/codegen/target/c128/C128MachineDefinition.kt +++ b/codeGenTargets/src/prog8/codegen/target/c128/C128MachineDefinition.kt @@ -3,7 +3,6 @@ package prog8.codegen.target.c128 import prog8.codegen.target.c64.normal6502instructions import prog8.codegen.target.cbm.Mflpt5 import prog8.compilerinterface.* -import java.io.IOException import java.nio.file.Path @@ -37,21 +36,13 @@ class C128MachineDefinition: IMachineDefinition { return } - for(emulator in listOf("x128")) { - println("\nStarting C-128 emulator $emulator...") - val viceMonlist = viceMonListName(programNameWithPath.toString()) - val cmdline = listOf(emulator, "-silent", "-moncommands", viceMonlist, - "-autostartprgmode", "1", "-autostart-warp", "-autostart", "${programNameWithPath}.prg") - val processb = ProcessBuilder(cmdline).inheritIO() - val process: Process - try { - process=processb.start() - } catch(x: IOException) { - continue // try the next emulator executable - } - process.waitFor() - break - } + println("\nStarting C-128 emulator x128...") + val viceMonlist = viceMonListName(programNameWithPath.toString()) + val cmdline = listOf("x128", "-silent", "-moncommands", viceMonlist, + "-autostartprgmode", "1", "-autostart-warp", "-autostart", "${programNameWithPath}.prg") + val processb = ProcessBuilder(cmdline).inheritIO() + val process: Process = processb.start() + process.waitFor() } override fun isIOAddress(address: UInt): Boolean = address==0u || address==1u || address in 0xd000u..0xdfffu diff --git a/codeGenTargets/src/prog8/codegen/target/cx16/CX16MachineDefinition.kt b/codeGenTargets/src/prog8/codegen/target/cx16/CX16MachineDefinition.kt index 9d57a49f9..46cedfc7e 100644 --- a/codeGenTargets/src/prog8/codegen/target/cx16/CX16MachineDefinition.kt +++ b/codeGenTargets/src/prog8/codegen/target/cx16/CX16MachineDefinition.kt @@ -2,7 +2,6 @@ package prog8.codegen.target.cx16 import prog8.codegen.target.cbm.Mflpt5 import prog8.compilerinterface.* -import java.io.IOException import java.nio.file.Path @@ -30,16 +29,16 @@ class CX16MachineDefinition: IMachineDefinition { } override fun launchEmulator(selectedEmulator: Int, programNameWithPath: Path) { - val emulatorName: String + val emulator: String val extraArgs: List when(selectedEmulator) { 1 -> { - emulatorName = "x16emu" + emulator = "x16emu" extraArgs = emptyList() } 2 -> { - emulatorName = "box16" + emulator = "box16" extraArgs = listOf("-sym", viceMonListName(programNameWithPath.toString())) } else -> { @@ -48,19 +47,11 @@ class CX16MachineDefinition: IMachineDefinition { } } - for(emulator in listOf(emulatorName)) { - println("\nStarting Commander X16 emulator $emulator...") - val cmdline = listOf(emulator, "-scale", "2", "-run", "-prg", "${programNameWithPath}.prg") + extraArgs - val processb = ProcessBuilder(cmdline).inheritIO() - val process: Process - try { - process=processb.start() - } catch(x: IOException) { - continue // try the next emulator executable - } - process.waitFor() - break - } + println("\nStarting Commander X16 emulator $emulator...") + val cmdline = listOf(emulator, "-scale", "2", "-run", "-prg", "${programNameWithPath}.prg") + extraArgs + val processb = ProcessBuilder(cmdline).inheritIO() + val process: Process = processb.start() + process.waitFor() } override fun isIOAddress(address: UInt): Boolean = address==0u || address==1u || address in 0x9f00u..0x9fffu diff --git a/examples/test.p8 b/examples/test.p8 index 0d13caf58..c47e3f45d 100644 --- a/examples/test.p8 +++ b/examples/test.p8 @@ -1,7 +1,11 @@ %import textio -;%address $2000 +%address $2000 main { sub start() { + txt.print("Hello!\nWorld\n") + + repeat { + } } }