|
@@ -193,9 +193,13 @@ public class SPSAssembler {
|
|
|
|
|
|
private static void outputTPSTXT() {
|
|
|
try (Writer writer = new BufferedWriter(new FileWriter(destinationFile))) {
|
|
|
+ writer.write("Addr BD Befehl Daten Kommentar\r\n");
|
|
|
int address = 0;
|
|
|
for (Mnemonic mnemonic : mnemonics) {
|
|
|
- writer.write(String.format("0x%03x\r\n", address));
|
|
|
+ byte lowNibble = (byte) (mnemonic.getByte() & 0x0f);
|
|
|
+ byte highNibble = (byte) ((mnemonic.getByte() >> 4) & 0x0f);
|
|
|
+ writer.write(String.format("0x%03x %02x %4s %4s %s %s\r\n", address, mnemonic.getByte(), nibbleToString(highNibble),
|
|
|
+ nibbleToString(lowNibble), mnemonic.getName(), StringUtils.isEmpty(mnemonic.getArgument()) ? "" : mnemonic.getArgument()));
|
|
|
mnemonic.getByte();
|
|
|
address++;
|
|
|
}
|
|
@@ -205,6 +209,15 @@ public class SPSAssembler {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ private static String nibbleToString(byte lowNibble) {
|
|
|
+ StringBuilder b = new StringBuilder();
|
|
|
+ b.append((lowNibble & 0x08) > 0 ? "X" : "0");
|
|
|
+ b.append((lowNibble & 0x04) > 0 ? "X" : "0");
|
|
|
+ b.append((lowNibble & 0x02) > 0 ? "X" : "0");
|
|
|
+ b.append((lowNibble & 0x01) > 0 ? "X" : "0");
|
|
|
+ return b.toString();
|
|
|
+ }
|
|
|
+
|
|
|
private static void outputHEX() throws FileNotFoundException, IOException {
|
|
|
IntelHex intelHex = new IntelHex();
|
|
|
byte[] data = new byte[mnemonics.size()];
|