Compare commits
5 Commits
64d5ce9ee2
...
3bf972a761
Author | SHA1 | Date |
---|---|---|
Denis Molony | 3bf972a761 | |
Denis Molony | fd5bee6e5c | |
Denis Molony | 0af6714119 | |
Denis Molony | 22dfaf65c6 | |
Denis Molony | f4a6465b04 |
|
@ -243,7 +243,7 @@ public class SHRPictureFile1 extends HiResImage
|
||||||
colorTables[i] = new ColorTable (i, data, ptr);
|
colorTables[i] = new ColorTable (i, data, ptr);
|
||||||
else
|
else
|
||||||
colorTables[i] = new ColorTable (i, 0x00); // default empty table !! not
|
colorTables[i] = new ColorTable (i, 0x00); // default empty table !! not
|
||||||
// finished
|
// finished
|
||||||
ptr += 32;
|
ptr += 32;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -202,7 +202,7 @@ public class SubLine implements ApplesoftConstants
|
||||||
private void checkFunction (String var, byte terminator)
|
private void checkFunction (String var, byte terminator)
|
||||||
// ---------------------------------------------------------------------------------//
|
// ---------------------------------------------------------------------------------//
|
||||||
{
|
{
|
||||||
assert terminator == ASCII_LEFT_BRACKET;
|
// assert terminator == ASCII_LEFT_BRACKET;
|
||||||
|
|
||||||
if (!functions.contains (var))
|
if (!functions.contains (var))
|
||||||
functions.add (var);
|
functions.add (var);
|
||||||
|
|
|
@ -206,8 +206,7 @@ public abstract class AbstractFormattedDisk implements FormattedDisk
|
||||||
|
|
||||||
DefaultMutableTreeNode root = getCatalogTreeRoot ();
|
DefaultMutableTreeNode root = getCatalogTreeRoot ();
|
||||||
if (root.getUserObject () == null)
|
if (root.getUserObject () == null)
|
||||||
root.setUserObject (
|
root.setUserObject (new DefaultAppleFileSource (getName (), disk.toString (), this));
|
||||||
new DefaultAppleFileSource (getName (), disk.toString (), this));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------------//
|
// ---------------------------------------------------------------------------------//
|
||||||
|
@ -234,15 +233,15 @@ public abstract class AbstractFormattedDisk implements FormattedDisk
|
||||||
public String getDisplayPath ()
|
public String getDisplayPath ()
|
||||||
// ---------------------------------------------------------------------------------//
|
// ---------------------------------------------------------------------------------//
|
||||||
{
|
{
|
||||||
// if (originalPath != null)
|
|
||||||
// return originalPath.toString ();
|
|
||||||
|
|
||||||
String home = System.getProperty ("user.home");
|
String home = System.getProperty ("user.home");
|
||||||
|
|
||||||
String path = originalPath != null ? originalPath.toString ()
|
String path =
|
||||||
: disk.getFile ().getAbsolutePath ();
|
originalPath != null ? originalPath.toString () : disk.getFile ().getAbsolutePath ();
|
||||||
if (path.startsWith (home))
|
|
||||||
return "~" + path.substring (home.length ());
|
int pos = path.indexOf (home);
|
||||||
|
|
||||||
|
if (pos == 0 || (path.startsWith ("/Volumes/") && pos > 0))
|
||||||
|
return "~" + path.substring (home.length () + pos);
|
||||||
|
|
||||||
return disk.getFile ().getAbsolutePath ();
|
return disk.getFile ().getAbsolutePath ();
|
||||||
}
|
}
|
||||||
|
@ -327,8 +326,7 @@ public abstract class AbstractFormattedDisk implements FormattedDisk
|
||||||
if (children != null)
|
if (children != null)
|
||||||
while (children.hasMoreElements ())
|
while (children.hasMoreElements ())
|
||||||
{
|
{
|
||||||
DefaultMutableTreeNode childNode =
|
DefaultMutableTreeNode childNode = (DefaultMutableTreeNode) children.nextElement ();
|
||||||
(DefaultMutableTreeNode) children.nextElement ();
|
|
||||||
if (childNode.getUserObject ().toString ().indexOf (name) > 0)
|
if (childNode.getUserObject ().toString ().indexOf (name) > 0)
|
||||||
return childNode;
|
return childNode;
|
||||||
}
|
}
|
||||||
|
|
|
@ -733,12 +733,8 @@ public class AppleDisk implements Disk
|
||||||
{
|
{
|
||||||
StringBuilder text = new StringBuilder ();
|
StringBuilder text = new StringBuilder ();
|
||||||
|
|
||||||
String path = file.getAbsolutePath ();
|
text.append (
|
||||||
String home = System.getProperty ("user.home");
|
String.format ("Path ......... %s%n", Utility.getShortPath (file.getAbsolutePath ())));
|
||||||
if (path.startsWith (home))
|
|
||||||
path = "~" + path.substring (home.length ());
|
|
||||||
|
|
||||||
text.append (String.format ("Path ......... %s%n", path));
|
|
||||||
text.append (String.format ("File name .... %s%n", file.getName ()));
|
text.append (String.format ("File name .... %s%n", file.getName ()));
|
||||||
text.append (String.format ("File size .... %,d%n", file.length ()));
|
text.append (String.format ("File size .... %,d%n", file.length ()));
|
||||||
text.append (String.format ("Tracks ....... %d%n", tracks));
|
text.append (String.format ("Tracks ....... %d%n", tracks));
|
||||||
|
|
|
@ -17,7 +17,8 @@ public class Binary2
|
||||||
// -----------------------------------------------------------------------------------//
|
// -----------------------------------------------------------------------------------//
|
||||||
{
|
{
|
||||||
private static final String UNDERLINE =
|
private static final String UNDERLINE =
|
||||||
"------------------------------------------------------" + "-----------------------";
|
"------------------------------------------------------"
|
||||||
|
+ "-----------------------";
|
||||||
|
|
||||||
private Binary2Header binary2Header;
|
private Binary2Header binary2Header;
|
||||||
private byte[] buffer;
|
private byte[] buffer;
|
||||||
|
@ -54,8 +55,8 @@ public class Binary2
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------------//
|
// ---------------------------------------------------------------------------------//
|
||||||
public byte[] getDiskBuffer ()
|
public byte[] getDiskBuffer () throws DiskFullException, VolumeCatalogFullException,
|
||||||
throws DiskFullException, VolumeCatalogFullException, FileAlreadyExistsException, IOException
|
FileAlreadyExistsException, IOException
|
||||||
// ---------------------------------------------------------------------------------//
|
// ---------------------------------------------------------------------------------//
|
||||||
{
|
{
|
||||||
ProdosDisk disk = new ProdosDisk (800, "DiskBrowser");
|
ProdosDisk disk = new ProdosDisk (800, "DiskBrowser");
|
||||||
|
@ -72,8 +73,8 @@ public class Binary2
|
||||||
Squeeze squeeze = new Squeeze ();
|
Squeeze squeeze = new Squeeze ();
|
||||||
byte[] tmp = squeeze.unSqueeze (dataBuffer);
|
byte[] tmp = squeeze.unSqueeze (dataBuffer);
|
||||||
|
|
||||||
disk.addFile (name, header.fileType, header.auxType, header.created, header.modified, tmp,
|
disk.addFile (name, header.fileType, header.auxType, header.created,
|
||||||
tmp.length);
|
header.modified, tmp, tmp.length);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
disk.addFile (header.fileName, header.fileType, header.auxType, header.created,
|
disk.addFile (header.fileName, header.fileType, header.auxType, header.created,
|
||||||
|
@ -91,12 +92,12 @@ public class Binary2
|
||||||
{
|
{
|
||||||
StringBuilder text = new StringBuilder ();
|
StringBuilder text = new StringBuilder ();
|
||||||
|
|
||||||
text.append (
|
text.append (String.format (
|
||||||
String.format (" %-15.15s Files:%5d%n%n",
|
" %-15.15s Files:%5d%n%n",
|
||||||
fileName, headers.size ()));
|
fileName, headers.size ()));
|
||||||
|
|
||||||
text.append (
|
text.append (" Name Type Auxtyp Modified"
|
||||||
" Name Type Auxtyp Modified" + " Fmat Length\n");
|
+ " Fmat Length\n");
|
||||||
|
|
||||||
text.append (String.format ("%s%n", UNDERLINE));
|
text.append (String.format ("%s%n", UNDERLINE));
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,8 @@ public class NuFX
|
||||||
// -----------------------------------------------------------------------------------//
|
// -----------------------------------------------------------------------------------//
|
||||||
{
|
{
|
||||||
private static final String UNDERLINE =
|
private static final String UNDERLINE =
|
||||||
"------------------------------------------------------" + "-----------------------";
|
"------------------------------------------------------"
|
||||||
|
+ "-----------------------";
|
||||||
private MasterHeader masterHeader;
|
private MasterHeader masterHeader;
|
||||||
private final byte[] buffer;
|
private final byte[] buffer;
|
||||||
private final boolean debug = false;
|
private final boolean debug = false;
|
||||||
|
@ -39,6 +40,7 @@ public class NuFX
|
||||||
{
|
{
|
||||||
buffer = Files.readAllBytes (path);
|
buffer = Files.readAllBytes (path);
|
||||||
volumeName = new VolumeName (path.getFileName ().toString ());
|
volumeName = new VolumeName (path.getFileName ().toString ());
|
||||||
|
|
||||||
read (buffer);
|
read (buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -94,6 +96,7 @@ public class NuFX
|
||||||
if (record.hasDisk ())
|
if (record.hasDisk ())
|
||||||
++totalDisks;
|
++totalDisks;
|
||||||
}
|
}
|
||||||
|
System.out.println (toString ());
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------------//
|
// ---------------------------------------------------------------------------------//
|
||||||
|
@ -181,14 +184,14 @@ public class NuFX
|
||||||
}
|
}
|
||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
System.out.printf ("%3d %-35s %02X %,7d %,7d %,7d %s %s%n", ++count, fileName,
|
System.out.printf ("%3d %-35s %02X %,7d %,7d %,7d %s %s%n", ++count,
|
||||||
fileType, auxType, eof, buffer.length, created, modified);
|
fileName, fileType, auxType, eof, buffer.length, created, modified);
|
||||||
|
|
||||||
FileEntry fileEntry;
|
FileEntry fileEntry;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
fileEntry =
|
fileEntry = disk.addFile (fileName, fileType, auxType, created, modified,
|
||||||
disk.addFile (fileName, fileType, auxType, created, modified, buffer, eof);
|
buffer, eof);
|
||||||
}
|
}
|
||||||
catch (FileAlreadyExistsException e)
|
catch (FileAlreadyExistsException e)
|
||||||
{
|
{
|
||||||
|
@ -266,8 +269,8 @@ public class NuFX
|
||||||
volumeName.volumeName, masterHeader.getCreated2 (), masterHeader.getModified2 (),
|
volumeName.volumeName, masterHeader.getCreated2 (), masterHeader.getModified2 (),
|
||||||
masterHeader.getTotalRecords ()));
|
masterHeader.getTotalRecords ()));
|
||||||
|
|
||||||
text.append (
|
text.append (" Name Type Auxtyp Archived"
|
||||||
" Name Type Auxtyp Archived" + " Fmat Size Un-Length\n");
|
+ " Fmat Size Un-Length\n");
|
||||||
|
|
||||||
text.append (String.format ("%s%n", UNDERLINE));
|
text.append (String.format ("%s%n", UNDERLINE));
|
||||||
|
|
||||||
|
|
|
@ -15,13 +15,12 @@ class Record
|
||||||
// -----------------------------------------------------------------------------------//
|
// -----------------------------------------------------------------------------------//
|
||||||
{
|
{
|
||||||
private static final byte[] NuFX = { 0x4E, (byte) 0xF5, 0x46, (byte) 0xD8 };
|
private static final byte[] NuFX = { 0x4E, (byte) 0xF5, 0x46, (byte) 0xD8 };
|
||||||
private static String[] fileSystems =
|
private static String[] fileSystems = { "", "ProDOS/SOS", "DOS 3.3", "DOS 3.2",
|
||||||
{ "", "ProDOS/SOS", "DOS 3.3", "DOS 3.2", "Apple II Pascal", "Macintosh HFS",
|
"Apple II Pascal", "Macintosh HFS", "Macintosh MFS", "Lisa File System",
|
||||||
"Macintosh MFS", "Lisa File System", "Apple CP/M", "", "MS-DOS", "High Sierra",
|
"Apple CP/M", "", "MS-DOS", "High Sierra", "ISO 9660", "AppleShare" };
|
||||||
"ISO 9660", "AppleShare" };
|
|
||||||
|
|
||||||
private static String[] storage = { "", "Seedling", "Sapling", "Tree", "", "Extended",
|
private static String[] storage = { "", "Seedling", "Sapling", "Tree", "", "Extended",
|
||||||
"", "", "", "", "", "", "", "Subdirectory" };
|
"", "", "", "", "", "", "", "Subdirectory" };
|
||||||
|
|
||||||
private static String[] accessChars = { "D", "R", "B", "", "", "I", "W", "R" };
|
private static String[] accessChars = { "D", "R", "B", "", "", "I", "W", "R" };
|
||||||
private static String threadFormats[] = { "unc", "sq ", "lz1", "lz2", "", "" };
|
private static String threadFormats[] = { "unc", "sq ", "lz1", "lz2", "", "" };
|
||||||
|
@ -254,6 +253,13 @@ class Record
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------------//
|
||||||
|
String getThreadFormatText ()
|
||||||
|
// ---------------------------------------------------------------------------------//
|
||||||
|
{
|
||||||
|
return threadFormats[getThreadFormat ()];
|
||||||
|
}
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------------//
|
// ---------------------------------------------------------------------------------//
|
||||||
int getUncompressedSize ()
|
int getUncompressedSize ()
|
||||||
// ---------------------------------------------------------------------------------//
|
// ---------------------------------------------------------------------------------//
|
||||||
|
@ -283,6 +289,17 @@ class Record
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------------//
|
||||||
|
public float getCompressedPct ()
|
||||||
|
// ---------------------------------------------------------------------------------//
|
||||||
|
{
|
||||||
|
float pct = 100;
|
||||||
|
if (getUncompressedSize () > 0)
|
||||||
|
pct = getCompressedSize () * 100 / getUncompressedSize ();
|
||||||
|
|
||||||
|
return pct;
|
||||||
|
}
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------------//
|
// ---------------------------------------------------------------------------------//
|
||||||
byte[] getData ()
|
byte[] getData ()
|
||||||
// ---------------------------------------------------------------------------------//
|
// ---------------------------------------------------------------------------------//
|
||||||
|
@ -313,9 +330,9 @@ class Record
|
||||||
if (name.length () > 27)
|
if (name.length () > 27)
|
||||||
name = ".." + name.substring (name.length () - 25);
|
name = ".." + name.substring (name.length () - 25);
|
||||||
|
|
||||||
float pct = 100;
|
// float pct = 100;
|
||||||
if (getUncompressedSize () > 0)
|
// if (getUncompressedSize () > 0)
|
||||||
pct = getCompressedSize () * 100 / getUncompressedSize ();
|
// pct = getCompressedSize () * 100 / getUncompressedSize ();
|
||||||
|
|
||||||
String lockedFlag = (access | 0xC3) == 1 ? "+" : " ";
|
String lockedFlag = (access | 0xC3) == 1 ? "+" : " ";
|
||||||
String forkedFlag = hasResource () ? "+" : " ";
|
String forkedFlag = hasResource () ? "+" : " ";
|
||||||
|
@ -323,11 +340,11 @@ class Record
|
||||||
if (hasDisk ())
|
if (hasDisk ())
|
||||||
return String.format ("%s%-27.27s %-4s %-6s %-15s %s %3.0f%% %7d", lockedFlag,
|
return String.format ("%s%-27.27s %-4s %-6s %-15s %s %3.0f%% %7d", lockedFlag,
|
||||||
name, "Disk", (getUncompressedSize () / 1024) + "k", archived.format2 (),
|
name, "Disk", (getUncompressedSize () / 1024) + "k", archived.format2 (),
|
||||||
threadFormats[getThreadFormat ()], pct, getUncompressedSize ());
|
getThreadFormatText (), getCompressedPct (), getUncompressedSize ());
|
||||||
|
|
||||||
return String.format ("%s%-27.27s %s%s $%04X %-15s %s %3.0f%% %7d", lockedFlag,
|
return String.format ("%s%-27.27s %s%s $%04X %-15s %s %3.0f%% %7d", lockedFlag,
|
||||||
name, fileTypes[fileType], forkedFlag, auxType, archived.format2 (),
|
name, fileTypes[fileType], forkedFlag, auxType, archived.format2 (),
|
||||||
threadFormats[getThreadFormat ()], pct, getUncompressedSize ());
|
getThreadFormatText (), getCompressedPct (), getUncompressedSize ());
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------------//
|
// ---------------------------------------------------------------------------------//
|
||||||
|
|
|
@ -29,7 +29,8 @@ public class PascalDisk extends AbstractFormattedDisk
|
||||||
// -----------------------------------------------------------------------------------//
|
// -----------------------------------------------------------------------------------//
|
||||||
{
|
{
|
||||||
static final int CATALOG_ENTRY_SIZE = 26;
|
static final int CATALOG_ENTRY_SIZE = 26;
|
||||||
private final DateTimeFormatter dtf = DateTimeFormatter.ofLocalizedDate (FormatStyle.SHORT);
|
private final DateTimeFormatter dtf =
|
||||||
|
DateTimeFormatter.ofLocalizedDate (FormatStyle.SHORT);
|
||||||
private final VolumeEntry volumeEntry;
|
private final VolumeEntry volumeEntry;
|
||||||
private final PascalCatalogSector diskCatalogSector;
|
private final PascalCatalogSector diskCatalogSector;
|
||||||
|
|
||||||
|
@ -48,8 +49,8 @@ public class PascalDisk extends AbstractFormattedDisk
|
||||||
SectorType fotoSector = new SectorType ("Foto", Color.gray);
|
SectorType fotoSector = new SectorType ("Foto", Color.gray);
|
||||||
SectorType badSector = new SectorType ("Bad", Color.darkGray);
|
SectorType badSector = new SectorType ("Bad", Color.darkGray);
|
||||||
|
|
||||||
SectorType[] sectors = { catalogSector, badSector, codeSector, textSector, infoSector, dataSector,
|
SectorType[] sectors = { catalogSector, badSector, codeSector, textSector, infoSector,
|
||||||
grafSector, fotoSector };
|
dataSector, grafSector, fotoSector };
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------------//
|
// ---------------------------------------------------------------------------------//
|
||||||
public PascalDisk (Disk disk)
|
public PascalDisk (Disk disk)
|
||||||
|
@ -100,7 +101,8 @@ public class PascalDisk extends AbstractFormattedDisk
|
||||||
freeBlocks.set (i, false);
|
freeBlocks.set (i, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
diskCatalogSector = new PascalCatalogSector (disk, disk.readBlocks (sectors), sectors);
|
diskCatalogSector =
|
||||||
|
new PascalCatalogSector (disk, disk.readBlocks (sectors), sectors);
|
||||||
|
|
||||||
// read the catalog
|
// read the catalog
|
||||||
List<DiskAddress> addresses = new ArrayList<> ();
|
List<DiskAddress> addresses = new ArrayList<> ();
|
||||||
|
@ -297,16 +299,18 @@ public class PascalDisk extends AbstractFormattedDisk
|
||||||
{
|
{
|
||||||
String newLine = String.format ("%n");
|
String newLine = String.format ("%n");
|
||||||
String newLine2 = newLine + newLine;
|
String newLine2 = newLine + newLine;
|
||||||
String line =
|
String line = "---- --------------- ---- -------- ------- ---- ---- ----"
|
||||||
"---- --------------- ---- -------- ------- ---- ---- ----" + newLine;
|
+ newLine;
|
||||||
|
|
||||||
String date = volumeEntry.localDate == null ? "--" : volumeEntry.localDate.format (dtf);
|
String date =
|
||||||
|
volumeEntry.localDate == null ? "--" : volumeEntry.localDate.format (dtf);
|
||||||
|
|
||||||
StringBuilder text = new StringBuilder ();
|
StringBuilder text = new StringBuilder ();
|
||||||
text.append ("File : " + getDisplayPath () + newLine2);
|
text.append ("File : " + getDisplayPath () + newLine2);
|
||||||
text.append ("Volume : " + volumeEntry.name + newLine);
|
text.append ("Volume : " + volumeEntry.name + newLine);
|
||||||
text.append ("Date : " + date + newLine2);
|
text.append ("Date : " + date + newLine2);
|
||||||
text.append ("Blks Name Type Date Length Frst Last Blks\n");
|
text.append (
|
||||||
|
"Blks Name Type Date Length Frst Last Blks\n");
|
||||||
text.append (line);
|
text.append (line);
|
||||||
|
|
||||||
int usedBlocks = 6;
|
int usedBlocks = 6;
|
||||||
|
@ -319,15 +323,16 @@ public class PascalDisk extends AbstractFormattedDisk
|
||||||
date = ce.localDate == null ? "--" : ce.localDate.format (dtf);
|
date = ce.localDate == null ? "--" : ce.localDate.format (dtf);
|
||||||
|
|
||||||
int bytes = (size - 1) * 512 + ce.bytesUsedInLastBlock;
|
int bytes = (size - 1) * 512 + ce.bytesUsedInLastBlock;
|
||||||
String fileType =
|
String fileType = ce.fileType < 0 || ce.fileType >= fileTypes.length ? "????"
|
||||||
ce.fileType < 0 || ce.fileType >= fileTypes.length ? "????" : fileTypes[ce.fileType];
|
: fileTypes[ce.fileType];
|
||||||
text.append (String.format ("%4d %-15s %-6s %8s %,8d $%03X $%03X $%03X%n", size,
|
text.append (String.format ("%4d %-15s %-6s %8s %,8d $%03X $%03X $%03X%n",
|
||||||
ce.name, fileType, date, bytes, ce.firstBlock, ce.lastBlock, size));
|
size, ce.name, fileType, date, bytes, ce.firstBlock, ce.lastBlock, size));
|
||||||
}
|
}
|
||||||
|
|
||||||
text.append (line);
|
text.append (line);
|
||||||
text.append (String.format ("Blocks free : %3d Blocks used : %3d Total blocks : %3d%n",
|
text.append (
|
||||||
(volumeEntry.totalBlocks - usedBlocks), usedBlocks, volumeEntry.totalBlocks));
|
String.format ("Blocks free : %3d Blocks used : %3d Total blocks : %3d%n",
|
||||||
|
(volumeEntry.totalBlocks - usedBlocks), usedBlocks, volumeEntry.totalBlocks));
|
||||||
|
|
||||||
return new DefaultAppleFileSource (volumeEntry.name, text.toString (), this);
|
return new DefaultAppleFileSource (volumeEntry.name, text.toString (), this);
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,8 +15,8 @@ import com.bytezone.diskbrowser.utilities.Utility;
|
||||||
abstract class CatalogEntry implements AppleFileSource
|
abstract class CatalogEntry implements AppleFileSource
|
||||||
// -----------------------------------------------------------------------------------//
|
// -----------------------------------------------------------------------------------//
|
||||||
{
|
{
|
||||||
static String[] storageTypes =
|
static String[] storageTypes = { "Del", "Sdl", "Sap", "Tre", "Pas", "Ext", "", "", "",
|
||||||
{ "Del", "Sdl", "Sap", "Tre", "Pas", "Ext", "", "", "", "", "", "", "", "DIR", "SDH", "VDH" };
|
"", "", "", "", "DIR", "SDH", "VDH" };
|
||||||
Disk disk;
|
Disk disk;
|
||||||
ProdosDisk parentDisk;
|
ProdosDisk parentDisk;
|
||||||
|
|
||||||
|
|
|
@ -72,8 +72,8 @@ class FileEntry extends CatalogEntry implements ProdosConstants
|
||||||
private FileEntry link;
|
private FileEntry link;
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------------//
|
// ---------------------------------------------------------------------------------//
|
||||||
FileEntry (ProdosDisk fDisk, byte[] entryBuffer, DirectoryHeader parent, int parentBlock,
|
FileEntry (ProdosDisk fDisk, byte[] entryBuffer, DirectoryHeader parent,
|
||||||
int entryNo)
|
int parentBlock, int entryNo)
|
||||||
// ---------------------------------------------------------------------------------//
|
// ---------------------------------------------------------------------------------//
|
||||||
{
|
{
|
||||||
super (fDisk, entryBuffer, parentBlock, entryNo);
|
super (fDisk, entryBuffer, parentBlock, entryNo);
|
||||||
|
@ -101,7 +101,6 @@ class FileEntry extends CatalogEntry implements ProdosConstants
|
||||||
|
|
||||||
case GSOS_EXTENDED_FILE:
|
case GSOS_EXTENDED_FILE:
|
||||||
readForks ();
|
readForks ();
|
||||||
// System.out.printf ("%s has forks%n", getUniqueName ());
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SUBDIRECTORY:
|
case SUBDIRECTORY:
|
||||||
|
@ -351,7 +350,8 @@ class FileEntry extends CatalogEntry implements ProdosConstants
|
||||||
file = new DoubleHiResImage (name, outBuffer);
|
file = new DoubleHiResImage (name, outBuffer);
|
||||||
break;
|
break;
|
||||||
case 0x8000:
|
case 0x8000:
|
||||||
file = new SHRPictureFile2 (name, outBuffer, FILE_TYPE_PIC, 0x2000, 0x8000);
|
file =
|
||||||
|
new SHRPictureFile2 (name, outBuffer, FILE_TYPE_PIC, 0x2000, 0x8000);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
file = new AssemblerProgram (name, exactBuffer, auxType);
|
file = new AssemblerProgram (name, exactBuffer, auxType);
|
||||||
|
@ -371,8 +371,8 @@ class FileEntry extends CatalogEntry implements ProdosConstants
|
||||||
}
|
}
|
||||||
// else if (name.endsWith (".PIC")) // 0091 X-BASIC../../XBASIC.PIC
|
// else if (name.endsWith (".PIC")) // 0091 X-BASIC../../XBASIC.PIC
|
||||||
// file = new SHRPictureFile2 (name, exactBuffer, fileType, auxType, endOfFile);
|
// file = new SHRPictureFile2 (name, exactBuffer, fileType, auxType, endOfFile);
|
||||||
else if ((name.equals ("DOS.3.3") || name.equals ("DDOS.3.3")) && endOfFile == 0x2800
|
else if ((name.equals ("DOS.3.3") || name.equals ("DDOS.3.3"))
|
||||||
&& DosMasterFile.isDos33 (parentDisk, exactBuffer))
|
&& endOfFile == 0x2800 && DosMasterFile.isDos33 (parentDisk, exactBuffer))
|
||||||
{
|
{
|
||||||
file = new DosMasterFile (name, exactBuffer);
|
file = new DosMasterFile (name, exactBuffer);
|
||||||
}
|
}
|
||||||
|
@ -415,8 +415,8 @@ class FileEntry extends CatalogEntry implements ProdosConstants
|
||||||
|
|
||||||
case FILE_TYPE_DIRECTORY:
|
case FILE_TYPE_DIRECTORY:
|
||||||
VolumeDirectoryHeader vdh = parentDisk.getVolumeDirectoryHeader ();
|
VolumeDirectoryHeader vdh = parentDisk.getVolumeDirectoryHeader ();
|
||||||
file = new ProdosDirectory (parentDisk, name, buffer, vdh.totalBlocks, vdh.freeBlocks,
|
file = new ProdosDirectory (parentDisk, name, buffer, vdh.totalBlocks,
|
||||||
vdh.usedBlocks);
|
vdh.freeBlocks, vdh.usedBlocks);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case FILE_TYPE_APPLESOFT_BASIC_VARS:
|
case FILE_TYPE_APPLESOFT_BASIC_VARS:
|
||||||
|
@ -627,7 +627,8 @@ class FileEntry extends CatalogEntry implements ProdosConstants
|
||||||
if (addresses.size () > 0)
|
if (addresses.size () > 0)
|
||||||
{
|
{
|
||||||
byte[] tempBuffer = disk.readBlocks (addresses);
|
byte[] tempBuffer = disk.readBlocks (addresses);
|
||||||
buffers.add (new TextBuffer (tempBuffer, auxType, logicalBlock - addresses.size ()));
|
buffers.add (
|
||||||
|
new TextBuffer (tempBuffer, auxType, logicalBlock - addresses.size ()));
|
||||||
addresses.clear ();
|
addresses.clear ();
|
||||||
}
|
}
|
||||||
logicalBlock += 256;
|
logicalBlock += 256;
|
||||||
|
@ -727,8 +728,8 @@ class FileEntry extends CatalogEntry implements ProdosConstants
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------------//
|
// ---------------------------------------------------------------------------------//
|
||||||
private int readIndexBlock (int indexBlock, List<DiskAddress> addresses, List<TextBuffer> buffers,
|
private int readIndexBlock (int indexBlock, List<DiskAddress> addresses,
|
||||||
int logicalBlock)
|
List<TextBuffer> buffers, int logicalBlock)
|
||||||
// ---------------------------------------------------------------------------------//
|
// ---------------------------------------------------------------------------------//
|
||||||
{
|
{
|
||||||
byte[] indexBuffer = disk.readBlock (indexBlock);
|
byte[] indexBuffer = disk.readBlock (indexBlock);
|
||||||
|
@ -740,7 +741,8 @@ class FileEntry extends CatalogEntry implements ProdosConstants
|
||||||
else if (addresses.size () > 0)
|
else if (addresses.size () > 0)
|
||||||
{
|
{
|
||||||
byte[] tempBuffer = disk.readBlocks (addresses);
|
byte[] tempBuffer = disk.readBlocks (addresses);
|
||||||
buffers.add (new TextBuffer (tempBuffer, auxType, logicalBlock - addresses.size ()));
|
buffers
|
||||||
|
.add (new TextBuffer (tempBuffer, auxType, logicalBlock - addresses.size ()));
|
||||||
addresses.clear ();
|
addresses.clear ();
|
||||||
}
|
}
|
||||||
logicalBlock++;
|
logicalBlock++;
|
||||||
|
@ -811,13 +813,14 @@ class FileEntry extends CatalogEntry implements ProdosConstants
|
||||||
String locked = (access == 0x00) ? "*" : " ";
|
String locked = (access == 0x00) ? "*" : " ";
|
||||||
|
|
||||||
if (true)
|
if (true)
|
||||||
return String.format ("%s %03d %s", ProdosConstants.fileTypes[fileType], blocksUsed, locked)
|
return String.format ("%s %03d %s", ProdosConstants.fileTypes[fileType],
|
||||||
+ name;
|
blocksUsed, locked) + name;
|
||||||
|
|
||||||
String timeC = created == null ? "" : created.format (ProdosDisk.df);
|
String timeC = created == null ? "" : created.format (ProdosDisk.df);
|
||||||
String timeF = modified == null ? "" : modified.format (ProdosDisk.df);
|
String timeF = modified == null ? "" : modified.format (ProdosDisk.df);
|
||||||
|
|
||||||
return String.format ("%s %s%-30s %3d %,10d %15s %15s", ProdosConstants.fileTypes[fileType],
|
return String.format ("%s %s%-30s %3d %,10d %15s %15s",
|
||||||
locked, parentDirectory.name + "/" + name, blocksUsed, endOfFile, timeC, timeF);
|
ProdosConstants.fileTypes[fileType], locked, parentDirectory.name + "/" + name,
|
||||||
|
blocksUsed, endOfFile, timeC, timeF);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -40,8 +40,8 @@ public final class Utility
|
||||||
private static MathContext mathContext4 = new MathContext (6);
|
private static MathContext mathContext4 = new MathContext (6);
|
||||||
private static MathContext mathContext8 = new MathContext (15);
|
private static MathContext mathContext8 = new MathContext (15);
|
||||||
|
|
||||||
private static final List<String> suffixes = Arrays.asList ("po", "dsk", "do", "hdv", "2mg",
|
private static final List<String> suffixes = Arrays.asList ("po", "dsk", "do", "hdv",
|
||||||
"d13", "sdk", "shk", "bxy", "bny", "bqy", "woz", "img", "dimg");
|
"2mg", "d13", "sdk", "shk", "bxy", "bny", "bqy", "woz", "img", "dimg");
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------------//
|
// ---------------------------------------------------------------------------------//
|
||||||
private Utility ()
|
private Utility ()
|
||||||
|
@ -255,7 +255,8 @@ public final class Utility
|
||||||
}
|
}
|
||||||
catch (DateTimeException e)
|
catch (DateTimeException e)
|
||||||
{
|
{
|
||||||
System.out.printf ("Bad date/time: %d %d %d %d %d %n", year, month, day, hour, minute);
|
System.out.printf ("Bad date/time: %d %d %d %d %d %n", year, month, day, hour,
|
||||||
|
minute);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -315,7 +316,8 @@ public final class Utility
|
||||||
public static int readTriple (byte[] buffer, int ptr)
|
public static int readTriple (byte[] buffer, int ptr)
|
||||||
// ---------------------------------------------------------------------------------//
|
// ---------------------------------------------------------------------------------//
|
||||||
{
|
{
|
||||||
return (buffer[ptr] & 0xFF) | (buffer[ptr + 1] & 0xFF) << 8 | (buffer[ptr + 2] & 0xFF) << 16;
|
return (buffer[ptr] & 0xFF) | (buffer[ptr + 1] & 0xFF) << 8
|
||||||
|
| (buffer[ptr + 2] & 0xFF) << 16;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------------//
|
// ---------------------------------------------------------------------------------//
|
||||||
|
@ -384,8 +386,8 @@ public final class Utility
|
||||||
if (exponent == 0)
|
if (exponent == 0)
|
||||||
return 0.0;
|
return 0.0;
|
||||||
|
|
||||||
int mantissa =
|
int mantissa = (buffer[ptr + 2] & 0x7F) << 16 | (buffer[ptr + 1] & 0xFF) << 8
|
||||||
(buffer[ptr + 2] & 0x7F) << 16 | (buffer[ptr + 1] & 0xFF) << 8 | (buffer[ptr] & 0xFF);
|
| (buffer[ptr] & 0xFF);
|
||||||
boolean negative = (buffer[ptr + 2] & 0x80) != 0;
|
boolean negative = (buffer[ptr + 2] & 0x80) != 0;
|
||||||
double value = 0.5;
|
double value = 0.5;
|
||||||
|
|
||||||
|
@ -408,9 +410,10 @@ public final class Utility
|
||||||
if (exponent == 0)
|
if (exponent == 0)
|
||||||
return 0.0;
|
return 0.0;
|
||||||
|
|
||||||
long mantissa = (long) (buffer[ptr + 6] & 0x7F) << 48 | (long) (buffer[ptr + 5] & 0xFF) << 40
|
long mantissa = (long) (buffer[ptr + 6] & 0x7F) << 48
|
||||||
| (long) (buffer[ptr + 4] & 0xFF) << 32 | (long) (buffer[ptr + 3] & 0xFF) << 24
|
| (long) (buffer[ptr + 5] & 0xFF) << 40 | (long) (buffer[ptr + 4] & 0xFF) << 32
|
||||||
| (buffer[ptr + 2] & 0xFF) << 16 | (buffer[ptr + 1] & 0xFF) << 8 | (buffer[ptr] & 0xFF);
|
| (long) (buffer[ptr + 3] & 0xFF) << 24 | (buffer[ptr + 2] & 0xFF) << 16
|
||||||
|
| (buffer[ptr + 1] & 0xFF) << 8 | (buffer[ptr] & 0xFF);
|
||||||
boolean negative = (buffer[ptr + 6] & 0x80) != 0;
|
boolean negative = (buffer[ptr + 6] & 0x80) != 0;
|
||||||
double value = 0.5;
|
double value = 0.5;
|
||||||
|
|
||||||
|
@ -519,10 +522,11 @@ public final class Utility
|
||||||
{
|
{
|
||||||
int[] val = new int[6];
|
int[] val = new int[6];
|
||||||
for (int i = 0; i < 6; i++)
|
for (int i = 0; i < 6; i++)
|
||||||
// val[i] = Integer.parseInt (String.format ("%02X", buffer[ptr + i] & 0xFF));
|
// val[i] = Integer.parseInt (String.format ("%02X", buffer[ptr + i] & 0xFF));
|
||||||
val[i] = buffer[ptr + i] & 0xFF;
|
val[i] = buffer[ptr + i] & 0xFF;
|
||||||
|
|
||||||
LocalDateTime date = LocalDateTime.of (val[3] + 2000, val[5], val[4], val[2], val[1], val[0]);
|
LocalDateTime date =
|
||||||
|
LocalDateTime.of (val[3] + 2000, val[5], val[4], val[2], val[1], val[0]);
|
||||||
return date;
|
return date;
|
||||||
}
|
}
|
||||||
catch (DateTimeException e)
|
catch (DateTimeException e)
|
||||||
|
@ -565,6 +569,23 @@ public final class Utility
|
||||||
return suffixes.contains (getSuffix (filename));
|
return suffixes.contains (getSuffix (filename));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------------//
|
||||||
|
public static String getShortPath (String path)
|
||||||
|
// ---------------------------------------------------------------------------------//
|
||||||
|
{
|
||||||
|
String home = System.getProperty ("user.home");
|
||||||
|
if (path.startsWith (home))
|
||||||
|
path = "~" + path.substring (home.length ());
|
||||||
|
else if (path.startsWith ("/Volumes/"))
|
||||||
|
{
|
||||||
|
int pos = path.indexOf (home);
|
||||||
|
if (pos > 0)
|
||||||
|
path = "~" + path.substring (home.length () + pos);
|
||||||
|
}
|
||||||
|
|
||||||
|
return path;
|
||||||
|
}
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------------//
|
// ---------------------------------------------------------------------------------//
|
||||||
public static void reverse (byte[] buffer)
|
public static void reverse (byte[] buffer)
|
||||||
// ---------------------------------------------------------------------------------//
|
// ---------------------------------------------------------------------------------//
|
||||||
|
@ -613,7 +634,8 @@ public final class Utility
|
||||||
public static boolean isPossibleVariable (byte value)
|
public static boolean isPossibleVariable (byte value)
|
||||||
// ---------------------------------------------------------------------------------//
|
// ---------------------------------------------------------------------------------//
|
||||||
{
|
{
|
||||||
return isDigit (value) || isLetter (value) || value == ASCII_DOLLAR || value == ASCII_PERCENT;
|
return isDigit (value) || isLetter (value) || value == ASCII_DOLLAR
|
||||||
|
|| value == ASCII_PERCENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------------//
|
// ---------------------------------------------------------------------------------//
|
||||||
|
|
Loading…
Reference in New Issue