1
0
mirror of https://gitlab.com/camelot/kickc.git synced 2024-12-22 06:29:23 +00:00

Upgraded to KickAssembler 5.7. Closes #213

This commit is contained in:
jespergravgaard 2019-07-07 17:54:06 +02:00
parent b053acf39b
commit 5061a02a17
20 changed files with 120 additions and 15 deletions

View File

@ -1,13 +1,14 @@
<component name="libraryTable">
<library name="Maven: cml.kickass:kickassembler:4.19">
<library name="Maven: cml.kickass:kickassembler:5.7">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/cml/kickass/kickassembler/4.19/kickassembler-4.19.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/cml/kickass/kickassembler/5.7/kickassembler-5.7.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/cml/kickass/kickassembler/4.19/kickassembler-4.19-javadoc.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/cml/kickass/kickassembler/5.7/kickassembler-5.7-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/cml/kickass/kickassembler/4.19/kickassembler-4.19-sources.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/cml/kickass/kickassembler/5.7/kickassembler-5.7-sources.jar!/" />
<root url="jar://$PROJECT_DIR$/../tmp/KickAss.jar.src.zip!/" />
</SOURCES>
</library>
</component>

View File

@ -22,7 +22,7 @@
<orderEntry type="library" name="Maven: org.antlr:antlr4-runtime:4.7.1" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: junit:junit:4.12" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.hamcrest:hamcrest-core:1.3" level="project" />
<orderEntry type="library" name="Maven: cml.kickass:kickassembler:4.19" level="project" />
<orderEntry type="library" name="Maven: cml.kickass:kickassembler:5.7" level="project" />
<orderEntry type="library" name="Maven: info.picocli:picocli:3.6.0" level="project" />
</component>
</module>

View File

@ -44,7 +44,7 @@
<dependency>
<groupId>cml.kickass</groupId>
<artifactId>kickassembler</artifactId>
<version>4.19</version>
<version>5.7</version>
</dependency>
<dependency>
<groupId>info.picocli</groupId>
@ -84,6 +84,7 @@
<useSystemClassLoader>false</useSystemClassLoader>
<parallel>all</parallel>
<threadCount>5</threadCount>
<enableAssertions>false</enableAssertions>
</configuration>
</plugin>
<plugin>

View File

@ -0,0 +1,3 @@
#NOTE: This is a Maven Resolver internal implementation file, its format can be changed without prior notice.
#Sun Jul 07 13:12:08 CEST 2019
kickassembler-4.19.jar>=

View File

@ -0,0 +1,4 @@
#NOTE: This is a Maven Resolver internal implementation file, its format can be changed without prior notice.
#Sun Jul 07 13:17:44 CEST 2019
kickassembler-5.7.jar>=
kickassembler-5.7.pom>=

View File

@ -0,0 +1 @@
5185c4b9ba60f3e39d5cb665245136e5

View File

@ -0,0 +1 @@
56f3815f668ba13bf8c2d735a1f77c9fa250b134

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>cml.kickass</groupId>
<artifactId>kickassembler</artifactId>
<version>5.7</version>
<description>POM was created from install:install-file</description>
</project>

View File

@ -0,0 +1 @@
0044934e3e63a8f780e7573b5add4b1f

View File

@ -0,0 +1 @@
16520c872098ba177df082fbb11a6a21f42b342c

View File

@ -3,10 +3,11 @@
<groupId>cml.kickass</groupId>
<artifactId>kickassembler</artifactId>
<versioning>
<release>4.19</release>
<release>5.7</release>
<versions>
<version>5.7</version>
<version>4.19</version>
</versions>
<lastUpdated>20180212211902</lastUpdated>
<lastUpdated>20190707111222</lastUpdated>
</versioning>
</metadata>

View File

@ -1 +1 @@
9199b475bc277b5f48523801dea7cd23
371050487d0341b8ad5e5115a28669c1

View File

@ -1 +1 @@
2ca5f01c38aeb3757a88f908c4a73017974c0286
9e1e537f5927907ac635f4784fc82d467d20b70e

View File

