mirror of
https://gitlab.com/camelot/kickc.git
synced 2025-02-16 18:30:37 +00:00
Added -d switch to start C64Debugger directly (with symbols and KickAsm source). Extended -e to include symbols in VICE. Closes #212
This commit is contained in:
parent
7a36932c48
commit
fe0f0f9a1c
@ -10,7 +10,10 @@ import kickass.KickAssembler;
|
||||
import picocli.CommandLine;
|
||||
|
||||
import java.io.*;
|
||||
import java.nio.file.*;
|
||||
import java.nio.file.FileAlreadyExistsException;
|
||||
import java.nio.file.FileSystems;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.Callable;
|
||||
@ -52,6 +55,9 @@ public class KickC implements Callable<Void> {
|
||||
@CommandLine.Option(names = {"-e"}, description = "Execute the assembled prg file using VICE. Implicitly assembles the output.")
|
||||
private boolean execute = false;
|
||||
|
||||
@CommandLine.Option(names = {"-d"}, description = "Debug the assembled prg file using C64Debugger. Implicitly assembles the output.")
|
||||
private boolean debug = false;
|
||||
|
||||
@CommandLine.Option(names = {"-Ouplift"}, description = "Optimization Option. Number of combinations to test when uplifting variables to registers in a scope. By default 100 combinations are tested.")
|
||||
private Integer optimizeUpliftCombinations = null;
|
||||
|
||||
@ -211,14 +217,22 @@ public class KickC implements Callable<Void> {
|
||||
|
||||
// Assemble the asm-file if instructed
|
||||
Path prgPath = outputDir.resolve(fileBaseName + ".prg");
|
||||
if(assemble || execute) {
|
||||
if(assemble || execute || debug) {
|
||||
Path kasmLogPath = outputDir.resolve(fileBaseName + ".klog");
|
||||
System.out.println("Assembling to " + prgPath.toString());
|
||||
ByteArrayOutputStream kasmLogOutputStream = new ByteArrayOutputStream();
|
||||
String[] assembleCommand = {asmPath.toString(), "-log", kasmLogPath.toString(), "-o", prgPath.toString(), "-vicesymbols", "-showmem", "-debugdump"};
|
||||
if(verbose) {
|
||||
System.out.print("Assembling command: java -jar kickassembler-5.7.jar ");
|
||||
for(String cmd : assembleCommand) {
|
||||
System.out.print(cmd + " ");
|
||||
}
|
||||
System.out.println();
|
||||
}
|
||||
System.setOut(new PrintStream(kasmLogOutputStream));
|
||||
int kasmResult = -1;
|
||||
try {
|
||||
kasmResult = KickAssembler.main2(new String[]{asmPath.toString(), "-log", kasmLogPath.toString(), "-o", prgPath.toString(), "-vicesymbols", "-showmem"});
|
||||
kasmResult = KickAssembler.main2(assembleCommand);
|
||||
} catch(Throwable e) {
|
||||
throw new CompileError("KickAssembling file failed! ", e);
|
||||
} finally {
|
||||
@ -230,10 +244,27 @@ public class KickC implements Callable<Void> {
|
||||
}
|
||||
}
|
||||
|
||||
// Debug the prg-file if instructed
|
||||
if(debug) {
|
||||
System.out.println("Debugging " + prgPath);
|
||||
Path viceSymbolsPath = outputDir.resolve(fileBaseName + ".vs");
|
||||
String debugCommand = "C64Debugger " + "-symbols " + viceSymbolsPath + " -wait 2500" + " -prg " + prgPath.toString();
|
||||
if(verbose) {
|
||||
System.out.println("Debugging command: " + debugCommand);
|
||||
}
|
||||
Process process = Runtime.getRuntime().exec(debugCommand);
|
||||
process.waitFor();
|
||||
}
|
||||
|
||||
// Execute the prg-file if instructed
|
||||
if(execute) {
|
||||
System.out.println("Executing " + prgPath);
|
||||
Process process = Runtime.getRuntime().exec("x64 " + prgPath.toString());
|
||||
Path viceSymbolsPath = outputDir.resolve(fileBaseName + ".vs");
|
||||
String executeCommand = "x64 " + "-moncommands " + viceSymbolsPath + " " + prgPath.toString();
|
||||
if(verbose) {
|
||||
System.out.println("Executing command: " + executeCommand);
|
||||
}
|
||||
Process process = Runtime.getRuntime().exec(executeCommand);
|
||||
process.waitFor();
|
||||
}
|
||||
|
||||
@ -295,6 +326,7 @@ public class KickC implements Callable<Void> {
|
||||
|
||||
/**
|
||||
* Get the current version of KickC
|
||||
*
|
||||
* @return The name and version (eg "KickC 0.5")
|
||||
*/
|
||||
private String getVersion() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user