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 // 4 System Addons.hdv
// //
// see also - https://docs.google.com/spreadsheets/d
// /1rKR6A_bVniSCtIP_rrv8QLWJdj4h6jEU1jJj0AebWwg/edit#gid=0
static PaletteFactory paletteFactory = new PaletteFactory (); static PaletteFactory paletteFactory = new PaletteFactory ();
static final byte[] pngHeader = static final byte[] pngHeader =

View File

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

View File

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

View File

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

View File

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

View File

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