@ -205,7 +205,14 @@ public class KickC implements Callable<Void> {
System.out.println("Assembling to " + prgPath.toString());
ByteArrayOutputStream kasmLogOutputStream = new ByteArrayOutputStream();
System.setOut(new PrintStream(kasmLogOutputStream));
int kasmResult = KickAssembler.main2(new String[]{asmPath.toString(), "-log", kasmLogPath.toString(), "-o", prgPath.toString(), "-vicesymbols", "-showmem"});
int kasmResult = -1;
try {
kasmResult = KickAssembler.main2(new String[]{asmPath.toString(), "-log", kasmLogPath.toString(), "-o", prgPath.toString(), "-vicesymbols", "-showmem"});
} catch (Throwable e) {
throw new CompileError("KickAssembling file failed! " , e);
} finally {
System.setOut(new PrintStream(new FileOutputStream(FileDescriptor.out)));
}
System.setOut(new PrintStream(new FileOutputStream(FileDescriptor.out)));
if(kasmResult != 0) {
throw new CompileError("KickAssembling file failed! " + kasmLogOutputStream.toString());

View File

@ -80,8 +80,14 @@ public class Pass5FixLongBranches extends Pass5AsmOptimization {
File asmPrgFile = getTmpFile(fileName, ".prg");
ByteArrayOutputStream kickAssOut = new ByteArrayOutputStream();
System.setOut(new PrintStream(kickAssOut));
int asmRes = KickAssembler.main2(new String[]{asmFile.getAbsolutePath(), "-o", asmPrgFile.getAbsolutePath()});
System.setOut(new PrintStream(new FileOutputStream(FileDescriptor.out)));
int asmRes = -1;
try {
asmRes = KickAssembler.main2(new String[]{asmFile.getAbsolutePath(), "-o", asmPrgFile.getAbsolutePath()});
} catch(Throwable e) {
throw new CompileError("Error! KickAssembler failed, while trying to fix long branch. " + e);
} finally {
System.setOut(new PrintStream(new FileOutputStream(FileDescriptor.out)));
}
String output = kickAssOut.toString();
// Look for a long branch distance error

View File

@ -0,0 +1,2 @@
#!/usr/bin/env bash
mvn install:install-file -Dmaven.repo.local=./repo/ -Dfile=/Applications/KickAssembler/KickAss.jar -DgroupId=cml.kickass -DartifactId=kickassembler -Dpackaging=jar -DgeneratePom=true -DcreateChecksum=true -Dversion=5.7

View File

@ -0,0 +1,46 @@
package dk.camelot64.kickc.test;
import kickass.KickAssembler;
import org.junit.Test;
import java.io.*;
import java.net.URI;
import java.net.URISyntaxException;
import java.nio.file.FileSystems;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
public class TestKickAssRun {
@Test
public void testKickAssRun() throws IOException, URISyntaxException {
ReferenceHelper asmHelper = new ReferenceHelperFolder("src/test/java/dk/camelot64/kickc/test/");
URI asmUri = asmHelper.loadReferenceFile("kickasstest", ".asm");
Path asmPath = Paths.get(asmUri);
File asmPrgFile = getTmpFile("kickasstest", ".prg");
ByteArrayOutputStream kickAssOut = new ByteArrayOutputStream();
System.setOut(new PrintStream(kickAssOut));
try {
KickAssembler.main2(new String[]{asmPath.toAbsolutePath().toString(), "-o", asmPrgFile.getAbsolutePath()});
} catch (AssertionError e) {
System.setOut(new PrintStream(new FileOutputStream(FileDescriptor.out)));
String output = kickAssOut.toString();
System.out.println(output);
throw e;
} finally {
System.setOut(new PrintStream(new FileOutputStream(FileDescriptor.out)));
}
String output = kickAssOut.toString();
System.out.println(output);
}
public File getTmpFile(String fileName, String extension) throws IOException {
Path tmpDir = Files.createTempDirectory("kickc");
Path kcPath = FileSystems.getDefault().getPath(fileName);
return new File(tmpDir.toFile(), kcPath.getFileName().toString() + extension);
}
}

View File

@ -2614,8 +2614,14 @@ public class TestPrograms {
File asmLogFile = getBinFile(fileName, ".log");
ByteArrayOutputStream kickAssOut = new ByteArrayOutputStream();
System.setOut(new PrintStream(kickAssOut));
int asmRes = KickAssembler.main2(new String[]{asmFile.getAbsolutePath(), "-log", asmLogFile.getAbsolutePath(), "-o", asmPrgFile.getAbsolutePath(), "-vicesymbols", "-showmem"});
System.setOut(new PrintStream(new FileOutputStream(FileDescriptor.out)));
int asmRes = -1;
try {
asmRes = KickAssembler.main2(new String[]{asmFile.getAbsolutePath(), "-log", asmLogFile.getAbsolutePath(), "-o", asmPrgFile.getAbsolutePath(), "-vicesymbols", "-showmem"});
} catch(Throwable e) {
fail("KickAssembling file failed! " + e.getMessage());
} finally {
System.setOut(new PrintStream(new FileOutputStream(FileDescriptor.out)));
}
if(asmRes != 0) {
fail("KickAssembling file failed! " + kickAssOut.toString());
}

View File

@ -0,0 +1,15 @@
// Minimal if() test
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"
.label SCREEN = $400
main: {
ldx #0
lda #'a'
b1:
sta SCREEN,x
inx
cpx #40
bcc b1
rts
}