With the new image order and layout, needed to fix these specialized

formats.
This commit is contained in:
Robert Greene 2003-12-28 20:42:13 +00:00
parent 61bb8a76b5
commit c45ecdd56b
2 changed files with 43 additions and 3 deletions

View File

@ -100,4 +100,29 @@ public class OzDosFormatDisk extends DosFormatDisk {
getImageOrder().format();
format(31, 50, 32);
}
/**
* Retrieve the specified sector.
*/
public byte[] readSector(int track, int sector) throws IllegalArgumentException {
byte[] blockData = readBlock(getBlockNumber(track,sector));
byte[] sectorData = new byte[SECTOR_SIZE];
System.arraycopy(blockData, logicalOffset, sectorData, 0, SECTOR_SIZE);
return sectorData;
}
/**
* Write the specified sector.
*/
public void writeSector(int track, int sector, byte[] bytes)
throws IllegalArgumentException {
int blockNumber = getBlockNumber(track,sector);
byte[] blockData = readBlock(blockNumber);
System.arraycopy(bytes, 0, blockData, logicalOffset, SECTOR_SIZE);
getImageOrder().writeBlock(blockNumber, blockData);
}
/**
* Compute the block number.
*/
protected int getBlockNumber(int track, int sector) {
return (track * 32) + sector;
}
}

View File

@ -32,14 +32,14 @@ import com.webcodepro.applecommander.storage.physical.ImageOrder;
public class UniDosFormatDisk extends DosFormatDisk {
/**
* Use this indicator to work with logical disk #1.
* It is essentially the offset into the disk image.
* It is essentially the track offset into the disk image.
*/
public static final int UNIDOS_DISK_1 = 0;
/**
* Use this indicator to work with logical disk #2.
* It is essentially the offset into the disk image.
* It is essentially the track offset into the disk image.
*/
public static final int UNIDOS_DISK_2 = 409600;
public static final int UNIDOS_DISK_2 = 50;
/**
* Indicates which logical disk to work with (by offset
* into the disk image itself).
@ -99,4 +99,19 @@ public class UniDosFormatDisk extends DosFormatDisk {
getImageOrder().format();
format(31, 50, 32);
}
/**
* Retrieve the specified sector.
*/
public byte[] readSector(int track, int sector) throws IllegalArgumentException {
return getImageOrder().readSector(track+logicalOffset, sector);
}
/**
* Write the specified sector.
*/
public void writeSector(int track, int sector, byte[] bytes)
throws IllegalArgumentException {
getImageOrder().writeSector(track+logicalOffset, sector, bytes);
}
}