mirror of
https://github.com/dmolony/DiskBrowser.git
synced 2024-06-13 06:29:31 +00:00
delete issues
This commit is contained in:
parent
adbd1a0292
commit
25948ad218
|
@ -118,8 +118,8 @@ abstract class AbstractCatalogEntry implements AppleFileSource
|
||||||
return "R";
|
return "R";
|
||||||
case AA: // what is this?
|
case AA: // what is this?
|
||||||
return "A";
|
return "A";
|
||||||
case BB: // what is this?
|
case BB: // Lisa file
|
||||||
return "B";
|
return "L";
|
||||||
default:
|
default:
|
||||||
System.out.println ("Unknown file type : " + fileType);
|
System.out.println ("Unknown file type : " + fileType);
|
||||||
return "?";
|
return "?";
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package com.bytezone.diskbrowser.dos;
|
package com.bytezone.diskbrowser.dos;
|
||||||
|
|
||||||
import com.bytezone.diskbrowser.applefile.DefaultAppleFile;
|
import com.bytezone.diskbrowser.applefile.DefaultAppleFile;
|
||||||
|
import com.bytezone.diskbrowser.disk.AppleDiskAddress;
|
||||||
import com.bytezone.diskbrowser.disk.DiskAddress;
|
import com.bytezone.diskbrowser.disk.DiskAddress;
|
||||||
import com.bytezone.diskbrowser.gui.DataSource;
|
import com.bytezone.diskbrowser.gui.DataSource;
|
||||||
|
|
||||||
|
@ -9,17 +10,35 @@ class DeletedCatalogEntry extends AbstractCatalogEntry
|
||||||
boolean allSectorsAvailable = true;
|
boolean allSectorsAvailable = true;
|
||||||
boolean debug = false;
|
boolean debug = false;
|
||||||
|
|
||||||
public DeletedCatalogEntry (DosDisk dosDisk, DiskAddress catalogSector, byte[] entryBuffer)
|
public DeletedCatalogEntry (DosDisk dosDisk, DiskAddress catalogSector,
|
||||||
|
byte[] entryBuffer, int dosVersion)
|
||||||
{
|
{
|
||||||
super (dosDisk, catalogSector, entryBuffer);
|
super (dosDisk, catalogSector, entryBuffer);
|
||||||
// reportedSize = HexFormatter.intValue (entryBuffer[33], entryBuffer[34]);
|
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
System.out.println ("Deleted file : " + name);
|
System.out.println ("Deleted file : " + name);
|
||||||
System.out.printf ("Reported size : %d%n", reportedSize);
|
System.out.printf ("Reported size : %d%n", reportedSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (reportedSize <= 1 || !disk.isValidAddress (entryBuffer[32], entryBuffer[1]))
|
DiskAddress da = null;
|
||||||
|
|
||||||
|
// Get address of first TS-list sector
|
||||||
|
if (dosVersion >= 0x41)
|
||||||
|
{
|
||||||
|
int track = entryBuffer[0] & 0x3F;
|
||||||
|
int sector = entryBuffer[1] & 0x1F;
|
||||||
|
da = disk.getDiskAddress (track, sector);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
int track = entryBuffer[32] & 0xFF;
|
||||||
|
int sector = entryBuffer[1] & 0xFF;
|
||||||
|
da = disk.getDiskAddress (track, sector);
|
||||||
|
}
|
||||||
|
int totalBlocks = 0;
|
||||||
|
|
||||||
|
if (reportedSize <= 1 || !disk.isValidAddress (da.getTrack (), da.getSector ()))
|
||||||
{
|
{
|
||||||
if (debug)
|
if (debug)
|
||||||
System.out.println ("invalid catalog entry");
|
System.out.println ("invalid catalog entry");
|
||||||
|
@ -27,12 +46,8 @@ class DeletedCatalogEntry extends AbstractCatalogEntry
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get address of first TS-list sector
|
|
||||||
DiskAddress da = disk.getDiskAddress (entryBuffer[32], entryBuffer[1]);
|
|
||||||
int totalBlocks = 0;
|
|
||||||
|
|
||||||
// Loop through all TS-list sectors
|
// Loop through all TS-list sectors
|
||||||
loop: while (da.getBlock () > 0)
|
loop: while (da.getBlock () > 0 || ((AppleDiskAddress) da).zeroFlag ())
|
||||||
{
|
{
|
||||||
if (!dosDisk.stillAvailable (da))
|
if (!dosDisk.stillAvailable (da))
|
||||||
{
|
{
|
||||||
|
@ -51,7 +66,7 @@ class DeletedCatalogEntry extends AbstractCatalogEntry
|
||||||
if (da.getBlock () > 0 && debug)
|
if (da.getBlock () > 0 && debug)
|
||||||
System.out.println (da);
|
System.out.println (da);
|
||||||
|
|
||||||
if (da.getBlock () > 0)
|
if (da.getBlock () > 0 || ((AppleDiskAddress) da).zeroFlag ())
|
||||||
{
|
{
|
||||||
if (!dosDisk.stillAvailable (da))
|
if (!dosDisk.stillAvailable (da))
|
||||||
{
|
{
|
||||||
|
@ -68,7 +83,7 @@ class DeletedCatalogEntry extends AbstractCatalogEntry
|
||||||
if (da == null)
|
if (da == null)
|
||||||
{
|
{
|
||||||
System.out.printf ("Next T/S list in sector %s is invalid : %02X, %02X%n", da,
|
System.out.printf ("Next T/S list in sector %s is invalid : %02X, %02X%n", da,
|
||||||
sectorBuffer[1], sectorBuffer[2]);
|
sectorBuffer[1], sectorBuffer[2]);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -99,7 +114,7 @@ class DeletedCatalogEntry extends AbstractCatalogEntry
|
||||||
|
|
||||||
public String getDetails ()
|
public String getDetails ()
|
||||||
{
|
{
|
||||||
return String.format ("%-30s %s", name, allSectorsAvailable ? "Recoverable"
|
return String.format ("%-30s %s", name,
|
||||||
: "Not recoverable");
|
allSectorsAvailable ? "Recoverable" : "Not recoverable");
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -10,7 +10,7 @@ class DosCatalogSector extends AbstractSector
|
||||||
{
|
{
|
||||||
private static final String[] fileTypes =
|
private static final String[] fileTypes =
|
||||||
{ "Text file", "Integer Basic program", "Applesoft Basic program", "Binary file",
|
{ "Text file", "Integer Basic program", "Applesoft Basic program", "Binary file",
|
||||||
"SS file", "Relocatable file", "AA file", "BB file" };
|
"SS file", "Relocatable file", "AA file", "Lisa file" };
|
||||||
private static int CATALOG_ENTRY_SIZE = 35;
|
private static int CATALOG_ENTRY_SIZE = 35;
|
||||||
|
|
||||||
private final DosDisk dosDisk;
|
private final DosDisk dosDisk;
|
||||||
|
|
|
@ -55,6 +55,7 @@ public class DosDisk extends AbstractFormattedDisk
|
||||||
da = disk.getDiskAddress (CATALOG_TRACK, VTOC_SECTOR);
|
da = disk.getDiskAddress (CATALOG_TRACK, VTOC_SECTOR);
|
||||||
sectorBuffer = disk.readSector (da); // VTOC
|
sectorBuffer = disk.readSector (da); // VTOC
|
||||||
dosVTOCSector = new DosVTOCSector (this, disk, sectorBuffer, da);
|
dosVTOCSector = new DosVTOCSector (this, disk, sectorBuffer, da);
|
||||||
|
sectorTypes[da.getBlock ()] = vtocSector;
|
||||||
|
|
||||||
DiskAddress catalogStart = disk.getDiskAddress (sectorBuffer[1], sectorBuffer[2]);
|
DiskAddress catalogStart = disk.getDiskAddress (sectorBuffer[1], sectorBuffer[2]);
|
||||||
|
|
||||||
|
@ -63,7 +64,7 @@ public class DosDisk extends AbstractFormattedDisk
|
||||||
if (dosVTOCSector.maxSectors != disk.getSectorsPerTrack ())
|
if (dosVTOCSector.maxSectors != disk.getSectorsPerTrack ())
|
||||||
System.out.println ("Invalid sectors per track : " + dosVTOCSector.maxSectors);
|
System.out.println ("Invalid sectors per track : " + dosVTOCSector.maxSectors);
|
||||||
|
|
||||||
sectorTypes[CATALOG_TRACK * dosVTOCSector.maxSectors] = vtocSector;
|
// sectorTypes[CATALOG_TRACK * dosVTOCSector.maxSectors] = vtocSector;
|
||||||
|
|
||||||
// assert (maxTracks == disk.getTotalTracks ());
|
// assert (maxTracks == disk.getTotalTracks ());
|
||||||
// assert (dosVTOCSector.maxSectors == disk.getSectorsPerTrack ());
|
// assert (dosVTOCSector.maxSectors == disk.getSectorsPerTrack ());
|
||||||
|
@ -91,12 +92,12 @@ public class DosDisk extends AbstractFormattedDisk
|
||||||
|
|
||||||
// The first byte is officially unused, but it always seems to contain 0x00 or 0xFF
|
// The first byte is officially unused, but it always seems to contain 0x00 or 0xFF
|
||||||
// See beautifulboot.dsk.
|
// See beautifulboot.dsk.
|
||||||
if (sectorBuffer[0] != 0 && (sectorBuffer[0] & 0xFF) != 0xFF && false)
|
// if (sectorBuffer[0] != 0 && (sectorBuffer[0] & 0xFF) != 0xFF && false)
|
||||||
{
|
// {
|
||||||
System.out
|
// System.out
|
||||||
.println ("Dos catalog sector buffer byte #0 invalid : " + sectorBuffer[0]);
|
// .println ("Dos catalog sector buffer byte #0 invalid : " + sectorBuffer[0]);
|
||||||
break;
|
// break;
|
||||||
}
|
// }
|
||||||
|
|
||||||
sectorTypes[da.getBlock ()] = catalogSector;
|
sectorTypes[da.getBlock ()] = catalogSector;
|
||||||
|
|
||||||
|
@ -130,11 +131,14 @@ public class DosDisk extends AbstractFormattedDisk
|
||||||
|
|
||||||
byte[] entry = new byte[ENTRY_SIZE];
|
byte[] entry = new byte[ENTRY_SIZE];
|
||||||
System.arraycopy (sectorBuffer, ptr, entry, 0, ENTRY_SIZE);
|
System.arraycopy (sectorBuffer, ptr, entry, 0, ENTRY_SIZE);
|
||||||
|
int track = entry[0] & 0xFF;
|
||||||
|
boolean deletedFlag = (entry[0] & 0x80) != 0;
|
||||||
|
|
||||||
if (entry[0] == (byte) 0xFF) // deleted file
|
// if (entry[0] == (byte) 0xFF) // deleted file
|
||||||
|
if (deletedFlag) // deleted file
|
||||||
{
|
{
|
||||||
DeletedCatalogEntry deletedCatalogEntry =
|
DeletedCatalogEntry deletedCatalogEntry =
|
||||||
new DeletedCatalogEntry (this, da, entry);
|
new DeletedCatalogEntry (this, da, entry, dosVTOCSector.dosVersion);
|
||||||
deletedFileEntries.add (deletedCatalogEntry);
|
deletedFileEntries.add (deletedCatalogEntry);
|
||||||
DefaultMutableTreeNode node = new DefaultMutableTreeNode (deletedCatalogEntry);
|
DefaultMutableTreeNode node = new DefaultMutableTreeNode (deletedCatalogEntry);
|
||||||
node.setAllowsChildren (false);
|
node.setAllowsChildren (false);
|
||||||
|
@ -164,6 +168,7 @@ public class DosDisk extends AbstractFormattedDisk
|
||||||
da = disk.getDiskAddress (sectorBuffer[1], sectorBuffer[2]);
|
da = disk.getDiskAddress (sectorBuffer[1], sectorBuffer[2]);
|
||||||
|
|
||||||
} while (da.getBlock () != 0);
|
} while (da.getBlock () != 0);
|
||||||
|
|
||||||
// link double hi-res files
|
// link double hi-res files
|
||||||
for (AppleFileSource fe : fileEntries)
|
for (AppleFileSource fe : fileEntries)
|
||||||
{
|
{
|
||||||
|
|
|
@ -53,7 +53,9 @@ class DosVTOCSector extends AbstractSector
|
||||||
addText (text, buffer, 5, 1, "Ram DOS " + (char) (buffer[5] & 0x7F));
|
addText (text, buffer, 5, 1, "Ram DOS " + (char) (buffer[5] & 0x7F));
|
||||||
|
|
||||||
addTextAndDecimal (text, buffer, 6, 1, "Diskette volume");
|
addTextAndDecimal (text, buffer, 6, 1, "Diskette volume");
|
||||||
addText (text, buffer, 7, 1, "Volume type " + (char) (buffer[7] & 0x7F));
|
String diskType =
|
||||||
|
buffer[7] == (byte) 0xC4 ? " = Data" : buffer[7] == (byte) 0xC2 ? " = Boot" : "";
|
||||||
|
addText (text, buffer, 7, 1, "Volume type: " + (char) (buffer[7] & 0x7F) + diskType);
|
||||||
|
|
||||||
int ptr = 8;
|
int ptr = 8;
|
||||||
addText (text, buffer, ptr, 4, "Volume name: " + getName (buffer, ptr));
|
addText (text, buffer, ptr, 4, "Volume name: " + getName (buffer, ptr));
|
||||||
|
|
Loading…
Reference in New Issue
Block a user