mirror of
https://github.com/dmolony/DiskBrowser.git
synced 2025-01-14 07:30:01 +00:00
minor dos 4.1 changes
This commit is contained in:
parent
13a45cd9bf
commit
e8d9af5fa4
@ -62,6 +62,8 @@ public class FinderData extends AbstractFile
|
||||
text.append (String.format ("%02X%n", buffer[ptr++]));
|
||||
}
|
||||
}
|
||||
else
|
||||
text.append (String.format ("Unknown finder data version: %d%n", version));
|
||||
|
||||
if (text.length () > 0)
|
||||
text.deleteCharAt (text.length () - 1);
|
||||
|
@ -33,6 +33,7 @@ public class AppleDisk implements Disk
|
||||
private final int tracks; // usually 35 for floppy disks
|
||||
private int sectors; // 8 or 16 (or 32 for unidos)
|
||||
private int blocks; // 280 or 560 for floppy disks, higher for HD
|
||||
private int dosVersion;
|
||||
|
||||
private final int trackSize; // 4096
|
||||
public int sectorSize; // 256 or 512
|
||||
@ -337,6 +338,14 @@ public class AppleDisk implements Disk
|
||||
return false;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------//
|
||||
public void setDosVersion (int version)
|
||||
// ---------------------------------------------------------------------------------//
|
||||
{
|
||||
this.dosVersion = version;
|
||||
// System.out.printf ("DOS version %02X%n", version);
|
||||
}
|
||||
|
||||
/*
|
||||
* Routines that implement the Disk interface
|
||||
*/
|
||||
@ -564,8 +573,13 @@ public class AppleDisk implements Disk
|
||||
public boolean isValidAddress (int track, int sector)
|
||||
// ---------------------------------------------------------------------------------//
|
||||
{
|
||||
track &= 0x3F;
|
||||
sector &= 0x1F;
|
||||
if (dosVersion >= 0x41)
|
||||
{
|
||||
track &= 0x3F;
|
||||
sector &= 0x1F;
|
||||
}
|
||||
// else
|
||||
// System.out.println ("normal dos");
|
||||
|
||||
if (track < 0 || track >= this.tracks)
|
||||
return false;
|
||||
|
@ -35,7 +35,7 @@ public class AppleDiskAddress implements DiskAddress
|
||||
// ---------------------------------------------------------------------------------//
|
||||
{
|
||||
this.owner = owner;
|
||||
zeroFlag = (track & 0x40) != 0;
|
||||
zeroFlag = (track & 0x40) == 0x40;
|
||||
this.track = track & 0x3F;
|
||||
this.sector = sector & 0x1F;
|
||||
this.block = this.track * owner.getBlocksPerTrack () + this.sector;
|
||||
|
@ -545,7 +545,10 @@ public class DiskFactory
|
||||
{
|
||||
if (debug)
|
||||
System.out.println (" --> DOS");
|
||||
return new DosDisk (disk);
|
||||
DosDisk dosDisk = new DosDisk (disk);
|
||||
// disk.setDosVersion (dosDisk.getVersion ());
|
||||
|
||||
return dosDisk;
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
|
@ -58,8 +58,6 @@ abstract class AbstractCatalogEntry implements AppleFileSource
|
||||
|
||||
name = getName ("", entryBuffer);
|
||||
reportedSize = Utility.unsignedShort (entryBuffer, 33);
|
||||
// if (reportedSize == 0)
|
||||
// System.out.printf ("%s size 0%n", name);
|
||||
|
||||
int type = entryBuffer[2] & 0x7F;
|
||||
locked = (entryBuffer[2] & 0x80) != 0;
|
||||
|
@ -172,15 +172,18 @@ class CatalogEntry extends AbstractCatalogEntry
|
||||
message = lastModified.toString ().replace ('T', ' ');
|
||||
|
||||
if (reportedSize != actualSize)
|
||||
message += "Bad size (" + reportedSize + ") ";
|
||||
if (dataSectors.size () == 0)
|
||||
message += "No data ";
|
||||
message += "Actual size (" + actualSize + ") ";
|
||||
// if (dataSectors.size () == 0)
|
||||
// message += "No data ";
|
||||
if (reportedSize > 999)
|
||||
message += "Reported " + reportedSize;
|
||||
|
||||
String text = String.format ("%1s %1s %03d %-30.30s %-5s %-13s %3d %3d %s",
|
||||
lockedFlag, getFileType (), actualSize, displayName, addressText, lengthText,
|
||||
tsSectors.size (), (dataSectors.size () - textFileGaps), message.trim ());
|
||||
if (actualSize == 0)
|
||||
text = text.substring (0, 50);
|
||||
String text =
|
||||
String.format ("%1s %1s %03d %-30.30s %-5s %-13s %3d %3d %s", lockedFlag,
|
||||
getFileType (), reportedSize % 1000, displayName, addressText, lengthText,
|
||||
tsSectors.size (), (dataSectors.size () - textFileGaps), message.trim ());
|
||||
// if (actualSize == 0)
|
||||
// text = text.substring (0, 50);
|
||||
|
||||
return text;
|
||||
}
|
||||
|
@ -61,6 +61,7 @@ class DeletedCatalogEntry extends AbstractCatalogEntry
|
||||
tsSectors.add (da);
|
||||
totalBlocks++;
|
||||
|
||||
DiskAddress sectorDA = da;
|
||||
byte[] sectorBuffer = disk.readBlock (da);
|
||||
for (int i = 12, max = disk.getBlockSize (); i < max; i += 2)
|
||||
{
|
||||
@ -82,15 +83,17 @@ class DeletedCatalogEntry extends AbstractCatalogEntry
|
||||
}
|
||||
}
|
||||
|
||||
da = getValidAddress (sectorBuffer, 1);
|
||||
DiskAddress nextDa = getValidAddress (sectorBuffer, 1);
|
||||
|
||||
if (da == null)
|
||||
if (nextDa == null)
|
||||
{
|
||||
System.out.printf ("Next T/S list in sector %s is invalid : %02X, %02X%n", da,
|
||||
sectorBuffer[1], sectorBuffer[2]);
|
||||
System.out.printf ("Next T/S list in sector %s is invalid : %02X, %02X%n",
|
||||
sectorDA, sectorBuffer[1], sectorBuffer[2]);
|
||||
break;
|
||||
}
|
||||
da = nextDa;
|
||||
}
|
||||
|
||||
if (debug)
|
||||
System.out.printf ("Total blocks recoverable : %d%n", totalBlocks);
|
||||
if (totalBlocks != reportedSize)
|
||||
|
@ -76,6 +76,7 @@ public class DosDisk extends AbstractFormattedDisk
|
||||
|
||||
da = disk.getDiskAddress (CATALOG_TRACK, VTOC_SECTOR);
|
||||
sectorBuffer = disk.readBlock (da); // VTOC
|
||||
((AppleDisk) disk).setDosVersion (sectorBuffer[3] & 0xFF);
|
||||
dosVTOCSector = new DosVTOCSector (this, disk, sectorBuffer, da);
|
||||
sectorTypes[da.getBlockNo ()] = vtocSector;
|
||||
|
||||
@ -131,8 +132,9 @@ public class DosDisk extends AbstractFormattedDisk
|
||||
break;
|
||||
|
||||
da = disk.getDiskAddress (track, sector);
|
||||
// System.out.println ("** " + da + da.isValidAddress ());
|
||||
|
||||
} while (!da.isZero ());
|
||||
} while (!da.isZero () && da.isValidAddress ());
|
||||
|
||||
// same loop, but now all the catalog sectors are properly flagged
|
||||
da = disk.getDiskAddress (catalogStart.getBlockNo ());
|
||||
@ -393,6 +395,7 @@ public class DosDisk extends AbstractFormattedDisk
|
||||
if (debug)
|
||||
System.out.printf ("Catalog blocks: %s%n", catalogBlocks);
|
||||
|
||||
disk.setDosVersion (version);
|
||||
return catalogBlocks;
|
||||
}
|
||||
|
||||
|
@ -60,16 +60,13 @@ class VolumeDirectoryHeader extends DirectoryHeader
|
||||
ptr += bytesToCopy;
|
||||
}
|
||||
|
||||
block = 0;
|
||||
|
||||
// nb1 dual-dos disk needs to use totalBlocks obtained from disk
|
||||
// int max1 = (totalBlocks - 1) / 8 + 1; // bytes required for sector map
|
||||
// nb2 hard disk may be truncated, so use actual number of blocks
|
||||
// int max2 = (disk.getTotalBlocks () - 1) / 8 + 1; // bytes required for sector map
|
||||
|
||||
int max = (Math.min (totalBlocks, disk.getTotalBlocks ()) - 1) / 8 + 1;
|
||||
// System.out.printf ("total blocks %,d%n", totalBlocks);
|
||||
// System.out.printf ("disk blocks %,d%n", disk.getTotalBlocks ());
|
||||
block = 0;
|
||||
|
||||
for (int i = 0; i < max; i++)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user