header underlines

This commit is contained in:
Denis Molony 2020-09-14 17:59:15 +10:00
parent 2401be0094
commit 7280ead732
13 changed files with 183 additions and 66 deletions

View File

@ -1,6 +1,8 @@
package com.bytezone.diskbrowser.applefile;
// -----------------------------------------------------------------------------------//
public interface ApplesoftConstants
// -----------------------------------------------------------------------------------//
{
String[] tokens = { //
"END ", "FOR ", "NEXT ", "DATA ", // 0x80 - 0x83

View File

@ -3,9 +3,13 @@ package com.bytezone.diskbrowser.applefile;
import java.util.ArrayList;
import java.util.List;
// -----------------------------------------------------------------------------------//
public class AssemblerBlocks
// -----------------------------------------------------------------------------------//
{
// ---------------------------------------------------------------------------------//
public AssemblerBlocks (byte[] buffer, int loadAddress)
// ---------------------------------------------------------------------------------//
{
int ptr = 0;
boolean inCode = true;

View File

@ -1,6 +1,8 @@
package com.bytezone.diskbrowser.applefile;
// -----------------------------------------------------------------------------------//
public interface AssemblerConstants
// -----------------------------------------------------------------------------------//
{
// 1A = INC A, 3A = DEC A
String[] mnemonics = { "BRK", "ORA", "???", "???", "TSB", "ORA", "ASL", "???", // 00

View File

@ -6,7 +6,9 @@ import java.util.Comparator;
import com.bytezone.diskbrowser.utilities.HexFormatter;
import com.bytezone.diskbrowser.utilities.Utility;
// -----------------------------------------------------------------------------------//
public class AssemblerStatement
// -----------------------------------------------------------------------------------//
{
public byte value;
public String mnemonic;
@ -21,7 +23,9 @@ public class AssemblerStatement
public boolean isTarget;
public byte operand1, operand2;
// ---------------------------------------------------------------------------------//
public static void print ()
// ---------------------------------------------------------------------------------//
{
AssemblerStatement[] statements = new AssemblerStatement[256];
System.out.println ();
@ -67,7 +71,9 @@ public class AssemblerStatement
}
}
// ---------------------------------------------------------------------------------//
public AssemblerStatement (byte opcode)
// ---------------------------------------------------------------------------------//
{
this.value = opcode;
this.opcode = opcode & 0xFF;
@ -76,7 +82,9 @@ public class AssemblerStatement
this.operand = "";
}
// ---------------------------------------------------------------------------------//
String getChar (byte val)
// ---------------------------------------------------------------------------------//
{
int c = val & 0xFF;
if (c > 127)
@ -92,7 +100,9 @@ public class AssemblerStatement
return (char) c + "";
}
// ---------------------------------------------------------------------------------//
public void addData ()
// ---------------------------------------------------------------------------------//
{
switch (opcode)
{
@ -142,7 +152,9 @@ public class AssemblerStatement
}
}
// ---------------------------------------------------------------------------------//
public void addData (byte b)
// ---------------------------------------------------------------------------------//
{
operand1 = b;
String address = "$" + HexFormatter.format2 (b);
@ -277,7 +289,9 @@ public class AssemblerStatement
}
}
// ---------------------------------------------------------------------------------//
public void addData (byte b1, byte b2)
// ---------------------------------------------------------------------------------//
{
operand1 = b1;
operand2 = b2;
@ -365,8 +379,10 @@ public class AssemblerStatement
}
}
// ---------------------------------------------------------------------------------//
@Override
public String toString ()
// ---------------------------------------------------------------------------------//
{
if (offset == 0)
return String.format ("%06X %d %3s %-10s %02X", address, size, mnemonic, operand,

View File

@ -5,7 +5,9 @@ import com.bytezone.diskbrowser.disk.Disk;
import com.bytezone.diskbrowser.disk.DiskAddress;
import com.bytezone.diskbrowser.utilities.HexFormatter;
// -----------------------------------------------------------------------------------//
public class BootSector extends AbstractSector
// -----------------------------------------------------------------------------------//
{
private static final byte[] skew = { 0x00, 0x0D, 0x0B, 0x09, 0x07, 0x05, 0x03, 0x01,
0x0E, 0x0C, 0x0A, 0x08, 0x06, 0x04, 0x02, 0x0F };
@ -16,20 +18,26 @@ public class BootSector extends AbstractSector
AssemblerProgram assembler2;
String name; // DOS or Prodos
// ---------------------------------------------------------------------------------//
public BootSector (Disk disk, byte[] buffer, String name, DiskAddress diskAddress)
// ---------------------------------------------------------------------------------//
{
super (disk, buffer, diskAddress);
this.name = name;
}
// ---------------------------------------------------------------------------------//
public BootSector (Disk disk, byte[] buffer, String name)
// ---------------------------------------------------------------------------------//
{
super (disk, buffer);
this.name = name;
}
// ---------------------------------------------------------------------------------//
@Override
public String createText ()
// ---------------------------------------------------------------------------------//
{
StringBuilder text = new StringBuilder ();
@ -80,7 +88,9 @@ public class BootSector extends AbstractSector
return text.toString ();
}
// ---------------------------------------------------------------------------------//
private boolean matches (byte[] buffer, int offset, byte[] test)
// ---------------------------------------------------------------------------------//
{
if (test.length == 0 || test.length > buffer.length - offset)
return false;

View File

@ -1,24 +1,33 @@
package com.bytezone.diskbrowser.applefile;
// -----------------------------------------------------------------------------------//
public class ErrorMessageFile extends AbstractFile
// -----------------------------------------------------------------------------------//
{
String text;
// ---------------------------------------------------------------------------------//
public ErrorMessageFile (String name, byte[] buffer, Exception e)
// ---------------------------------------------------------------------------------//
{
super (name, buffer);
StringBuilder text = new StringBuilder ();
text.append ("Oops! : " + e.toString () + "\n\n");
for (StackTraceElement ste : e.getStackTrace ())
text.append (ste + "\n");
if (text.length () > 0)
text.deleteCharAt (text.length () - 1);
this.text = text.toString ();
}
// ---------------------------------------------------------------------------------//
@Override
public String getText ()
// ---------------------------------------------------------------------------------//
{
return text;
}

View File

@ -5,6 +5,7 @@ package com.bytezone.diskbrowser.applefile;
// -----------------------------------------------------------------------------------//
public class ExoBufferC
// -----------------------------------------------------------------------------------//
{
private static int PBIT_BITS_ORDER_BE = 0;
private static int PBIT_BITS_COPY_GT_7 = 1;

View File

@ -1,11 +1,15 @@
package com.bytezone.diskbrowser.applefile;
// -----------------------------------------------------------------------------------//
public class FaddenHiResImage extends OriginalHiResImage
// -----------------------------------------------------------------------------------//
{
// https://github.com/fadden/fhpack/blob/master/fhpack.cpp
// ---------------------------------------------------------------------------------//
public FaddenHiResImage (String name, byte[] buffer, int fileType, int auxType,
int endOfFile)
// ---------------------------------------------------------------------------------//
{
super (name, buffer, fileType, auxType, endOfFile);

View File

@ -6,7 +6,9 @@ import java.util.List;
import com.bytezone.diskbrowser.utilities.HexFormatter;
import com.bytezone.diskbrowser.utilities.Utility;
// -----------------------------------------------------------------------------------//
public class FileTypeDescriptorTable extends AbstractFile
// -----------------------------------------------------------------------------------//
{
int versionMajor;
int versionMinor;
@ -18,7 +20,9 @@ public class FileTypeDescriptorTable extends AbstractFile
private final List<IndexRecord> indexRecords = new ArrayList<> ();
// ---------------------------------------------------------------------------------//
public FileTypeDescriptorTable (String name, byte[] buffer)
// ---------------------------------------------------------------------------------//
{
super (name, buffer);
@ -38,8 +42,10 @@ public class FileTypeDescriptorTable extends AbstractFile
}
}
// ---------------------------------------------------------------------------------//
@Override
public String getText ()
// ---------------------------------------------------------------------------------//
{
StringBuilder text = new StringBuilder ("Name : " + name + "\n\n");
text.append ("File Type Descriptor Table\n\n");
@ -62,7 +68,9 @@ public class FileTypeDescriptorTable extends AbstractFile
return text.toString ();
}
// ---------------------------------------------------------------------------------//
class IndexRecord
// ---------------------------------------------------------------------------------//
{
int fileType;
int auxType;

View File

@ -3,7 +3,9 @@ package com.bytezone.diskbrowser.applefile;
import com.bytezone.diskbrowser.utilities.HexFormatter;
import com.bytezone.diskbrowser.utilities.Utility;
// -----------------------------------------------------------------------------------//
public class IntegerBasicProgram extends BasicProgram
// -----------------------------------------------------------------------------------//
{
private static String[] tokens =
{ "?", "?", "?", " : ", "?", "?", "?", "?", "?", "?", "?", "?", "CLR", "?", "?",
@ -19,13 +21,17 @@ public class IntegerBasicProgram extends BasicProgram
"LIST ", ",", "LIST ", "POP ", "NODSP ", "NODSP ", "NOTRACE ", "DSP ", "DSP ",
"TRACE ", "PR#", "IN#", };
// ---------------------------------------------------------------------------------//
public IntegerBasicProgram (String name, byte[] buffer)
// ---------------------------------------------------------------------------------//
{
super (name, buffer);
}
// ---------------------------------------------------------------------------------//
@Override
public String getText ()
// ---------------------------------------------------------------------------------//
{
StringBuilder pgm = new StringBuilder ();
pgm.append ("Name : " + name + "\n");
@ -77,7 +83,9 @@ public class IntegerBasicProgram extends BasicProgram
return pgm.toString ();
}
// ---------------------------------------------------------------------------------//
private void appendAssembler (StringBuilder pgm, int ptr, int lineLength)
// ---------------------------------------------------------------------------------//
{
for (int i = ptr + 3; i < ptr + lineLength - 1; i++)
{
@ -93,7 +101,9 @@ public class IntegerBasicProgram extends BasicProgram
}
}
// ---------------------------------------------------------------------------------//
private boolean checkForAssembler ()
// ---------------------------------------------------------------------------------//
{
int ptr = 0;
@ -117,7 +127,9 @@ public class IntegerBasicProgram extends BasicProgram
return false;
}
// ---------------------------------------------------------------------------------//
private boolean checkForSCAssembler ()
// ---------------------------------------------------------------------------------//
{
if (buffer.length == 0)
{
@ -130,7 +142,9 @@ public class IntegerBasicProgram extends BasicProgram
return buffer[lineLength - 1] == 0;
}
// ---------------------------------------------------------------------------------//
private void appendSCAssembler (StringBuilder text, int ptr)
// ---------------------------------------------------------------------------------//
{
int lineNumber = (buffer[ptr + 2] & 0xFF) * 256 + (buffer[ptr + 1] & 0xFF);
text.append (String.format ("%4d: ", lineNumber));
@ -156,7 +170,9 @@ public class IntegerBasicProgram extends BasicProgram
}
}
// ---------------------------------------------------------------------------------//
private void appendInteger (StringBuilder text, int ptr, int lineLength)
// ---------------------------------------------------------------------------------//
{
int lineNumber = Utility.intValue (buffer[ptr + 1], buffer[ptr + 2]);
@ -208,8 +224,10 @@ public class IntegerBasicProgram extends BasicProgram
}
}
// ---------------------------------------------------------------------------------//
@Override
public String getHexDump ()
// ---------------------------------------------------------------------------------//
{
if (false)
return super.getHexDump ();
@ -247,6 +265,7 @@ public class IntegerBasicProgram extends BasicProgram
return pgm.toString ();
}
/*
* To find integer basic in memory:
* $CA $CB contain the starting address ($9464)

View File

@ -1,6 +1,8 @@
package com.bytezone.diskbrowser.applefile;
// -----------------------------------------------------------------------------------//
public class MerlinSource extends AbstractFile
// -----------------------------------------------------------------------------------//
{
int ptr;
private static int[] tabs = { 12, 19, 35 };
@ -10,7 +12,9 @@ public class MerlinSource extends AbstractFile
private boolean prodosFile;
// Source : Prodos text file
// ---------------------------------------------------------------------------------//
public MerlinSource (String name, byte[] buffer, int recordLength, int eof)
// ---------------------------------------------------------------------------------//
{
super (name, buffer);
this.eof = eof;
@ -19,7 +23,9 @@ public class MerlinSource extends AbstractFile
}
// Source : Dos binary file
// ---------------------------------------------------------------------------------//
public MerlinSource (String name, byte[] buffer, int loadAddress)
// ---------------------------------------------------------------------------------//
{
super (name, buffer);
this.eof = 0;
@ -27,8 +33,10 @@ public class MerlinSource extends AbstractFile
this.loadAddress = loadAddress;
}
// ---------------------------------------------------------------------------------//
@Override
public String getText ()
// ---------------------------------------------------------------------------------//
{
StringBuilder text = new StringBuilder ();
@ -53,7 +61,9 @@ public class MerlinSource extends AbstractFile
return text.toString ();
}
// ---------------------------------------------------------------------------------//
private String getLine ()
// ---------------------------------------------------------------------------------//
{
StringBuilder line = new StringBuilder ();
boolean comment = false;
@ -85,7 +95,9 @@ public class MerlinSource extends AbstractFile
return line.toString ();
}
// ---------------------------------------------------------------------------------//
private StringBuilder tab (StringBuilder text)
// ---------------------------------------------------------------------------------//
{
int nextTab = 0;
for (int tab : tabs)

View File

@ -1,6 +1,8 @@
package com.bytezone.diskbrowser.applefile;
// -----------------------------------------------------------------------------------//
public class Palette
// -----------------------------------------------------------------------------------//
{
/*-
* Michael Pohoreski - The Apple II Forever Anthology
@ -32,24 +34,32 @@ public class Palette
private final String name;
private final int[] colours;
// ---------------------------------------------------------------------------------//
public Palette (String name, int[] colours)
// ---------------------------------------------------------------------------------//
{
this.name = name;
this.colours = colours;
}
// ---------------------------------------------------------------------------------//
public String getName ()
// ---------------------------------------------------------------------------------//
{
return name;
}
// ---------------------------------------------------------------------------------//
public int[] getColours ()
// ---------------------------------------------------------------------------------//
{
return colours;
}
// ---------------------------------------------------------------------------------//
@Override
public String toString ()
// ---------------------------------------------------------------------------------//
{
return String.format ("Palette: %s", name);
}

View File

@ -3,7 +3,9 @@ package com.bytezone.diskbrowser.applefile;
import java.util.ArrayList;
import java.util.List;
// -----------------------------------------------------------------------------------//
public class PaletteFactory
// -----------------------------------------------------------------------------------//
{
private final List<Palette> palettes = new ArrayList<> ();
private int currentPalette;
@ -13,7 +15,9 @@ public class PaletteFactory
FORWARDS, BACKWARDS
}
// ---------------------------------------------------------------------------------//
public PaletteFactory ()
// ---------------------------------------------------------------------------------//
{
palettes.add (//
new Palette ("Virtual II", new int[] { 0x000000, // 0 black
@ -168,7 +172,9 @@ public class PaletteFactory
}));
}
// ---------------------------------------------------------------------------------//
public Palette cyclePalette (CycleDirection direction)
// ---------------------------------------------------------------------------------//
{
switch (direction)
{
@ -187,28 +193,38 @@ public class PaletteFactory
return getCurrentPalette ();
}
// ---------------------------------------------------------------------------------//
public List<Palette> getPalettes ()
// ---------------------------------------------------------------------------------//
{
return palettes;
}
// ---------------------------------------------------------------------------------//
public Palette getCurrentPalette ()
// ---------------------------------------------------------------------------------//
{
return palettes.get (currentPalette);
}
// ---------------------------------------------------------------------------------//
public int getCurrentPaletteIndex ()
// ---------------------------------------------------------------------------------//
{
return currentPalette;
}
// ---------------------------------------------------------------------------------//
public void setCurrentPalette (int index)
// ---------------------------------------------------------------------------------//
{
assert index >= 0 && index < palettes.size ();
currentPalette = index;
}
// ---------------------------------------------------------------------------------//
public void setCurrentPalette (Palette palette)
// ---------------------------------------------------------------------------------//
{
int count = 0;
for (Palette p : palettes)
@ -222,12 +238,16 @@ public class PaletteFactory
}
}
// ---------------------------------------------------------------------------------//
public Palette get (int index)
// ---------------------------------------------------------------------------------//
{
return palettes.get (index);
}
// ---------------------------------------------------------------------------------//
private int rgb (int red, int green, int blue)
// ---------------------------------------------------------------------------------//
{
return red << 16 | green << 8 | blue;
}