This commit is contained in:
Denis Molony 2018-08-18 17:56:54 +10:00
parent c6f8b0d552
commit f7d831880c

View File

@ -27,8 +27,10 @@ class FileEntry extends CatalogEntry implements ProdosConstants
// private final int headerPointer; // private final int headerPointer;
private DataSource file; private DataSource file;
private final DiskAddress catalogBlock; private final DiskAddress catalogBlock;
private DiskAddress masterIndexBlock; private DiskAddress masterIndexBlock;
private final List<DiskAddress> indexBlocks = new ArrayList<DiskAddress> (); private final List<DiskAddress> indexBlocks = new ArrayList<DiskAddress> ();
private boolean invalid; private boolean invalid;
private FileEntry link; private FileEntry link;
@ -53,15 +55,8 @@ class FileEntry extends CatalogEntry implements ProdosConstants
switch (storageType) switch (storageType)
{ {
case SEEDLING: case SEEDLING:
addDataBlocks (storageType, keyPtr);
break;
case SAPLING: case SAPLING:
addDataBlocks (storageType, keyPtr);
break;
case TREE: case TREE:
masterIndexBlock = disk.getDiskAddress (keyPtr);
addDataBlocks (storageType, keyPtr); addDataBlocks (storageType, keyPtr);
break; break;
@ -171,15 +166,16 @@ class FileEntry extends CatalogEntry implements ProdosConstants
return blocks; return blocks;
} }
private List<Integer> readMasterIndex (int blockPtr) private List<Integer> readMasterIndex (int keyPtr)
{ {
parentDisk.setSectorType (blockPtr, parentDisk.masterIndexSector); masterIndexBlock = disk.getDiskAddress (keyPtr);
indexBlocks.add (disk.getDiskAddress (blockPtr)); parentDisk.setSectorType (keyPtr, parentDisk.masterIndexSector);
indexBlocks.add (disk.getDiskAddress (keyPtr));
byte[] buffer = disk.readSector (blockPtr); // master index byte[] buffer = disk.readSector (keyPtr); // master index
int highest = 0x80; int highest = 0x80;
while (highest-- > 0) // decrement after test while (highest-- > 0) // decrement after test
if (buffer[highest] != 0 || buffer[highest + 0x100] != 0) if (buffer[highest] != 0 || buffer[highest + 0x100] != 0)
break; break;
@ -232,8 +228,6 @@ class FileEntry extends CatalogEntry implements ProdosConstants
case FILE_TYPE_SYS: case FILE_TYPE_SYS:
case FILE_TYPE_BAT: case FILE_TYPE_BAT:
case FILE_TYPE_USER_DEFINED_1: case FILE_TYPE_USER_DEFINED_1:
// if (name.endsWith (".S"))
// file = new MerlinSource (name, exactBuffer, auxType, endOfFile);
if (SimpleText.isHTML (exactBuffer)) if (SimpleText.isHTML (exactBuffer))
file = new SimpleText (name, exactBuffer); file = new SimpleText (name, exactBuffer);
else if (HiResImage.isGif (exactBuffer) || HiResImage.isPng (exactBuffer)) else if (HiResImage.isGif (exactBuffer) || HiResImage.isPng (exactBuffer))
@ -432,8 +426,6 @@ class FileEntry extends CatalogEntry implements ProdosConstants
// Text files with aux (reclen) > 0 are random access, possibly with // Text files with aux (reclen) > 0 are random access, possibly with
// non-contiguous records, so they need to be handled differently // non-contiguous records, so they need to be handled differently
// Graphics files can also have gaps
switch (storageType) switch (storageType)
{ {
case TREE: case TREE: