mirror of
https://github.com/dmolony/DiskBrowser.git
synced 2024-06-15 04:29:27 +00:00
header underlines
This commit is contained in:
parent
2401be0094
commit
7280ead732
|
@ -1,6 +1,8 @@
|
||||||
package com.bytezone.diskbrowser.applefile;
|
package com.bytezone.diskbrowser.applefile;
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------------//
|
||||||
public interface ApplesoftConstants
|
public interface ApplesoftConstants
|
||||||
|
// -----------------------------------------------------------------------------------//
|
||||||
{
|
{
|
||||||
String[] tokens = { //
|
String[] tokens = { //
|
||||||
"END ", "FOR ", "NEXT ", "DATA ", // 0x80 - 0x83
|
"END ", "FOR ", "NEXT ", "DATA ", // 0x80 - 0x83
|
||||||
|
|
|
@ -3,9 +3,13 @@ package com.bytezone.diskbrowser.applefile;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------------//
|
||||||
public class AssemblerBlocks
|
public class AssemblerBlocks
|
||||||
|
// -----------------------------------------------------------------------------------//
|
||||||
{
|
{
|
||||||
|
// ---------------------------------------------------------------------------------//
|
||||||
public AssemblerBlocks (byte[] buffer, int loadAddress)
|
public AssemblerBlocks (byte[] buffer, int loadAddress)
|
||||||
|
// ---------------------------------------------------------------------------------//
|
||||||
{
|
{
|
||||||
int ptr = 0;
|
int ptr = 0;
|
||||||
boolean inCode = true;
|
boolean inCode = true;
|
||||||
|
|
|
@ -1,67 +1,69 @@
|
||||||
package com.bytezone.diskbrowser.applefile;
|
package com.bytezone.diskbrowser.applefile;
|
||||||
|
|
||||||
public interface AssemblerConstants
|
// -----------------------------------------------------------------------------------//
|
||||||
{
|
public interface AssemblerConstants
|
||||||
// 1A = INC A, 3A = DEC A
|
// -----------------------------------------------------------------------------------//
|
||||||
String[] mnemonics = { "BRK", "ORA", "???", "???", "TSB", "ORA", "ASL", "???", // 00
|
{
|
||||||
"PHP", "ORA", "ASL", "???", "TSB", "ORA", "ASL", "???", // 08
|
// 1A = INC A, 3A = DEC A
|
||||||
"BPL", "ORA", "ORA", "???", "TRB", "ORA", "ASL", "???", // 10
|
String[] mnemonics = { "BRK", "ORA", "???", "???", "TSB", "ORA", "ASL", "???", // 00
|
||||||
"CLC", "ORA", "INC", "???", "TRB", "ORA", "ASL", "???", // 18
|
"PHP", "ORA", "ASL", "???", "TSB", "ORA", "ASL", "???", // 08
|
||||||
"JSR", "AND", "???", "???", "BIT", "AND", "ROL", "???", // 20
|
"BPL", "ORA", "ORA", "???", "TRB", "ORA", "ASL", "???", // 10
|
||||||
"PLP", "AND", "ROL", "???", "BIT", "AND", "ROL", "???", // 28
|
"CLC", "ORA", "INC", "???", "TRB", "ORA", "ASL", "???", // 18
|
||||||
"BMI", "AND", "AND", "???", "BIT", "AND", "ROL", "???", // 30
|
"JSR", "AND", "???", "???", "BIT", "AND", "ROL", "???", // 20
|
||||||
"SEC", "AND", "DEC", "???", "BIT", "AND", "ROL", "???", // 38
|
"PLP", "AND", "ROL", "???", "BIT", "AND", "ROL", "???", // 28
|
||||||
"RTI", "EOR", "???", "???", "???", "EOR", "LSR", "???", // 40
|
"BMI", "AND", "AND", "???", "BIT", "AND", "ROL", "???", // 30
|
||||||
"PHA", "EOR", "LSR", "???", "JMP", "EOR", "LSR", "???", // 48
|
"SEC", "AND", "DEC", "???", "BIT", "AND", "ROL", "???", // 38
|
||||||
"BVC", "EOR", "EOR", "???", "???", "EOR", "LSR", "???", // 50
|
"RTI", "EOR", "???", "???", "???", "EOR", "LSR", "???", // 40
|
||||||
"CLI", "EOR", "PHY", "???", "???", "EOR", "LSR", "???", // 58
|
"PHA", "EOR", "LSR", "???", "JMP", "EOR", "LSR", "???", // 48
|
||||||
"RTS", "ADC", "???", "???", "STZ", "ADC", "ROR", "???", // 60
|
"BVC", "EOR", "EOR", "???", "???", "EOR", "LSR", "???", // 50
|
||||||
"PLA", "ADC", "ROR", "???", "JMP", "ADC", "ROR", "???", // 68
|
"CLI", "EOR", "PHY", "???", "???", "EOR", "LSR", "???", // 58
|
||||||
"BVS", "ADC", "ADC", "???", "STZ", "ADC", "ROR", "???", // 70
|
"RTS", "ADC", "???", "???", "STZ", "ADC", "ROR", "???", // 60
|
||||||
"SEI", "ADC", "PLY", "???", "JMP", "ADC", "ROR", "???", // 78
|
"PLA", "ADC", "ROR", "???", "JMP", "ADC", "ROR", "???", // 68
|
||||||
"BRA", "STA", "???", "???", "STY", "STA", "STX", "???", // 80
|
"BVS", "ADC", "ADC", "???", "STZ", "ADC", "ROR", "???", // 70
|
||||||
"DEY", "BIT", "TXA", "???", "STY", "STA", "STX", "???", // 88
|
"SEI", "ADC", "PLY", "???", "JMP", "ADC", "ROR", "???", // 78
|
||||||
"BCC", "STA", "STA", "???", "STY", "STA", "STX", "???", // 90
|
"BRA", "STA", "???", "???", "STY", "STA", "STX", "???", // 80
|
||||||
"TYA", "STA", "TXS", "???", "STZ", "STA", "STZ", "???", // 98
|
"DEY", "BIT", "TXA", "???", "STY", "STA", "STX", "???", // 88
|
||||||
"LDY", "LDA", "LDX", "???", "LDY", "LDA", "LDX", "???", // A0
|
"BCC", "STA", "STA", "???", "STY", "STA", "STX", "???", // 90
|
||||||
"TAY", "LDA", "TAX", "???", "LDY", "LDA", "LDX", "???", // A8
|
"TYA", "STA", "TXS", "???", "STZ", "STA", "STZ", "???", // 98
|
||||||
"BCS", "LDA", "LDA", "???", "LDY", "LDA", "LDX", "???", // B0
|
"LDY", "LDA", "LDX", "???", "LDY", "LDA", "LDX", "???", // A0
|
||||||
"CLV", "LDA", "TSX", "???", "LDY", "LDA", "LDX", "???", // B8
|
"TAY", "LDA", "TAX", "???", "LDY", "LDA", "LDX", "???", // A8
|
||||||
"CPY", "CMP", "???", "???", "CPY", "CMP", "DEC", "???", // C0
|
"BCS", "LDA", "LDA", "???", "LDY", "LDA", "LDX", "???", // B0
|
||||||
"INY", "CMP", "DEX", "???", "CPY", "CMP", "DEC", "???", // C8
|
"CLV", "LDA", "TSX", "???", "LDY", "LDA", "LDX", "???", // B8
|
||||||
"BNE", "CMP", "CMP", "???", "???", "CMP", "DEC", "???", // D0
|
"CPY", "CMP", "???", "???", "CPY", "CMP", "DEC", "???", // C0
|
||||||
"CLD", "CMP", "PHX", "???", "???", "CMP", "DEC", "???", // D8
|
"INY", "CMP", "DEX", "???", "CPY", "CMP", "DEC", "???", // C8
|
||||||
"CPX", "SBC", "???", "???", "CPX", "SBC", "INC", "???", // E0
|
"BNE", "CMP", "CMP", "???", "???", "CMP", "DEC", "???", // D0
|
||||||
"INX", "SBC", "NOP", "???", "CPX", "SBC", "INC", "???", // E8
|
"CLD", "CMP", "PHX", "???", "???", "CMP", "DEC", "???", // D8
|
||||||
"BEQ", "SBC", "SBC", "???", "???", "SBC", "INC", "???", // F0
|
"CPX", "SBC", "???", "???", "CPX", "SBC", "INC", "???", // E0
|
||||||
"SED", "SBC", "PLX", "???", "???", "SBC", "INC", "???" }; // F8
|
"INX", "SBC", "NOP", "???", "CPX", "SBC", "INC", "???", // E8
|
||||||
|
"BEQ", "SBC", "SBC", "???", "???", "SBC", "INC", "???", // F0
|
||||||
byte[] sizes2 = { 1, 2, 0, 0, 2, 2, 2, 0, 1, 2, 1, 0, 3, 3, 3, 0, // 00 - 0F
|
"SED", "SBC", "PLX", "???", "???", "SBC", "INC", "???" }; // F8
|
||||||
2, 2, 2, 0, 2, 2, 2, 0, 1, 3, 1, 0, 3, 3, 3, 0, // 10 - 1F
|
|
||||||
3, 2, 0, 0, 2, 2, 2, 0, 1, 2, 1, 0, 3, 3, 3, 0, // 20 - 2F
|
byte[] sizes2 = { 1, 2, 0, 0, 2, 2, 2, 0, 1, 2, 1, 0, 3, 3, 3, 0, // 00 - 0F
|
||||||
2, 2, 2, 0, 2, 2, 2, 0, 1, 3, 1, 0, 3, 3, 3, 0, // 30 - 3F
|
2, 2, 2, 0, 2, 2, 2, 0, 1, 3, 1, 0, 3, 3, 3, 0, // 10 - 1F
|
||||||
1, 2, 0, 0, 0, 2, 2, 0, 1, 2, 1, 0, 3, 3, 3, 0, // 40 - 4F
|
3, 2, 0, 0, 2, 2, 2, 0, 1, 2, 1, 0, 3, 3, 3, 0, // 20 - 2F
|
||||||
2, 2, 2, 0, 0, 2, 2, 0, 1, 3, 1, 0, 0, 3, 3, 0, // 50 - 5F
|
2, 2, 2, 0, 2, 2, 2, 0, 1, 3, 1, 0, 3, 3, 3, 0, // 30 - 3F
|
||||||
1, 2, 0, 0, 2, 2, 2, 0, 1, 2, 1, 0, 3, 3, 3, 0, // 60 - 6F
|
1, 2, 0, 0, 0, 2, 2, 0, 1, 2, 1, 0, 3, 3, 3, 0, // 40 - 4F
|
||||||
2, 2, 2, 0, 2, 2, 2, 0, 1, 3, 1, 0, 3, 3, 3, 0, // 70 - 7F
|
2, 2, 2, 0, 0, 2, 2, 0, 1, 3, 1, 0, 0, 3, 3, 0, // 50 - 5F
|
||||||
2, 2, 0, 0, 2, 2, 2, 0, 1, 2, 1, 0, 3, 3, 3, 0, // 80 - 8F
|
1, 2, 0, 0, 2, 2, 2, 0, 1, 2, 1, 0, 3, 3, 3, 0, // 60 - 6F
|
||||||
2, 2, 2, 0, 2, 2, 2, 0, 1, 3, 1, 0, 3, 3, 3, 0, // 90 - 9F
|
2, 2, 2, 0, 2, 2, 2, 0, 1, 3, 1, 0, 3, 3, 3, 0, // 70 - 7F
|
||||||
2, 2, 2, 0, 2, 2, 2, 0, 1, 2, 1, 0, 3, 3, 3, 0, // A0 - AF
|
2, 2, 0, 0, 2, 2, 2, 0, 1, 2, 1, 0, 3, 3, 3, 0, // 80 - 8F
|
||||||
2, 2, 2, 0, 2, 2, 2, 0, 1, 3, 1, 0, 3, 3, 3, 0, // B0 - BF
|
2, 2, 2, 0, 2, 2, 2, 0, 1, 3, 1, 0, 3, 3, 3, 0, // 90 - 9F
|
||||||
2, 2, 0, 0, 2, 2, 2, 0, 1, 2, 1, 0, 3, 3, 3, 0, // C0 - CF
|
2, 2, 2, 0, 2, 2, 2, 0, 1, 2, 1, 0, 3, 3, 3, 0, // A0 - AF
|
||||||
2, 2, 2, 0, 0, 2, 2, 0, 1, 3, 1, 0, 0, 3, 3, 0, // D0 - DF
|
2, 2, 2, 0, 2, 2, 2, 0, 1, 3, 1, 0, 3, 3, 3, 0, // B0 - BF
|
||||||
2, 2, 0, 0, 2, 2, 2, 0, 1, 2, 1, 0, 3, 3, 3, 0, // E0 - EF
|
2, 2, 0, 0, 2, 2, 2, 0, 1, 2, 1, 0, 3, 3, 3, 0, // C0 - CF
|
||||||
2, 2, 2, 0, 0, 2, 2, 0, 1, 3, 1, 0, 0, 3, 3, 0 }; // F0 - FF
|
2, 2, 2, 0, 0, 2, 2, 0, 1, 3, 1, 0, 0, 3, 3, 0, // D0 - DF
|
||||||
|
2, 2, 0, 0, 2, 2, 2, 0, 1, 2, 1, 0, 3, 3, 3, 0, // E0 - EF
|
||||||
byte[] sizes = { 1, 1, 2, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2 };
|
2, 2, 2, 0, 0, 2, 2, 0, 1, 3, 1, 0, 0, 3, 3, 0 }; // F0 - FF
|
||||||
|
|
||||||
String[] mode =
|
byte[] sizes = { 1, 1, 2, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2 };
|
||||||
{ "Implied", "Accumulator", "Immediate", "Absolute", "Absolute, X", "Absolute, Y",
|
|
||||||
"(Absolute, X)", "(Absolute)", "Zero page", "Zero page, X", "Zero page, Y",
|
String[] mode =
|
||||||
"(Zero page, X)", "(Zero page), Y", "(Zero page)", "Relative" };
|
{ "Implied", "Accumulator", "Immediate", "Absolute", "Absolute, X", "Absolute, Y",
|
||||||
|
"(Absolute, X)", "(Absolute)", "Zero page", "Zero page, X", "Zero page, Y",
|
||||||
byte[] chip65c02 =
|
"(Zero page, X)", "(Zero page), Y", "(Zero page)", "Relative" };
|
||||||
{ 0x04, 0x0C, 0x12, 0x14, 0x1A, 0x1C, 0x32, 0x34, 0x3A, 0x3C, 0x52, 0x5A, 0x64,
|
|
||||||
0x72, 0x74, 0x7A, 0x7C, (byte) 0x80, (byte) 0x89, (byte) 0x92, (byte) 0x9C,
|
byte[] chip65c02 =
|
||||||
(byte) 0x9E, (byte) 0xB2, (byte) 0xD2, (byte) 0xDA, (byte) 0xF2, (byte) 0xFA, };
|
{ 0x04, 0x0C, 0x12, 0x14, 0x1A, 0x1C, 0x32, 0x34, 0x3A, 0x3C, 0x52, 0x5A, 0x64,
|
||||||
|
0x72, 0x74, 0x7A, 0x7C, (byte) 0x80, (byte) 0x89, (byte) 0x92, (byte) 0x9C,
|
||||||
|
(byte) 0x9E, (byte) 0xB2, (byte) 0xD2, (byte) 0xDA, (byte) 0xF2, (byte) 0xFA, };
|
||||||
}
|
}
|
|
@ -6,7 +6,9 @@ import java.util.Comparator;
|
||||||
import com.bytezone.diskbrowser.utilities.HexFormatter;
|
import com.bytezone.diskbrowser.utilities.HexFormatter;
|
||||||
import com.bytezone.diskbrowser.utilities.Utility;
|
import com.bytezone.diskbrowser.utilities.Utility;
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------------//
|
||||||
public class AssemblerStatement
|
public class AssemblerStatement
|
||||||
|
// -----------------------------------------------------------------------------------//
|
||||||
{
|
{
|
||||||
public byte value;
|
public byte value;
|
||||||
public String mnemonic;
|
public String mnemonic;
|
||||||
|
@ -21,7 +23,9 @@ public class AssemblerStatement
|
||||||
public boolean isTarget;
|
public boolean isTarget;
|
||||||
public byte operand1, operand2;
|
public byte operand1, operand2;
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------------//
|
||||||
public static void print ()
|
public static void print ()
|
||||||
|
// ---------------------------------------------------------------------------------//
|
||||||
{
|
{
|
||||||
AssemblerStatement[] statements = new AssemblerStatement[256];
|
AssemblerStatement[] statements = new AssemblerStatement[256];
|
||||||
System.out.println ();
|
System.out.println ();
|
||||||
|
@ -67,7 +71,9 @@ public class AssemblerStatement
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------------//
|
||||||
public AssemblerStatement (byte opcode)
|
public AssemblerStatement (byte opcode)
|
||||||
|
// ---------------------------------------------------------------------------------//
|
||||||
{
|
{
|
||||||
this.value = opcode;
|
this.value = opcode;
|
||||||
this.opcode = opcode & 0xFF;
|
this.opcode = opcode & 0xFF;
|
||||||
|
@ -76,7 +82,9 @@ public class AssemblerStatement
|
||||||
this.operand = "";
|
this.operand = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------------//
|
||||||
String getChar (byte val)
|
String getChar (byte val)
|
||||||
|
// ---------------------------------------------------------------------------------//
|
||||||
{
|
{
|
||||||
int c = val & 0xFF;
|
int c = val & 0xFF;
|
||||||
if (c > 127)
|
if (c > 127)
|
||||||
|
@ -92,7 +100,9 @@ public class AssemblerStatement
|
||||||
return (char) c + "";
|
return (char) c + "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------------//
|
||||||
public void addData ()
|
public void addData ()
|
||||||
|
// ---------------------------------------------------------------------------------//
|
||||||
{
|
{
|
||||||
switch (opcode)
|
switch (opcode)
|
||||||
{
|
{
|
||||||
|
@ -142,7 +152,9 @@ public class AssemblerStatement
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------------//
|
||||||
public void addData (byte b)
|
public void addData (byte b)
|
||||||
|
// ---------------------------------------------------------------------------------//
|
||||||
{
|
{
|
||||||
operand1 = b;
|
operand1 = b;
|
||||||
String address = "$" + HexFormatter.format2 (b);
|
String address = "$" + HexFormatter.format2 (b);
|
||||||
|
@ -277,7 +289,9 @@ public class AssemblerStatement
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------------//
|
||||||
public void addData (byte b1, byte b2)
|
public void addData (byte b1, byte b2)
|
||||||
|
// ---------------------------------------------------------------------------------//
|
||||||
{
|
{
|
||||||
operand1 = b1;
|
operand1 = b1;
|
||||||
operand2 = b2;
|
operand2 = b2;
|
||||||
|
@ -365,8 +379,10 @@ public class AssemblerStatement
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------------//
|
||||||
@Override
|
@Override
|
||||||
public String toString ()
|
public String toString ()
|
||||||
|
// ---------------------------------------------------------------------------------//
|
||||||
{
|
{
|
||||||
if (offset == 0)
|
if (offset == 0)
|
||||||
return String.format ("%06X %d %3s %-10s %02X", address, size, mnemonic, operand,
|
return String.format ("%06X %d %3s %-10s %02X", address, size, mnemonic, operand,
|
||||||
|
|
|
@ -5,7 +5,9 @@ import com.bytezone.diskbrowser.disk.Disk;
|
||||||
import com.bytezone.diskbrowser.disk.DiskAddress;
|
import com.bytezone.diskbrowser.disk.DiskAddress;
|
||||||
import com.bytezone.diskbrowser.utilities.HexFormatter;
|
import com.bytezone.diskbrowser.utilities.HexFormatter;
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------------//
|
||||||
public class BootSector extends AbstractSector
|
public class BootSector extends AbstractSector
|
||||||
|
// -----------------------------------------------------------------------------------//
|
||||||
{
|
{
|
||||||
private static final byte[] skew = { 0x00, 0x0D, 0x0B, 0x09, 0x07, 0x05, 0x03, 0x01,
|
private static final byte[] skew = { 0x00, 0x0D, 0x0B, 0x09, 0x07, 0x05, 0x03, 0x01,
|
||||||
0x0E, 0x0C, 0x0A, 0x08, 0x06, 0x04, 0x02, 0x0F };
|
0x0E, 0x0C, 0x0A, 0x08, 0x06, 0x04, 0x02, 0x0F };
|
||||||
|
@ -16,20 +18,26 @@ public class BootSector extends AbstractSector
|
||||||
AssemblerProgram assembler2;
|
AssemblerProgram assembler2;
|
||||||
String name; // DOS or Prodos
|
String name; // DOS or Prodos
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------------//
|
||||||
public BootSector (Disk disk, byte[] buffer, String name, DiskAddress diskAddress)
|
public BootSector (Disk disk, byte[] buffer, String name, DiskAddress diskAddress)
|
||||||
|
// ---------------------------------------------------------------------------------//
|
||||||
{
|
{
|
||||||
super (disk, buffer, diskAddress);
|
super (disk, buffer, diskAddress);
|
||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------------//
|
||||||
public BootSector (Disk disk, byte[] buffer, String name)
|
public BootSector (Disk disk, byte[] buffer, String name)
|
||||||
|
// ---------------------------------------------------------------------------------//
|
||||||
{
|
{
|
||||||
super (disk, buffer);
|
super (disk, buffer);
|
||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------------//
|
||||||
@Override
|
@Override
|
||||||
public String createText ()
|
public String createText ()
|
||||||
|
// ---------------------------------------------------------------------------------//
|
||||||
{
|
{
|
||||||
StringBuilder text = new StringBuilder ();
|
StringBuilder text = new StringBuilder ();
|
||||||
|
|
||||||
|
@ -80,7 +88,9 @@ public class BootSector extends AbstractSector
|
||||||
return text.toString ();
|
return text.toString ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------------//
|
||||||
private boolean matches (byte[] buffer, int offset, byte[] test)
|
private boolean matches (byte[] buffer, int offset, byte[] test)
|
||||||
|
// ---------------------------------------------------------------------------------//
|
||||||
{
|
{
|
||||||
if (test.length == 0 || test.length > buffer.length - offset)
|
if (test.length == 0 || test.length > buffer.length - offset)
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -1,24 +1,33 @@
|
||||||
package com.bytezone.diskbrowser.applefile;
|
package com.bytezone.diskbrowser.applefile;
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------------//
|
||||||
public class ErrorMessageFile extends AbstractFile
|
public class ErrorMessageFile extends AbstractFile
|
||||||
|
// -----------------------------------------------------------------------------------//
|
||||||
{
|
{
|
||||||
String text;
|
String text;
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------------//
|
||||||
public ErrorMessageFile (String name, byte[] buffer, Exception e)
|
public ErrorMessageFile (String name, byte[] buffer, Exception e)
|
||||||
|
// ---------------------------------------------------------------------------------//
|
||||||
{
|
{
|
||||||
super (name, buffer);
|
super (name, buffer);
|
||||||
|
|
||||||
StringBuilder text = new StringBuilder ();
|
StringBuilder text = new StringBuilder ();
|
||||||
text.append ("Oops! : " + e.toString () + "\n\n");
|
text.append ("Oops! : " + e.toString () + "\n\n");
|
||||||
|
|
||||||
for (StackTraceElement ste : e.getStackTrace ())
|
for (StackTraceElement ste : e.getStackTrace ())
|
||||||
text.append (ste + "\n");
|
text.append (ste + "\n");
|
||||||
|
|
||||||
if (text.length () > 0)
|
if (text.length () > 0)
|
||||||
text.deleteCharAt (text.length () - 1);
|
text.deleteCharAt (text.length () - 1);
|
||||||
|
|
||||||
this.text = text.toString ();
|
this.text = text.toString ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------------//
|
||||||
@Override
|
@Override
|
||||||
public String getText ()
|
public String getText ()
|
||||||
|
// ---------------------------------------------------------------------------------//
|
||||||
{
|
{
|
||||||
return text;
|
return text;
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,7 @@ package com.bytezone.diskbrowser.applefile;
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------------//
|
// -----------------------------------------------------------------------------------//
|
||||||
public class ExoBufferC
|
public class ExoBufferC
|
||||||
|
// -----------------------------------------------------------------------------------//
|
||||||
{
|
{
|
||||||
private static int PBIT_BITS_ORDER_BE = 0;
|
private static int PBIT_BITS_ORDER_BE = 0;
|
||||||
private static int PBIT_BITS_COPY_GT_7 = 1;
|
private static int PBIT_BITS_COPY_GT_7 = 1;
|
||||||
|
|
|
@ -1,11 +1,15 @@
|
||||||
package com.bytezone.diskbrowser.applefile;
|
package com.bytezone.diskbrowser.applefile;
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------------//
|
||||||
public class FaddenHiResImage extends OriginalHiResImage
|
public class FaddenHiResImage extends OriginalHiResImage
|
||||||
|
// -----------------------------------------------------------------------------------//
|
||||||
{
|
{
|
||||||
// https://github.com/fadden/fhpack/blob/master/fhpack.cpp
|
// https://github.com/fadden/fhpack/blob/master/fhpack.cpp
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------------//
|
||||||
public FaddenHiResImage (String name, byte[] buffer, int fileType, int auxType,
|
public FaddenHiResImage (String name, byte[] buffer, int fileType, int auxType,
|
||||||
int endOfFile)
|
int endOfFile)
|
||||||
|
// ---------------------------------------------------------------------------------//
|
||||||
{
|
{
|
||||||
super (name, buffer, fileType, auxType, endOfFile);
|
super (name, buffer, fileType, auxType, endOfFile);
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,9 @@ import java.util.List;
|
||||||
import com.bytezone.diskbrowser.utilities.HexFormatter;
|
import com.bytezone.diskbrowser.utilities.HexFormatter;
|
||||||
import com.bytezone.diskbrowser.utilities.Utility;
|
import com.bytezone.diskbrowser.utilities.Utility;
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------------//
|
||||||
public class FileTypeDescriptorTable extends AbstractFile
|
public class FileTypeDescriptorTable extends AbstractFile
|
||||||
|
// -----------------------------------------------------------------------------------//
|
||||||
{
|
{
|
||||||
int versionMajor;
|
int versionMajor;
|
||||||
int versionMinor;
|
int versionMinor;
|
||||||
|
@ -18,7 +20,9 @@ public class FileTypeDescriptorTable extends AbstractFile
|
||||||
|
|
||||||
private final List<IndexRecord> indexRecords = new ArrayList<> ();
|
private final List<IndexRecord> indexRecords = new ArrayList<> ();
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------------//
|
||||||
public FileTypeDescriptorTable (String name, byte[] buffer)
|
public FileTypeDescriptorTable (String name, byte[] buffer)
|
||||||
|
// ---------------------------------------------------------------------------------//
|
||||||
{
|
{
|
||||||
super (name, buffer);
|
super (name, buffer);
|
||||||
|
|
||||||
|
@ -38,8 +42,10 @@ public class FileTypeDescriptorTable extends AbstractFile
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------------//
|
||||||
@Override
|
@Override
|
||||||
public String getText ()
|
public String getText ()
|
||||||
|
// ---------------------------------------------------------------------------------//
|
||||||
{
|
{
|
||||||
StringBuilder text = new StringBuilder ("Name : " + name + "\n\n");
|
StringBuilder text = new StringBuilder ("Name : " + name + "\n\n");
|
||||||
text.append ("File Type Descriptor Table\n\n");
|
text.append ("File Type Descriptor Table\n\n");
|
||||||
|
@ -62,7 +68,9 @@ public class FileTypeDescriptorTable extends AbstractFile
|
||||||
return text.toString ();
|
return text.toString ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------------//
|
||||||
class IndexRecord
|
class IndexRecord
|
||||||
|
// ---------------------------------------------------------------------------------//
|
||||||
{
|
{
|
||||||
int fileType;
|
int fileType;
|
||||||
int auxType;
|
int auxType;
|
||||||
|
|
|
@ -3,7 +3,9 @@ package com.bytezone.diskbrowser.applefile;
|
||||||
import com.bytezone.diskbrowser.utilities.HexFormatter;
|
import com.bytezone.diskbrowser.utilities.HexFormatter;
|
||||||
import com.bytezone.diskbrowser.utilities.Utility;
|
import com.bytezone.diskbrowser.utilities.Utility;
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------------//
|
||||||
public class IntegerBasicProgram extends BasicProgram
|
public class IntegerBasicProgram extends BasicProgram
|
||||||
|
// -----------------------------------------------------------------------------------//
|
||||||
{
|
{
|
||||||
private static String[] tokens =
|
private static String[] tokens =
|
||||||
{ "?", "?", "?", " : ", "?", "?", "?", "?", "?", "?", "?", "?", "CLR", "?", "?",
|
{ "?", "?", "?", " : ", "?", "?", "?", "?", "?", "?", "?", "?", "CLR", "?", "?",
|
||||||
|
@ -19,13 +21,17 @@ public class IntegerBasicProgram extends BasicProgram
|
||||||
"LIST ", ",", "LIST ", "POP ", "NODSP ", "NODSP ", "NOTRACE ", "DSP ", "DSP ",
|
"LIST ", ",", "LIST ", "POP ", "NODSP ", "NODSP ", "NOTRACE ", "DSP ", "DSP ",
|
||||||
"TRACE ", "PR#", "IN#", };
|
"TRACE ", "PR#", "IN#", };
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------------//
|
||||||
public IntegerBasicProgram (String name, byte[] buffer)
|
public IntegerBasicProgram (String name, byte[] buffer)
|
||||||
|
// ---------------------------------------------------------------------------------//
|
||||||
{
|
{
|
||||||
super (name, buffer);
|
super (name, buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------------//
|
||||||
@Override
|
@Override
|
||||||
public String getText ()
|
public String getText ()
|
||||||
|
// ---------------------------------------------------------------------------------//
|
||||||
{
|
{
|
||||||
StringBuilder pgm = new StringBuilder ();
|
StringBuilder pgm = new StringBuilder ();
|
||||||
pgm.append ("Name : " + name + "\n");
|
pgm.append ("Name : " + name + "\n");
|
||||||
|
@ -77,7 +83,9 @@ public class IntegerBasicProgram extends BasicProgram
|
||||||
return pgm.toString ();
|
return pgm.toString ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------------//
|
||||||
private void appendAssembler (StringBuilder pgm, int ptr, int lineLength)
|
private void appendAssembler (StringBuilder pgm, int ptr, int lineLength)
|
||||||
|
// ---------------------------------------------------------------------------------//
|
||||||
{
|
{
|
||||||
for (int i = ptr + 3; i < ptr + lineLength - 1; i++)
|
for (int i = ptr + 3; i < ptr + lineLength - 1; i++)
|
||||||
{
|
{
|
||||||
|
@ -93,7 +101,9 @@ public class IntegerBasicProgram extends BasicProgram
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------------//
|
||||||
private boolean checkForAssembler ()
|
private boolean checkForAssembler ()
|
||||||
|
// ---------------------------------------------------------------------------------//
|
||||||
{
|
{
|
||||||
int ptr = 0;
|
int ptr = 0;
|
||||||
|
|
||||||
|
@ -117,7 +127,9 @@ public class IntegerBasicProgram extends BasicProgram
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------------//
|
||||||
private boolean checkForSCAssembler ()
|
private boolean checkForSCAssembler ()
|
||||||
|
// ---------------------------------------------------------------------------------//
|
||||||
{
|
{
|
||||||
if (buffer.length == 0)
|
if (buffer.length == 0)
|
||||||
{
|
{
|
||||||
|
@ -130,7 +142,9 @@ public class IntegerBasicProgram extends BasicProgram
|
||||||
return buffer[lineLength - 1] == 0;
|
return buffer[lineLength - 1] == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------------//
|
||||||
private void appendSCAssembler (StringBuilder text, int ptr)
|
private void appendSCAssembler (StringBuilder text, int ptr)
|
||||||
|
// ---------------------------------------------------------------------------------//
|
||||||
{
|
{
|
||||||
int lineNumber = (buffer[ptr + 2] & 0xFF) * 256 + (buffer[ptr + 1] & 0xFF);
|
int lineNumber = (buffer[ptr + 2] & 0xFF) * 256 + (buffer[ptr + 1] & 0xFF);
|
||||||
text.append (String.format ("%4d: ", lineNumber));
|
text.append (String.format ("%4d: ", lineNumber));
|
||||||
|
@ -156,7 +170,9 @@ public class IntegerBasicProgram extends BasicProgram
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------------//
|
||||||
private void appendInteger (StringBuilder text, int ptr, int lineLength)
|
private void appendInteger (StringBuilder text, int ptr, int lineLength)
|
||||||
|
// ---------------------------------------------------------------------------------//
|
||||||
{
|
{
|
||||||
int lineNumber = Utility.intValue (buffer[ptr + 1], buffer[ptr + 2]);
|
int lineNumber = Utility.intValue (buffer[ptr + 1], buffer[ptr + 2]);
|
||||||
|
|
||||||
|
@ -208,8 +224,10 @@ public class IntegerBasicProgram extends BasicProgram
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------------//
|
||||||
@Override
|
@Override
|
||||||
public String getHexDump ()
|
public String getHexDump ()
|
||||||
|
// ---------------------------------------------------------------------------------//
|
||||||
{
|
{
|
||||||
if (false)
|
if (false)
|
||||||
return super.getHexDump ();
|
return super.getHexDump ();
|
||||||
|
@ -247,6 +265,7 @@ public class IntegerBasicProgram extends BasicProgram
|
||||||
|
|
||||||
return pgm.toString ();
|
return pgm.toString ();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* To find integer basic in memory:
|
* To find integer basic in memory:
|
||||||
* $CA $CB contain the starting address ($9464)
|
* $CA $CB contain the starting address ($9464)
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
package com.bytezone.diskbrowser.applefile;
|
package com.bytezone.diskbrowser.applefile;
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------------//
|
||||||
public class MerlinSource extends AbstractFile
|
public class MerlinSource extends AbstractFile
|
||||||
|
// -----------------------------------------------------------------------------------//
|
||||||
{
|
{
|
||||||
int ptr;
|
int ptr;
|
||||||
private static int[] tabs = { 12, 19, 35 };
|
private static int[] tabs = { 12, 19, 35 };
|
||||||
|
@ -10,7 +12,9 @@ public class MerlinSource extends AbstractFile
|
||||||
private boolean prodosFile;
|
private boolean prodosFile;
|
||||||
|
|
||||||
// Source : Prodos text file
|
// Source : Prodos text file
|
||||||
|
// ---------------------------------------------------------------------------------//
|
||||||
public MerlinSource (String name, byte[] buffer, int recordLength, int eof)
|
public MerlinSource (String name, byte[] buffer, int recordLength, int eof)
|
||||||
|
// ---------------------------------------------------------------------------------//
|
||||||
{
|
{
|
||||||
super (name, buffer);
|
super (name, buffer);
|
||||||
this.eof = eof;
|
this.eof = eof;
|
||||||
|
@ -19,7 +23,9 @@ public class MerlinSource extends AbstractFile
|
||||||
}
|
}
|
||||||
|
|
||||||
// Source : Dos binary file
|
// Source : Dos binary file
|
||||||
|
// ---------------------------------------------------------------------------------//
|
||||||
public MerlinSource (String name, byte[] buffer, int loadAddress)
|
public MerlinSource (String name, byte[] buffer, int loadAddress)
|
||||||
|
// ---------------------------------------------------------------------------------//
|
||||||
{
|
{
|
||||||
super (name, buffer);
|
super (name, buffer);
|
||||||
this.eof = 0;
|
this.eof = 0;
|
||||||
|
@ -27,8 +33,10 @@ public class MerlinSource extends AbstractFile
|
||||||
this.loadAddress = loadAddress;
|
this.loadAddress = loadAddress;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------------//
|
||||||
@Override
|
@Override
|
||||||
public String getText ()
|
public String getText ()
|
||||||
|
// ---------------------------------------------------------------------------------//
|
||||||
{
|
{
|
||||||
StringBuilder text = new StringBuilder ();
|
StringBuilder text = new StringBuilder ();
|
||||||
|
|
||||||
|
@ -53,7 +61,9 @@ public class MerlinSource extends AbstractFile
|
||||||
return text.toString ();
|
return text.toString ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------------//
|
||||||
private String getLine ()
|
private String getLine ()
|
||||||
|
// ---------------------------------------------------------------------------------//
|
||||||
{
|
{
|
||||||
StringBuilder line = new StringBuilder ();
|
StringBuilder line = new StringBuilder ();
|
||||||
boolean comment = false;
|
boolean comment = false;
|
||||||
|
@ -85,7 +95,9 @@ public class MerlinSource extends AbstractFile
|
||||||
return line.toString ();
|
return line.toString ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------------//
|
||||||
private StringBuilder tab (StringBuilder text)
|
private StringBuilder tab (StringBuilder text)
|
||||||
|
// ---------------------------------------------------------------------------------//
|
||||||
{
|
{
|
||||||
int nextTab = 0;
|
int nextTab = 0;
|
||||||
for (int tab : tabs)
|
for (int tab : tabs)
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
package com.bytezone.diskbrowser.applefile;
|
package com.bytezone.diskbrowser.applefile;
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------------//
|
||||||
public class Palette
|
public class Palette
|
||||||
|
// -----------------------------------------------------------------------------------//
|
||||||
{
|
{
|
||||||
/*-
|
/*-
|
||||||
* Michael Pohoreski - The Apple II Forever Anthology
|
* Michael Pohoreski - The Apple II Forever Anthology
|
||||||
|
@ -32,24 +34,32 @@ public class Palette
|
||||||
private final String name;
|
private final String name;
|
||||||
private final int[] colours;
|
private final int[] colours;
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------------//
|
||||||
public Palette (String name, int[] colours)
|
public Palette (String name, int[] colours)
|
||||||
|
// ---------------------------------------------------------------------------------//
|
||||||
{
|
{
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.colours = colours;
|
this.colours = colours;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------------//
|
||||||
public String getName ()
|
public String getName ()
|
||||||
|
// ---------------------------------------------------------------------------------//
|
||||||
{
|
{
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------------//
|
||||||
public int[] getColours ()
|
public int[] getColours ()
|
||||||
|
// ---------------------------------------------------------------------------------//
|
||||||
{
|
{
|
||||||
return colours;
|
return colours;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------------//
|
||||||
@Override
|
@Override
|
||||||
public String toString ()
|
public String toString ()
|
||||||
|
// ---------------------------------------------------------------------------------//
|
||||||
{
|
{
|
||||||
return String.format ("Palette: %s", name);
|
return String.format ("Palette: %s", name);
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,9 @@ package com.bytezone.diskbrowser.applefile;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------------//
|
||||||
public class PaletteFactory
|
public class PaletteFactory
|
||||||
|
// -----------------------------------------------------------------------------------//
|
||||||
{
|
{
|
||||||
private final List<Palette> palettes = new ArrayList<> ();
|
private final List<Palette> palettes = new ArrayList<> ();
|
||||||
private int currentPalette;
|
private int currentPalette;
|
||||||
|
@ -13,7 +15,9 @@ public class PaletteFactory
|
||||||
FORWARDS, BACKWARDS
|
FORWARDS, BACKWARDS
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------------//
|
||||||
public PaletteFactory ()
|
public PaletteFactory ()
|
||||||
|
// ---------------------------------------------------------------------------------//
|
||||||
{
|
{
|
||||||
palettes.add (//
|
palettes.add (//
|
||||||
new Palette ("Virtual II", new int[] { 0x000000, // 0 black
|
new Palette ("Virtual II", new int[] { 0x000000, // 0 black
|
||||||
|
@ -168,7 +172,9 @@ public class PaletteFactory
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------------//
|
||||||
public Palette cyclePalette (CycleDirection direction)
|
public Palette cyclePalette (CycleDirection direction)
|
||||||
|
// ---------------------------------------------------------------------------------//
|
||||||
{
|
{
|
||||||
switch (direction)
|
switch (direction)
|
||||||
{
|
{
|
||||||
|
@ -187,28 +193,38 @@ public class PaletteFactory
|
||||||
return getCurrentPalette ();
|
return getCurrentPalette ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------------//
|
||||||
public List<Palette> getPalettes ()
|
public List<Palette> getPalettes ()
|
||||||
|
// ---------------------------------------------------------------------------------//
|
||||||
{
|
{
|
||||||
return palettes;
|
return palettes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------------//
|
||||||
public Palette getCurrentPalette ()
|
public Palette getCurrentPalette ()
|
||||||
|
// ---------------------------------------------------------------------------------//
|
||||||
{
|
{
|
||||||
return palettes.get (currentPalette);
|
return palettes.get (currentPalette);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------------//
|
||||||
public int getCurrentPaletteIndex ()
|
public int getCurrentPaletteIndex ()
|
||||||
|
// ---------------------------------------------------------------------------------//
|
||||||
{
|
{
|
||||||
return currentPalette;
|
return currentPalette;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------------//
|
||||||
public void setCurrentPalette (int index)
|
public void setCurrentPalette (int index)
|
||||||
|
// ---------------------------------------------------------------------------------//
|
||||||
{
|
{
|
||||||
assert index >= 0 && index < palettes.size ();
|
assert index >= 0 && index < palettes.size ();
|
||||||
currentPalette = index;
|
currentPalette = index;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------------//
|
||||||
public void setCurrentPalette (Palette palette)
|
public void setCurrentPalette (Palette palette)
|
||||||
|
// ---------------------------------------------------------------------------------//
|
||||||
{
|
{
|
||||||
int count = 0;
|
int count = 0;
|
||||||
for (Palette p : palettes)
|
for (Palette p : palettes)
|
||||||
|
@ -222,12 +238,16 @@ public class PaletteFactory
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------------//
|
||||||
public Palette get (int index)
|
public Palette get (int index)
|
||||||
|
// ---------------------------------------------------------------------------------//
|
||||||
{
|
{
|
||||||
return palettes.get (index);
|
return palettes.get (index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------------//
|
||||||
private int rgb (int red, int green, int blue)
|
private int rgb (int red, int green, int blue)
|
||||||
|
// ---------------------------------------------------------------------------------//
|
||||||
{
|
{
|
||||||
return red << 16 | green << 8 | blue;
|
return red << 16 | green << 8 | blue;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user