mirror of
https://github.com/dmolony/DiskBrowser.git
synced 2024-06-27 08:29:31 +00:00
show empty blocks
This commit is contained in:
parent
60de0f2f4c
commit
54f037b2aa
|
@ -35,9 +35,6 @@ public class CPMDisk extends AbstractFormattedDisk
|
||||||
getDisk ().setEmptyByte ((byte) 0xE5);
|
getDisk ().setEmptyByte ((byte) 0xE5);
|
||||||
setSectorTypes ();
|
setSectorTypes ();
|
||||||
|
|
||||||
// byte[] sectorBuffer = disk.readSector (0, 0); // Boot sector
|
|
||||||
// bootSector = new BootSector (disk, sectorBuffer, "CPM");
|
|
||||||
|
|
||||||
byte[] buffer = disk.readSector (0, 8);
|
byte[] buffer = disk.readSector (0, 8);
|
||||||
String text = new String (buffer, 16, 24);
|
String text = new String (buffer, 16, 24);
|
||||||
if ("DIR ERA TYPESAVEREN USER".equals (text))
|
if ("DIR ERA TYPESAVEREN USER".equals (text))
|
||||||
|
@ -48,9 +45,12 @@ public class CPMDisk extends AbstractFormattedDisk
|
||||||
for (int sector = 0; sector < 8; sector++)
|
for (int sector = 0; sector < 8; sector++)
|
||||||
{
|
{
|
||||||
DiskAddress da = disk.getDiskAddress (3, sector);
|
DiskAddress da = disk.getDiskAddress (3, sector);
|
||||||
sectorTypes[da.getBlock ()] = catalogSector;
|
if (disk.isSectorEmpty (da))
|
||||||
|
break;
|
||||||
|
|
||||||
|
sectorTypes[da.getBlock ()] = catalogSector;
|
||||||
buffer = disk.readSector (da);
|
buffer = disk.readSector (da);
|
||||||
|
|
||||||
for (int i = 0; i < buffer.length; i += 32)
|
for (int i = 0; i < buffer.length; i += 32)
|
||||||
{
|
{
|
||||||
if (buffer[i] != 0 && buffer[i] != (byte) 0xE5)
|
if (buffer[i] != 0 && buffer[i] != (byte) 0xE5)
|
||||||
|
@ -60,6 +60,7 @@ public class CPMDisk extends AbstractFormattedDisk
|
||||||
DirectoryEntry entry = new DirectoryEntry (this, buffer, i);
|
DirectoryEntry entry = new DirectoryEntry (this, buffer, i);
|
||||||
SectorType sectorType = getSectorType (entry.getType ());
|
SectorType sectorType = getSectorType (entry.getType ());
|
||||||
for (DiskAddress block : entry.getSectors ())
|
for (DiskAddress block : entry.getSectors ())
|
||||||
|
if (!disk.isSectorEmpty (block))
|
||||||
sectorTypes[block.getBlock ()] = sectorType;
|
sectorTypes[block.getBlock ()] = sectorType;
|
||||||
|
|
||||||
DirectoryEntry parent = findParent (entry);
|
DirectoryEntry parent = findParent (entry);
|
||||||
|
@ -76,7 +77,7 @@ public class CPMDisk extends AbstractFormattedDisk
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
root.setUserObject (getCatalog ());
|
root.setUserObject (getCatalog ()); // override the disk's default display
|
||||||
makeNodeVisible (root.getFirstLeaf ());
|
makeNodeVisible (root.getFirstLeaf ());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -50,7 +50,10 @@ public class DirectoryEntry implements AppleFileSource
|
||||||
|
|
||||||
int blockNumber = b * 4 + 48;
|
int blockNumber = b * 4 + 48;
|
||||||
for (int i = 0; i < 4; i++)
|
for (int i = 0; i < 4; i++)
|
||||||
blocks.add (new AppleDiskAddress (blockNumber + i, disk));
|
{
|
||||||
|
AppleDiskAddress da = new AppleDiskAddress (blockNumber + i, disk);
|
||||||
|
blocks.add (da);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -158,6 +158,7 @@ public abstract class AbstractFormattedDisk implements FormattedDisk
|
||||||
(DefaultMutableTreeNode) catalogTree.getModel ().getRoot ();
|
(DefaultMutableTreeNode) catalogTree.getModel ().getRoot ();
|
||||||
DefaultAppleFileSource afs =
|
DefaultAppleFileSource afs =
|
||||||
new DefaultAppleFileSource (getName (), disk.toString (), this);
|
new DefaultAppleFileSource (getName (), disk.toString (), this);
|
||||||
|
if (root.getUserObject () == null)
|
||||||
root.setUserObject (afs);
|
root.setUserObject (afs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user