mirror of
https://github.com/dmolony/DiskBrowser.git
synced 2024-12-01 09:50:32 +00:00
fixed isValidCatalogSector() check
This commit is contained in:
parent
0a01db617f
commit
e1811f8fbe
@ -148,7 +148,9 @@ class CatalogEntry extends AbstractCatalogEntry
|
||||
|
||||
if (!da.getDisk ().isValidAddress (buffer[1], buffer[2]))
|
||||
return false;
|
||||
if (buffer[4] != 0)
|
||||
if (buffer[3] != 0 || buffer[4] != 0) // not supposed to be used
|
||||
// Diags2E.dsk stores its own sector address here
|
||||
if (da.getTrack () != (buffer[3] & 0xFF) && da.getSector () != (buffer[4] & 0xFF))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
|
@ -269,49 +269,34 @@ public class DosDisk extends AbstractFormattedDisk
|
||||
public static boolean isCorrectFormat (AppleDisk disk)
|
||||
// ---------------------------------------------------------------------------------//
|
||||
{
|
||||
if (debug)
|
||||
System.out.println ("Checking interleave 0");
|
||||
disk.setInterleave (0);
|
||||
|
||||
int catalogBlocks0 = checkFormat (disk);
|
||||
if (catalogBlocks0 > 3)
|
||||
if (false)
|
||||
{
|
||||
disk.setInterleave (2);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (disk.getSectorsPerTrack () > 16)
|
||||
return false;
|
||||
|
||||
if (debug)
|
||||
System.out.println ("Checking interleave 1");
|
||||
disk.setInterleave (1);
|
||||
|
||||
int catalogBlocks1 = checkFormat (disk);
|
||||
if (catalogBlocks1 > 3)
|
||||
return true;
|
||||
|
||||
if (debug)
|
||||
System.out.println ("Checking interleave 2");
|
||||
disk.setInterleave (2);
|
||||
|
||||
int catalogBlocks2 = checkFormat (disk);
|
||||
if (catalogBlocks2 > 3)
|
||||
return true;
|
||||
|
||||
if (catalogBlocks0 > 0)
|
||||
int[] cb = new int[3];
|
||||
for (int interleave = 0; interleave < 3; interleave++)
|
||||
{
|
||||
disk.setInterleave (0);
|
||||
if (debug)
|
||||
System.out.printf ("Checking interleave %d%n", interleave);
|
||||
disk.setInterleave (interleave);
|
||||
cb[interleave] = checkFormat (disk);
|
||||
if (cb[interleave] > 3)
|
||||
return true;
|
||||
}
|
||||
|
||||
if (catalogBlocks1 > 0)
|
||||
for (int max = 2; max > 0; max--)
|
||||
for (int interleave = 0; interleave < 3; interleave++)
|
||||
{
|
||||
disk.setInterleave (1);
|
||||
if (cb[interleave] >= max)
|
||||
{
|
||||
disk.setInterleave (interleave);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (catalogBlocks2 > 0)
|
||||
{
|
||||
disk.setInterleave (2);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
Loading…
Reference in New Issue
Block a user