diff --git a/lib/ac-api/src/main/java/com/webcodepro/applecommander/storage/Disk.java b/lib/ac-api/src/main/java/com/webcodepro/applecommander/storage/Disk.java index b783c71..56eb21d 100644 --- a/lib/ac-api/src/main/java/com/webcodepro/applecommander/storage/Disk.java +++ b/lib/ac-api/src/main/java/com/webcodepro/applecommander/storage/Disk.java @@ -278,7 +278,7 @@ public class Disk { rc = 0; } else { imageOrder = proDosOrder; - if (knownProDOSOrder || isProdosFormat() || isDosFormat()) { + if (knownProDOSOrder || isProdosFormat() || isDosFormat() || isRdos33Format()) { rc = 0; } } @@ -791,9 +791,20 @@ public class Disk { if (!is140KbDisk()) return false; byte[] block = readSector(0, 0x0d); String id = AppleUtil.getString(block, 0xe0, 4); - return "RDOS".equals(id); //$NON-NLS-1$ + return "RDOS".equals(id) || isRdos33Format(); //$NON-NLS-1$ } + /** + * Test the disk format to see if this is a RDOS 33 formatted + * disk. + */ + public boolean isRdos33Format() { + if (!is140KbDisk()) return false; + byte[] block = readSector(1, 0x0); + String id = AppleUtil.getString(block, 0x0, 6); + return "RDOS 3".equals(id); //$NON-NLS-1$ + } + /** * Test the disk format to see if this is a WP formatted * disk. diff --git a/lib/ac-api/src/main/java/com/webcodepro/applecommander/storage/os/rdos/RdosFormatDisk.java b/lib/ac-api/src/main/java/com/webcodepro/applecommander/storage/os/rdos/RdosFormatDisk.java index 7c7ef37..8c9a03b 100644 --- a/lib/ac-api/src/main/java/com/webcodepro/applecommander/storage/os/rdos/RdosFormatDisk.java +++ b/lib/ac-api/src/main/java/com/webcodepro/applecommander/storage/os/rdos/RdosFormatDisk.java @@ -30,20 +30,21 @@ import com.webcodepro.applecommander.storage.FileEntry; import com.webcodepro.applecommander.storage.FormattedDisk; import com.webcodepro.applecommander.storage.StorageBundle; import com.webcodepro.applecommander.storage.physical.ImageOrder; +import com.webcodepro.applecommander.storage.physical.ProdosOrder; import com.webcodepro.applecommander.util.AppleUtil; import com.webcodepro.applecommander.util.TextBundle; /** * Manages a disk that is in the RDOS format. *
- * Note that the RDOS block interleave is different than the standard DOS 3.3 format. + * Note that the RDOS 2.1/3.2 block interleave is different than the standard DOS 3.3 format. * Thus, when the image is made, the sectors are skewed differently - use readRdosBlock * to read the appropriate block number. *
* Also note that the operating system is itself the first file. Block #0 is really * track 0, sector 0 - meaning that the first file should not (cannot) be deleted. *
- * RDOS appears to have been placed on 13 sector disks. This limits the number of blocks + * RDOS 2.1/3.2 was placed on 13 sector disks. This limits the number of blocks * to 455. It also may also cause incompatibilities with other formats and other cracks. *
* Date created: Oct 7, 2002 2:03:58 PM
@@ -52,7 +53,7 @@ import com.webcodepro.applecommander.util.TextBundle;
public class RdosFormatDisk extends FormattedDisk {
private TextBundle textBundle = StorageBundle.getInstance();
/**
- * The RDOS disks are structured in a different order than DOS 3.3.
+ * RDOS 2.1/3.2 disks are structured in a different order than DOS 3.3.
* This table interpolates between the RDOS ordering and the DOS
* ordering. It appears that RDOS may use the physical sector number
* instead of the logical sector.
@@ -66,15 +67,38 @@ public class RdosFormatDisk extends FormattedDisk {
*/
public static final int ENTRY_LENGTH = 0x20;
/**
- * Specifies the number of blocks on the disk.
+ * Specifies the number of tracks on the disk.
* RDOS apparantly only worked on 5.25" disks.
*/
- public static final int BLOCKS_ON_DISK = 455;
+ public static final int TRACKS_ON_DISK = 35;
+ /**
+ * Number of sectors used by catalog.
+ * FIXME: some sources say 10, others say 11. RDOS 3.3 may support 16.
+ */
+ public static final int CATALOG_SECTORS = 10;
/**
* The known filetypes for a RDOS disk.
*/
public static final String[] filetypes = { "B", "A", "T" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ /**
+ * 13 sectors for RDOS 2.1/3.2, native sectoring (16) for RDOS 3.3
+ */
+ private int SectorsPerTrack() {
+ if (getImageOrder() instanceof ProdosOrder) {
+ return getImageOrder().getSectorsPerTrack();
+ } else {
+ return 13;
+ }
+ }
+
+ /**
+ * 455 blocks for RDOS 2.1/3.2, 560 for RDOS 3.3
+ */
+ private int BlocksOnDisk() {
+ return TRACKS_ON_DISK * SectorsPerTrack();
+ }
+
/**
* Use this inner interface for managing the disk usage data.
* This off-loads format-specific implementation to the implementing class.
@@ -93,13 +117,13 @@ public class RdosFormatDisk extends FormattedDisk {
private int location = -1;
private BitSet bitmap = null;
public boolean hasNext() {
- return location == -1 || location < BLOCKS_ON_DISK - 1;
+ return location == -1 || location < BlocksOnDisk() - 1;
}
public void next() {
if (bitmap == null) {
- bitmap = new BitSet(BLOCKS_ON_DISK);
+ bitmap = new BitSet(BlocksOnDisk());
// mark all blocks as unused
- for (int b=0; b