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