allow cpm.sys in directory

This commit is contained in:
Denis Molony 2016-02-28 10:17:34 +11:00
parent 91b63158f1
commit 21e7f8f226
2 changed files with 32 additions and 23 deletions

View File

@ -56,10 +56,10 @@ public class CPMDisk extends AbstractFormattedDisk
for (int i = 0; i < buffer.length; i += 32)
{
if (buffer[i] != 0 && buffer[i] != (byte) 0xE5)
int val = buffer[i] & 0xFF;
if (val == 0xE5)
break;
if (buffer[i] == 0)
{
DirectoryEntry entry = new DirectoryEntry (this, buffer, i);
SectorType sectorType = getSectorType (entry.getType ());
for (DiskAddress block : entry.getSectors ())
@ -78,7 +78,6 @@ public class CPMDisk extends AbstractFormattedDisk
parent.add (entry);
}
}
}
root.setUserObject (getCatalog ()); // override the disk's default display
makeNodeVisible (root.getFirstLeaf ());
@ -175,6 +174,13 @@ public class CPMDisk extends AbstractFormattedDisk
return true;
if (val > 31)
return false;
for (int j = 1; j <= 8; j++)
{
val = buffer[i + j] & 0xFF;
// System.out.printf ("%3d %s%n", val, (char) val);
if (val < 32 || val > 126)
return false;
}
}
}

View File

@ -64,12 +64,15 @@ public class DirectoryEntry implements AppleFileSource
if (b == 0)
break;
int blockNumber = b * 4 + 48;
int blockNumber;
if ((b & 0x80) == 0)
blockNumber = (b * 4 + 48);
else
blockNumber = (b & 0x7F) * 4;
for (int i = 0; i < 4; i++)
{
AppleDiskAddress da = new AppleDiskAddress (blockNumber + i, disk);
blocks.add (da);
}
blocks.add (new AppleDiskAddress (blockNumber + i, disk));
}
}