method header lines

This commit is contained in:
Denis Molony 2020-02-07 21:44:51 +10:00
parent 135c946047
commit 467f5db110
7 changed files with 704 additions and 633 deletions

View File

@ -101,6 +101,9 @@ public abstract class HiResImage extends AbstractFile
// 4 System Addons.hdv
//
// see also - https://docs.google.com/spreadsheets/d
// /1rKR6A_bVniSCtIP_rrv8QLWJdj4h6jEU1jJj0AebWwg/edit#gid=0
static PaletteFactory paletteFactory = new PaletteFactory ();
static final byte[] pngHeader =

View File

@ -5,7 +5,9 @@ import java.util.List;
import com.bytezone.diskbrowser.utilities.HexFormatter;
// -----------------------------------------------------------------------------------//
public class SimpleText2 extends AbstractFile
// -----------------------------------------------------------------------------------//
{
List<Integer> lineStarts = new ArrayList<> ();
int loadAddress;
@ -26,8 +28,10 @@ public class SimpleText2 extends AbstractFile
}
}
// ---------------------------------------------------------------------------------//
@Override
public String getText ()
// ---------------------------------------------------------------------------------//
{
StringBuilder text = new StringBuilder ();
@ -42,8 +46,10 @@ public class SimpleText2 extends AbstractFile
return text.toString ();
}
// ---------------------------------------------------------------------------------//
@Override
public String getHexDump ()
// ---------------------------------------------------------------------------------//
{
StringBuilder text = new StringBuilder ();
@ -56,7 +62,9 @@ public class SimpleText2 extends AbstractFile
}
// convert buffer to text, ignore line-break at the end
// ---------------------------------------------------------------------------------//
private String getLine (int ptr)
// ---------------------------------------------------------------------------------//
{
StringBuilder line = new StringBuilder ();
int length = buffer[ptr] & 0xFF;

View File

@ -2,15 +2,21 @@ package com.bytezone.diskbrowser.applefile;
import com.bytezone.diskbrowser.utilities.HexFormatter;
// -----------------------------------------------------------------------------------//
public class StoredVariables extends AbstractFile
// -----------------------------------------------------------------------------------//
{
// ---------------------------------------------------------------------------------//
public StoredVariables (String name, byte[] buffer)
// ---------------------------------------------------------------------------------//
{
super (name, buffer);
}
// ---------------------------------------------------------------------------------//
@Override
public String getText ()
// ---------------------------------------------------------------------------------//
{
StringBuilder text = new StringBuilder ();
String strValue = null;
@ -69,7 +75,9 @@ public class StoredVariables extends AbstractFile
return text.toString ();
}
// ---------------------------------------------------------------------------------//
private String getVariableName (byte b1, byte b2)
// ---------------------------------------------------------------------------------//
{
char c1, c2, suffix;
@ -102,7 +110,9 @@ public class StoredVariables extends AbstractFile
return variableName.toString ();
}
// ---------------------------------------------------------------------------------//
private String getDimensionText (int[] values)
// ---------------------------------------------------------------------------------//
{
StringBuilder text = new StringBuilder ("(");
for (int i = 0; i < values.length; i++)
@ -114,7 +124,9 @@ public class StoredVariables extends AbstractFile
return text.append (')').toString ();
}
// ---------------------------------------------------------------------------------//
private void listArrays (StringBuilder text, int ptr, int totalLength, int strPtr)
// ---------------------------------------------------------------------------------//
{
while (ptr < totalLength + 5)
{
@ -181,7 +193,9 @@ public class StoredVariables extends AbstractFile
}
}
// ---------------------------------------------------------------------------------//
private boolean hasValue (int p)
// ---------------------------------------------------------------------------------//
{
for (int i = 0; i < 5; i++)
if (buffer[p + i] != 0)
@ -189,8 +203,10 @@ public class StoredVariables extends AbstractFile
return false;
}
// ---------------------------------------------------------------------------------//
@Override
public String getHexDump ()
// ---------------------------------------------------------------------------------//
{
StringBuffer text = new StringBuffer ();

View File

@ -3,13 +3,17 @@ package com.bytezone.diskbrowser.applefile;
import com.bytezone.diskbrowser.utilities.HexFormatter;
// only used by Prodos text files - note the fixed block size of 512 - bad!
// -----------------------------------------------------------------------------------//
public class TextBuffer
// -----------------------------------------------------------------------------------//
{
public final byte[] buffer;
public final int reclen;
public final int firstRecNo;
// ---------------------------------------------------------------------------------//
public TextBuffer (byte[] tempBuffer, int reclen, int firstBlock)
// ---------------------------------------------------------------------------------//
{
this.reclen = reclen;
@ -34,8 +38,10 @@ public class TextBuffer
System.arraycopy (tempBuffer, offset, buffer, 0, copyBytes);
}
// ---------------------------------------------------------------------------------//
@Override
public String toString ()
// ---------------------------------------------------------------------------------//
{
StringBuilder text = new StringBuilder ();

View File

@ -4,19 +4,25 @@ import java.util.List;
import com.bytezone.diskbrowser.utilities.HexFormatter;
// -----------------------------------------------------------------------------------//
public class TextFile extends AbstractFile
// -----------------------------------------------------------------------------------//
{
private int recordLength; // prodos aux
private List<TextBuffer> buffers; // only used if it is a Prodos text file
private int eof;
private boolean prodosFile;
// ---------------------------------------------------------------------------------//
public TextFile (String name, byte[] buffer)
// ---------------------------------------------------------------------------------//
{
super (name, buffer);
}
// ---------------------------------------------------------------------------------//
public TextFile (String name, byte[] buffer, int auxType, int eof)
// ---------------------------------------------------------------------------------//
{
this (name, buffer);
this.eof = eof;
@ -24,7 +30,9 @@ public class TextFile extends AbstractFile
prodosFile = true;
}
// ---------------------------------------------------------------------------------//
public TextFile (String name, List<TextBuffer> buffers, int auxType, int eof)
// ---------------------------------------------------------------------------------//
{
super (name, null);
this.buffers = buffers;
@ -33,8 +41,10 @@ public class TextFile extends AbstractFile
prodosFile = true;
}
// ---------------------------------------------------------------------------------//
@Override
public String getHexDump ()
// ---------------------------------------------------------------------------------//
{
if (buffers == null)
return (super.getHexDump ());
@ -51,8 +61,10 @@ public class TextFile extends AbstractFile
return text.toString ();
}
// ---------------------------------------------------------------------------------//
@Override
public String getText ()
// ---------------------------------------------------------------------------------//
{
StringBuilder text = new StringBuilder ();
@ -80,7 +92,9 @@ public class TextFile extends AbstractFile
return knownLength (text, 0).toString ();
}
// ---------------------------------------------------------------------------------//
private String treeFileText (StringBuilder text)
// ---------------------------------------------------------------------------------//
{
text.append (" Offset Record# Text values\n");
text.append (
@ -93,7 +107,9 @@ public class TextFile extends AbstractFile
return text.toString ();
}
// ---------------------------------------------------------------------------------//
private StringBuilder knownLength (StringBuilder text, int recNo)
// ---------------------------------------------------------------------------------//
{
for (int ptr = 0; ptr < buffer.length; ptr += recordLength)
{
@ -121,7 +137,9 @@ public class TextFile extends AbstractFile
return text;
}
// ---------------------------------------------------------------------------------//
private String unknownLength (StringBuilder text)
// ---------------------------------------------------------------------------------//
{
int nulls = 0;
int ptr = 0;
@ -182,7 +200,9 @@ public class TextFile extends AbstractFile
return text.toString ();
}
// ---------------------------------------------------------------------------------//
private int gcd (int a, int b)
// ---------------------------------------------------------------------------------//
{
return a == 0 ? b : gcd (b % a, a);
}

View File

@ -2,18 +2,24 @@ package com.bytezone.diskbrowser.applefile;
import com.bytezone.diskbrowser.visicalc.Sheet;
// -----------------------------------------------------------------------------------//
public class VisicalcFile extends AbstractFile
// -----------------------------------------------------------------------------------//
{
private static boolean debug;
private Sheet sheet;
// ---------------------------------------------------------------------------------//
public VisicalcFile (String name, byte[] buffer)
// ---------------------------------------------------------------------------------//
{
super (name, buffer);
}
// ---------------------------------------------------------------------------------//
@Override
public String getText ()
// ---------------------------------------------------------------------------------//
{
if (sheet == null)
sheet = new Sheet (buffer);
@ -26,17 +32,23 @@ public class VisicalcFile extends AbstractFile
return text.toString ();
}
// ---------------------------------------------------------------------------------//
public static void setDefaultDebug (boolean value)
// ---------------------------------------------------------------------------------//
{
debug = value;
}
// ---------------------------------------------------------------------------------//
public static void setDebug (boolean value)
// ---------------------------------------------------------------------------------//
{
debug = value;
}
// ---------------------------------------------------------------------------------//
public static boolean isVisicalcFile (byte[] buffer)
// ---------------------------------------------------------------------------------//
{
int firstByte = buffer[0] & 0xFF;
if (firstByte != 0xBE && firstByte != 0xAF)

View File

@ -1,14 +1,18 @@
package com.bytezone.diskbrowser.applefile;
// -----------------------------------------------------------------------------------//
public class WizardryTitle extends AbstractFile
// -----------------------------------------------------------------------------------//
{
public WizardryTitle (String name, byte[] buffer)
{
super (name, buffer);
}
// ---------------------------------------------------------------------------------//
@Override
public String getText ()
// ---------------------------------------------------------------------------------//
{
int size = 20;
StringBuilder text = new StringBuilder ();
@ -37,7 +41,9 @@ public class WizardryTitle extends AbstractFile
// return text;
// }
// ---------------------------------------------------------------------------------//
private StringBuilder decode2 (int value, StringBuilder text)
// ---------------------------------------------------------------------------------//
{
for (int bit = 7; bit >= 0; bit--)
{