mirror of
https://github.com/AppleCommander/AppleCommander.git
synced 2025-01-10 11:29:20 +00:00
Converted to support image order and image layout instead of a simple
byte array.
This commit is contained in:
parent
b3a72347d8
commit
3bae1f3c87
@ -19,6 +19,7 @@
|
|||||||
*/
|
*/
|
||||||
package com.webcodepro.applecommander.storage;
|
package com.webcodepro.applecommander.storage;
|
||||||
|
|
||||||
|
import com.webcodepro.applecommander.storage.physical.ImageOrder;
|
||||||
import com.webcodepro.applecommander.util.AppleUtil;
|
import com.webcodepro.applecommander.util.AppleUtil;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@ -101,17 +102,16 @@ public class DosFormatDisk extends FormattedDisk {
|
|||||||
* @param diskImage
|
* @param diskImage
|
||||||
* @param order
|
* @param order
|
||||||
*/
|
*/
|
||||||
public DosFormatDisk(String filename, byte[] diskImage) {
|
public DosFormatDisk(String filename, ImageOrder imageOrder) {
|
||||||
super(filename, diskImage);
|
super(filename, imageOrder);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a DosFormatDisk. All DOS disk images are expected to
|
* Create a DosFormatDisk. All DOS disk images are expected to
|
||||||
* be 140K in size.
|
* be 140K in size.
|
||||||
*/
|
*/
|
||||||
public static DosFormatDisk[] create(String filename) {
|
public static DosFormatDisk[] create(String filename, ImageOrder imageOrder) {
|
||||||
DosFormatDisk disk =
|
DosFormatDisk disk = new DosFormatDisk(filename, imageOrder);
|
||||||
new DosFormatDisk(filename, new byte[APPLE_140KB_DISK]);
|
|
||||||
disk.format();
|
disk.format();
|
||||||
return new DosFormatDisk[] { disk };
|
return new DosFormatDisk[] { disk };
|
||||||
}
|
}
|
||||||
@ -537,6 +537,7 @@ public class DosFormatDisk extends FormattedDisk {
|
|||||||
* @see com.webcodepro.applecommander.storage.FormattedDisk#format()
|
* @see com.webcodepro.applecommander.storage.FormattedDisk#format()
|
||||||
*/
|
*/
|
||||||
public void format() {
|
public void format() {
|
||||||
|
getImageOrder().format();
|
||||||
format(15, 35, 16);
|
format(15, 35, 16);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,6 +19,8 @@
|
|||||||
*/
|
*/
|
||||||
package com.webcodepro.applecommander.storage;
|
package com.webcodepro.applecommander.storage;
|
||||||
|
|
||||||
|
import com.webcodepro.applecommander.storage.physical.ImageOrder;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
@ -122,8 +124,8 @@ public abstract class FormattedDisk extends Disk implements DirectoryEntry {
|
|||||||
* @param filename
|
* @param filename
|
||||||
* @param diskImage
|
* @param diskImage
|
||||||
*/
|
*/
|
||||||
public FormattedDisk(String filename, byte[] diskImage) {
|
public FormattedDisk(String filename, ImageOrder imageOrder) {
|
||||||
super(filename, diskImage);
|
super(filename, imageOrder);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -19,6 +19,8 @@
|
|||||||
*/
|
*/
|
||||||
package com.webcodepro.applecommander.storage;
|
package com.webcodepro.applecommander.storage;
|
||||||
|
|
||||||
|
import com.webcodepro.applecommander.storage.physical.ImageOrder;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Manages a disk that is in OzDOS format.
|
* Manages a disk that is in OzDOS format.
|
||||||
* This is basically DOS 3.3 except that the disk has two volumes of
|
* This is basically DOS 3.3 except that the disk has two volumes of
|
||||||
@ -50,20 +52,17 @@ public class OzDosFormatDisk extends DosFormatDisk {
|
|||||||
* @param filename
|
* @param filename
|
||||||
* @param diskImage
|
* @param diskImage
|
||||||
*/
|
*/
|
||||||
public OzDosFormatDisk(String filename, byte[] diskImage, int logicalOffset) {
|
public OzDosFormatDisk(String filename, ImageOrder imageOrder, int logicalOffset) {
|
||||||
super(filename, diskImage);
|
super(filename, imageOrder);
|
||||||
this.logicalOffset = logicalOffset;
|
this.logicalOffset = logicalOffset;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Create a OzDosFormatDisk.
|
* Create a OzDosFormatDisk.
|
||||||
*/
|
*/
|
||||||
public static DosFormatDisk[] create(String filename) {
|
public static DosFormatDisk[] create(String filename, ImageOrder imageOrder) {
|
||||||
byte[] diskImage = new byte[APPLE_800KB_2IMG_DISK];
|
OzDosFormatDisk disk1 = new OzDosFormatDisk(filename, imageOrder, OZDOS_DISK_1);
|
||||||
OzDosFormatDisk disk1 = new OzDosFormatDisk(filename,
|
OzDosFormatDisk disk2 = new OzDosFormatDisk(filename, imageOrder, OZDOS_DISK_2);
|
||||||
diskImage, OZDOS_DISK_1);
|
|
||||||
disk1.format();
|
disk1.format();
|
||||||
OzDosFormatDisk disk2 = new OzDosFormatDisk(filename,
|
|
||||||
diskImage, OZDOS_DISK_2);
|
|
||||||
disk2.format();
|
disk2.format();
|
||||||
return new OzDosFormatDisk[] { disk1, disk2 };
|
return new OzDosFormatDisk[] { disk1, disk2 };
|
||||||
}
|
}
|
||||||
@ -93,28 +92,12 @@ public class OzDosFormatDisk extends DosFormatDisk {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/**
|
|
||||||
* Compute the track and sector offset into the disk image.
|
|
||||||
* This varies with OzDOS.
|
|
||||||
*/
|
|
||||||
protected int getOffset(int track, int sector) throws IllegalArgumentException {
|
|
||||||
if ((track * 32 + sector) * SECTOR_SIZE > getPhysicalSize()) {
|
|
||||||
throw new IllegalArgumentException(
|
|
||||||
"The track (" + track + ") and sector (" + sector
|
|
||||||
+ ") do not match the disk image size.");
|
|
||||||
} else if (isProdosOrder()) {
|
|
||||||
return ((track * 32) + sector) * BLOCK_SIZE + logicalOffset;
|
|
||||||
} else {
|
|
||||||
// Note that DOS format is unexpected.
|
|
||||||
throw new IllegalArgumentException(
|
|
||||||
"Unknown disk format.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/**
|
/**
|
||||||
* Format the disk as OzDOS.
|
* Format the disk as OzDOS.
|
||||||
* @see com.webcodepro.applecommander.storage.FormattedDisk#format()
|
* @see com.webcodepro.applecommander.storage.FormattedDisk#format()
|
||||||
*/
|
*/
|
||||||
public void format() {
|
public void format() {
|
||||||
|
getImageOrder().format();
|
||||||
format(31, 50, 32);
|
format(31, 50, 32);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
*/
|
*/
|
||||||
package com.webcodepro.applecommander.storage;
|
package com.webcodepro.applecommander.storage;
|
||||||
|
|
||||||
|
import com.webcodepro.applecommander.storage.physical.ImageOrder;
|
||||||
import com.webcodepro.applecommander.util.AppleUtil;
|
import com.webcodepro.applecommander.util.AppleUtil;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@ -108,19 +109,17 @@ public class PascalFormatDisk extends FormattedDisk {
|
|||||||
* @param filename
|
* @param filename
|
||||||
* @param diskImage
|
* @param diskImage
|
||||||
*/
|
*/
|
||||||
public PascalFormatDisk(String filename, byte[] diskImage) {
|
public PascalFormatDisk(String filename, ImageOrder imageOrder) {
|
||||||
super(filename, diskImage);
|
super(filename, imageOrder);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a PascalFormatDisk.
|
* Create a PascalFormatDisk.
|
||||||
*/
|
*/
|
||||||
public static PascalFormatDisk[] create(String filename, String volumeName,
|
public static PascalFormatDisk[] create(String filename, String volumeName, ImageOrder imageOrder) {
|
||||||
int size) {
|
PascalFormatDisk disk = new PascalFormatDisk(filename, imageOrder);
|
||||||
|
|
||||||
PascalFormatDisk disk = new PascalFormatDisk(filename, new byte[size]);
|
|
||||||
disk.setDiskName(volumeName);
|
|
||||||
disk.format();
|
disk.format();
|
||||||
|
disk.setDiskName(volumeName);
|
||||||
return new PascalFormatDisk[] { disk };
|
return new PascalFormatDisk[] { disk };
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -445,6 +444,7 @@ public class PascalFormatDisk extends FormattedDisk {
|
|||||||
* @see com.webcodepro.applecommander.storage.FormattedDisk#format()
|
* @see com.webcodepro.applecommander.storage.FormattedDisk#format()
|
||||||
*/
|
*/
|
||||||
public void format() {
|
public void format() {
|
||||||
|
getImageOrder().format();
|
||||||
writeBootCode();
|
writeBootCode();
|
||||||
// Create volume name
|
// Create volume name
|
||||||
byte[] directory = readDirectory();
|
byte[] directory = readDirectory();
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
*/
|
*/
|
||||||
package com.webcodepro.applecommander.storage;
|
package com.webcodepro.applecommander.storage;
|
||||||
|
|
||||||
|
import com.webcodepro.applecommander.storage.physical.ImageOrder;
|
||||||
import com.webcodepro.applecommander.util.AppleUtil;
|
import com.webcodepro.applecommander.util.AppleUtil;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@ -130,8 +131,8 @@ public class ProdosFormatDisk extends FormattedDisk {
|
|||||||
* @param filename
|
* @param filename
|
||||||
* @param diskImage
|
* @param diskImage
|
||||||
*/
|
*/
|
||||||
public ProdosFormatDisk(String filename, byte[] diskImage) {
|
public ProdosFormatDisk(String filename, ImageOrder imageOrder) {
|
||||||
super(filename, diskImage);
|
super(filename, imageOrder);
|
||||||
volumeHeader = new ProdosVolumeDirectoryHeader(this);
|
volumeHeader = new ProdosVolumeDirectoryHeader(this);
|
||||||
initialize();
|
initialize();
|
||||||
}
|
}
|
||||||
@ -167,10 +168,10 @@ public class ProdosFormatDisk extends FormattedDisk {
|
|||||||
/**
|
/**
|
||||||
* Create a ProdosFormatDisk.
|
* Create a ProdosFormatDisk.
|
||||||
*/
|
*/
|
||||||
public static ProdosFormatDisk[] create(String filename, String diskName, int imageSize) {
|
public static ProdosFormatDisk[] create(String filename, String diskName, ImageOrder imageOrder) {
|
||||||
ProdosFormatDisk disk = new ProdosFormatDisk(filename, new byte[imageSize]);
|
ProdosFormatDisk disk = new ProdosFormatDisk(filename, imageOrder);
|
||||||
disk.setDiskName(diskName);
|
|
||||||
disk.format();
|
disk.format();
|
||||||
|
disk.setDiskName(diskName);
|
||||||
return new ProdosFormatDisk[] { disk };
|
return new ProdosFormatDisk[] { disk };
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -683,7 +684,7 @@ public class ProdosFormatDisk extends FormattedDisk {
|
|||||||
int blocksOnDisk = getBitmapLength();
|
int blocksOnDisk = getBitmapLength();
|
||||||
while (block < blocksOnDisk) {
|
while (block < blocksOnDisk) {
|
||||||
if (isBlockFree(volumeBitmap,block)) {
|
if (isBlockFree(volumeBitmap,block)) {
|
||||||
if ((block+1) * BLOCK_SIZE < getDiskImage().length) {
|
if ((block+1) * BLOCK_SIZE < getPhysicalSize()) {
|
||||||
return block;
|
return block;
|
||||||
}
|
}
|
||||||
throw new ProdosDiskSizeDoesNotMatchException(
|
throw new ProdosDiskSizeDoesNotMatchException(
|
||||||
@ -771,9 +772,10 @@ public class ProdosFormatDisk extends FormattedDisk {
|
|||||||
* @see com.webcodepro.applecommander.storage.FormattedDisk#format()
|
* @see com.webcodepro.applecommander.storage.FormattedDisk#format()
|
||||||
*/
|
*/
|
||||||
public void format() {
|
public void format() {
|
||||||
|
getImageOrder().format();
|
||||||
writeBootCode();
|
writeBootCode();
|
||||||
String volumeName = volumeHeader.getVolumeName();
|
String volumeName = volumeHeader.getVolumeName();
|
||||||
int totalBlocks = getDiskImage().length / BLOCK_SIZE;
|
int totalBlocks = getPhysicalSize() / BLOCK_SIZE;
|
||||||
int usedBlocks = (totalBlocks / 4096) + 7;
|
int usedBlocks = (totalBlocks / 4096) + 7;
|
||||||
// setup volume directory
|
// setup volume directory
|
||||||
byte[] data = new byte[BLOCK_SIZE];
|
byte[] data = new byte[BLOCK_SIZE];
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
*/
|
*/
|
||||||
package com.webcodepro.applecommander.storage;
|
package com.webcodepro.applecommander.storage;
|
||||||
|
|
||||||
|
import com.webcodepro.applecommander.storage.physical.ImageOrder;
|
||||||
import com.webcodepro.applecommander.util.AppleUtil;
|
import com.webcodepro.applecommander.util.AppleUtil;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@ -122,16 +123,15 @@ public class RdosFormatDisk extends FormattedDisk {
|
|||||||
* @param filename
|
* @param filename
|
||||||
* @param diskImage
|
* @param diskImage
|
||||||
*/
|
*/
|
||||||
public RdosFormatDisk(String filename, byte[] diskImage) {
|
public RdosFormatDisk(String filename, ImageOrder imageOrder) {
|
||||||
super(filename, diskImage);
|
super(filename, imageOrder);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a RdosFormatDisk.
|
* Create a RdosFormatDisk.
|
||||||
*/
|
*/
|
||||||
public static RdosFormatDisk[] create(String filename) {
|
public static RdosFormatDisk[] create(String filename, ImageOrder imageOrder) {
|
||||||
RdosFormatDisk disk =
|
RdosFormatDisk disk = new RdosFormatDisk(filename, imageOrder);
|
||||||
new RdosFormatDisk(filename, new byte[APPLE_140KB_DISK]);
|
|
||||||
disk.format();
|
disk.format();
|
||||||
return new RdosFormatDisk[] { disk };
|
return new RdosFormatDisk[] { disk };
|
||||||
}
|
}
|
||||||
@ -395,6 +395,7 @@ public class RdosFormatDisk extends FormattedDisk {
|
|||||||
* @see com.webcodepro.applecommander.storage.FormattedDisk#format()
|
* @see com.webcodepro.applecommander.storage.FormattedDisk#format()
|
||||||
*/
|
*/
|
||||||
public void format() {
|
public void format() {
|
||||||
|
getImageOrder().format();
|
||||||
writeBootCode();
|
writeBootCode();
|
||||||
// minor hack - ensure that AppleCommander itself recognizes the
|
// minor hack - ensure that AppleCommander itself recognizes the
|
||||||
// RDOS disk!
|
// RDOS disk!
|
||||||
|
@ -19,6 +19,8 @@
|
|||||||
*/
|
*/
|
||||||
package com.webcodepro.applecommander.storage;
|
package com.webcodepro.applecommander.storage;
|
||||||
|
|
||||||
|
import com.webcodepro.applecommander.storage.physical.ImageOrder;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Manages a disk that is in UniDOS format.
|
* Manages a disk that is in UniDOS format.
|
||||||
* This is basically DOS 3.3 except that the disk has two volumes of
|
* This is basically DOS 3.3 except that the disk has two volumes of
|
||||||
@ -48,20 +50,17 @@ public class UniDosFormatDisk extends DosFormatDisk {
|
|||||||
* @param filename
|
* @param filename
|
||||||
* @param diskImage
|
* @param diskImage
|
||||||
*/
|
*/
|
||||||
public UniDosFormatDisk(String filename, byte[] diskImage, int logicalOffset) {
|
public UniDosFormatDisk(String filename, ImageOrder imageOrder, int logicalOffset) {
|
||||||
super(filename, diskImage);
|
super(filename, imageOrder);
|
||||||
this.logicalOffset = logicalOffset;
|
this.logicalOffset = logicalOffset;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Create a UniDosFormatDisk.
|
* Create a UniDosFormatDisk.
|
||||||
*/
|
*/
|
||||||
public static DosFormatDisk[] create(String filename) {
|
public static DosFormatDisk[] create(String filename, ImageOrder imageOrder) {
|
||||||
byte[] diskImage = new byte[APPLE_800KB_2IMG_DISK];
|
UniDosFormatDisk disk1 = new UniDosFormatDisk(filename, imageOrder, UNIDOS_DISK_1);
|
||||||
UniDosFormatDisk disk1 = new UniDosFormatDisk(filename,
|
UniDosFormatDisk disk2 = new UniDosFormatDisk(filename, imageOrder, UNIDOS_DISK_2);
|
||||||
diskImage, UNIDOS_DISK_1);
|
|
||||||
disk1.format();
|
disk1.format();
|
||||||
UniDosFormatDisk disk2 = new UniDosFormatDisk(filename,
|
|
||||||
diskImage, UNIDOS_DISK_2);
|
|
||||||
disk2.format();
|
disk2.format();
|
||||||
return new UniDosFormatDisk[] { disk1, disk2 };
|
return new UniDosFormatDisk[] { disk1, disk2 };
|
||||||
}
|
}
|
||||||
@ -79,15 +78,6 @@ public class UniDosFormatDisk extends DosFormatDisk {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Modify the disk offset by the logical disk offset. This allows
|
|
||||||
* simple support for two DOS volumes on a UniDOS disk.
|
|
||||||
* @see com.webcodepro.applecommander.storage.Disk#getOffset(int, int)
|
|
||||||
*/
|
|
||||||
protected int getOffset(int track, int sector) throws IllegalArgumentException {
|
|
||||||
return super.getOffset(track, sector) + logicalOffset;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the logical disk number. This can be used to identify
|
* Returns the logical disk number. This can be used to identify
|
||||||
* between disks when a format supports multiple logical volumes.
|
* between disks when a format supports multiple logical volumes.
|
||||||
@ -106,6 +96,7 @@ public class UniDosFormatDisk extends DosFormatDisk {
|
|||||||
* @see com.webcodepro.applecommander.storage.FormattedDisk#format()
|
* @see com.webcodepro.applecommander.storage.FormattedDisk#format()
|
||||||
*/
|
*/
|
||||||
public void format() {
|
public void format() {
|
||||||
|
getImageOrder().format();
|
||||||
format(31, 50, 32);
|
format(31, 50, 32);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -22,6 +22,7 @@ package com.webcodepro.applecommander.storage.cpm;
|
|||||||
import com.webcodepro.applecommander.storage.DiskFullException;
|
import com.webcodepro.applecommander.storage.DiskFullException;
|
||||||
import com.webcodepro.applecommander.storage.FileEntry;
|
import com.webcodepro.applecommander.storage.FileEntry;
|
||||||
import com.webcodepro.applecommander.storage.FormattedDisk;
|
import com.webcodepro.applecommander.storage.FormattedDisk;
|
||||||
|
import com.webcodepro.applecommander.storage.physical.ImageOrder;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@ -91,12 +92,21 @@ public class CpmFormatDisk extends FormattedDisk {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Construct a CP/M formatted disk.
|
||||||
|
*/
|
||||||
|
public CpmFormatDisk(String filename, ImageOrder imageOrder) {
|
||||||
|
super(filename, imageOrder);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a CP/M formatted disk.
|
* Create a CpmFormatDisk. All CP/M disk images are expected to
|
||||||
|
* be 140K in size.
|
||||||
*/
|
*/
|
||||||
public CpmFormatDisk(String filename, byte[] diskImage) {
|
public static CpmFormatDisk[] create(String filename, ImageOrder imageOrder) {
|
||||||
super(filename, diskImage);
|
CpmFormatDisk disk = new CpmFormatDisk(filename, imageOrder);
|
||||||
|
disk.format();
|
||||||
|
return new CpmFormatDisk[] { disk };
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -267,6 +277,7 @@ public class CpmFormatDisk extends FormattedDisk {
|
|||||||
* @see com.webcodepro.applecommander.storage.FormattedDisk#format()
|
* @see com.webcodepro.applecommander.storage.FormattedDisk#format()
|
||||||
*/
|
*/
|
||||||
public void format() {
|
public void format() {
|
||||||
|
getImageOrder().format();
|
||||||
byte[] sectorData = new byte[SECTOR_SIZE];
|
byte[] sectorData = new byte[SECTOR_SIZE];
|
||||||
for (int i=0; i<SECTOR_SIZE; i++) {
|
for (int i=0; i<SECTOR_SIZE; i++) {
|
||||||
sectorData[i] = (byte) 0xe5;
|
sectorData[i] = (byte) 0xe5;
|
||||||
|
@ -29,6 +29,11 @@ import com.webcodepro.applecommander.storage.OzDosFormatDisk;
|
|||||||
import com.webcodepro.applecommander.storage.ProdosFormatDisk;
|
import com.webcodepro.applecommander.storage.ProdosFormatDisk;
|
||||||
import com.webcodepro.applecommander.storage.UniDosFormatDisk;
|
import com.webcodepro.applecommander.storage.UniDosFormatDisk;
|
||||||
import com.webcodepro.applecommander.storage.FormattedDisk.DiskUsage;
|
import com.webcodepro.applecommander.storage.FormattedDisk.DiskUsage;
|
||||||
|
import com.webcodepro.applecommander.storage.physical.ByteArrayImageLayout;
|
||||||
|
import com.webcodepro.applecommander.storage.physical.DosOrder;
|
||||||
|
import com.webcodepro.applecommander.storage.physical.ImageOrder;
|
||||||
|
import com.webcodepro.applecommander.storage.physical.NibbleOrder;
|
||||||
|
import com.webcodepro.applecommander.storage.physical.ProdosOrder;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -46,7 +51,7 @@ public class DiskWriterTest extends TestCase {
|
|||||||
* Determine if the created disk images should be saved for later
|
* Determine if the created disk images should be saved for later
|
||||||
* perusal.
|
* perusal.
|
||||||
*/
|
*/
|
||||||
private static final boolean saveImage = false;
|
private boolean saveImage = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create the DiskWriterTest.
|
* Create the DiskWriterTest.
|
||||||
@ -66,17 +71,34 @@ public class DiskWriterTest extends TestCase {
|
|||||||
* Test writing and reading random files to a DOS 3.3 140K disk.
|
* Test writing and reading random files to a DOS 3.3 140K disk.
|
||||||
*/
|
*/
|
||||||
public void testWriteToDos33() throws DiskFullException, IOException {
|
public void testWriteToDos33() throws DiskFullException, IOException {
|
||||||
FormattedDisk[] disks = DosFormatDisk.create("write-test-dos33.dsk");
|
ByteArrayImageLayout imageLayout = new ByteArrayImageLayout(Disk.APPLE_140KB_DISK);
|
||||||
|
ImageOrder imageOrder = new DosOrder(imageLayout);
|
||||||
|
FormattedDisk[] disks = DosFormatDisk.create("write-test-dos33.dsk", imageOrder);
|
||||||
writeFiles(disks, "B", "T", false);
|
writeFiles(disks, "B", "T", false);
|
||||||
saveDisks(disks);
|
saveDisks(disks);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test writing and reading random files to a DOS 3.3 140K nibbilized disk.
|
||||||
|
*/
|
||||||
|
public void testWriteToDos33Nibble() throws DiskFullException, IOException {
|
||||||
|
ByteArrayImageLayout imageLayout = new ByteArrayImageLayout(Disk.APPLE_140KB_NIBBLE_DISK);
|
||||||
|
ImageOrder imageOrder = new NibbleOrder(imageLayout);
|
||||||
|
FormattedDisk[] disks = DosFormatDisk.create("write-test-dos33.nib", imageOrder);
|
||||||
|
writeFiles(disks, "B", "T", false);
|
||||||
|
saveImage = true;
|
||||||
|
saveDisks(disks);
|
||||||
|
saveImage = false;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test writing and reading random files to a ProDOS 140K disk.
|
* Test writing and reading random files to a ProDOS 140K disk.
|
||||||
*/
|
*/
|
||||||
public void testWriteToProdos140kDisk() throws DiskFullException, IOException {
|
public void testWriteToProdos140kDisk() throws DiskFullException, IOException {
|
||||||
|
ByteArrayImageLayout imageLayout = new ByteArrayImageLayout(Disk.APPLE_140KB_DISK);
|
||||||
|
ImageOrder imageOrder = new ProdosOrder(imageLayout);
|
||||||
FormattedDisk[] disks = ProdosFormatDisk.create(
|
FormattedDisk[] disks = ProdosFormatDisk.create(
|
||||||
"write-test-prodos-140k.dsk", "TEST", ProdosFormatDisk.APPLE_140KB_DISK);
|
"write-test-prodos-140k.dsk", "TEST", imageOrder);
|
||||||
writeFiles(disks, "BIN", "TXT", true);
|
writeFiles(disks, "BIN", "TXT", true);
|
||||||
saveDisks(disks);
|
saveDisks(disks);
|
||||||
}
|
}
|
||||||
@ -85,8 +107,10 @@ public class DiskWriterTest extends TestCase {
|
|||||||
* Test writing and reading random files to a ProDOS 800K disk.
|
* Test writing and reading random files to a ProDOS 800K disk.
|
||||||
*/
|
*/
|
||||||
public void testWriteToProdos800kDisk() throws DiskFullException, IOException {
|
public void testWriteToProdos800kDisk() throws DiskFullException, IOException {
|
||||||
|
ByteArrayImageLayout imageLayout = new ByteArrayImageLayout(Disk.APPLE_800KB_DISK);
|
||||||
|
ImageOrder imageOrder = new ProdosOrder(imageLayout);
|
||||||
FormattedDisk[] disks = ProdosFormatDisk.create(
|
FormattedDisk[] disks = ProdosFormatDisk.create(
|
||||||
"write-test-prodos-800k.po", "TEST", ProdosFormatDisk.APPLE_800KB_DISK);
|
"write-test-prodos-800k.po", "TEST", imageOrder);
|
||||||
writeFiles(disks, "BIN", "TXT", true);
|
writeFiles(disks, "BIN", "TXT", true);
|
||||||
saveDisks(disks);
|
saveDisks(disks);
|
||||||
}
|
}
|
||||||
@ -95,8 +119,10 @@ public class DiskWriterTest extends TestCase {
|
|||||||
* Test writing and reading random files to a ProDOS 5MB disk.
|
* Test writing and reading random files to a ProDOS 5MB disk.
|
||||||
*/
|
*/
|
||||||
public void testWriteToProdos5mbDisk() throws DiskFullException, IOException {
|
public void testWriteToProdos5mbDisk() throws DiskFullException, IOException {
|
||||||
|
ByteArrayImageLayout imageLayout = new ByteArrayImageLayout(Disk.APPLE_5MB_HARDDISK);
|
||||||
|
ImageOrder imageOrder = new ProdosOrder(imageLayout);
|
||||||
FormattedDisk[] disks = ProdosFormatDisk.create(
|
FormattedDisk[] disks = ProdosFormatDisk.create(
|
||||||
"write-test-prodos-5mb.hdv", "TEST", ProdosFormatDisk.APPLE_5MB_HARDDISK);
|
"write-test-prodos-5mb.hdv", "TEST", imageOrder);
|
||||||
writeFiles(disks, "BIN", "TXT", true);
|
writeFiles(disks, "BIN", "TXT", true);
|
||||||
saveDisks(disks);
|
saveDisks(disks);
|
||||||
}
|
}
|
||||||
@ -105,8 +131,10 @@ public class DiskWriterTest extends TestCase {
|
|||||||
* Test creating and deleting many files on a DOS 3.3 140K disk.
|
* Test creating and deleting many files on a DOS 3.3 140K disk.
|
||||||
*/
|
*/
|
||||||
public void testCreateAndDeleteDos33() throws IOException {
|
public void testCreateAndDeleteDos33() throws IOException {
|
||||||
|
ByteArrayImageLayout imageLayout = new ByteArrayImageLayout(Disk.APPLE_140KB_DISK);
|
||||||
|
ImageOrder imageOrder = new DosOrder(imageLayout);
|
||||||
FormattedDisk[] disks = DosFormatDisk.create(
|
FormattedDisk[] disks = DosFormatDisk.create(
|
||||||
"createanddelete-test-dos33.dsk");
|
"createanddelete-test-dos33.dsk", imageOrder);
|
||||||
createAndDeleteFiles(disks, "B");
|
createAndDeleteFiles(disks, "B");
|
||||||
saveDisks(disks);
|
saveDisks(disks);
|
||||||
}
|
}
|
||||||
@ -115,8 +143,10 @@ public class DiskWriterTest extends TestCase {
|
|||||||
* Test creating and deleting many files on an OzDOS 800K disk.
|
* Test creating and deleting many files on an OzDOS 800K disk.
|
||||||
*/
|
*/
|
||||||
public void testCreateAndDeleteOzDos() throws IOException {
|
public void testCreateAndDeleteOzDos() throws IOException {
|
||||||
|
ByteArrayImageLayout imageLayout = new ByteArrayImageLayout(Disk.APPLE_800KB_DISK);
|
||||||
|
ImageOrder imageOrder = new ProdosOrder(imageLayout);
|
||||||
FormattedDisk[] disks = OzDosFormatDisk.create(
|
FormattedDisk[] disks = OzDosFormatDisk.create(
|
||||||
"createanddelete-test-ozdos.po");
|
"createanddelete-test-ozdos.po", imageOrder);
|
||||||
createAndDeleteFiles(disks, "B");
|
createAndDeleteFiles(disks, "B");
|
||||||
saveDisks(disks);
|
saveDisks(disks);
|
||||||
}
|
}
|
||||||
@ -125,8 +155,10 @@ public class DiskWriterTest extends TestCase {
|
|||||||
* Test creating and deleting many files on a UniDOS 800K disk.
|
* Test creating and deleting many files on a UniDOS 800K disk.
|
||||||
*/
|
*/
|
||||||
public void testCreateAndDeleteUniDos() throws IOException {
|
public void testCreateAndDeleteUniDos() throws IOException {
|
||||||
|
ByteArrayImageLayout imageLayout = new ByteArrayImageLayout(Disk.APPLE_140KB_DISK);
|
||||||
|
ImageOrder imageOrder = new DosOrder(imageLayout);
|
||||||
FormattedDisk[] disks = UniDosFormatDisk.create(
|
FormattedDisk[] disks = UniDosFormatDisk.create(
|
||||||
"createanddelete-test-unidos.dsk");
|
"createanddelete-test-unidos.dsk", imageOrder);
|
||||||
createAndDeleteFiles(disks, "B");
|
createAndDeleteFiles(disks, "B");
|
||||||
saveDisks(disks);
|
saveDisks(disks);
|
||||||
}
|
}
|
||||||
@ -135,9 +167,11 @@ public class DiskWriterTest extends TestCase {
|
|||||||
* Test creating and deleting many files on a ProDOS 140K disk.
|
* Test creating and deleting many files on a ProDOS 140K disk.
|
||||||
*/
|
*/
|
||||||
public void testCreateAndDeleteProdos140kDisk() throws IOException {
|
public void testCreateAndDeleteProdos140kDisk() throws IOException {
|
||||||
|
ByteArrayImageLayout imageLayout = new ByteArrayImageLayout(Disk.APPLE_140KB_DISK);
|
||||||
|
ImageOrder imageOrder = new DosOrder(imageLayout);
|
||||||
FormattedDisk[] disks = ProdosFormatDisk.create(
|
FormattedDisk[] disks = ProdosFormatDisk.create(
|
||||||
"createanddelete-test-prodos-140k.dsk", "TEST",
|
"createanddelete-test-prodos-140k.dsk", "TEST",
|
||||||
ProdosFormatDisk.APPLE_140KB_DISK);
|
imageOrder);
|
||||||
createAndDeleteFiles(disks, "BIN");
|
createAndDeleteFiles(disks, "BIN");
|
||||||
saveDisks(disks);
|
saveDisks(disks);
|
||||||
}
|
}
|
||||||
@ -146,9 +180,11 @@ public class DiskWriterTest extends TestCase {
|
|||||||
* Test creating and deleting many files on a ProDOS 800K disk.
|
* Test creating and deleting many files on a ProDOS 800K disk.
|
||||||
*/
|
*/
|
||||||
public void testCreateAndDeleteProdos800kDisk() throws IOException {
|
public void testCreateAndDeleteProdos800kDisk() throws IOException {
|
||||||
|
ByteArrayImageLayout imageLayout = new ByteArrayImageLayout(Disk.APPLE_800KB_DISK);
|
||||||
|
ImageOrder imageOrder = new DosOrder(imageLayout);
|
||||||
FormattedDisk[] disks = ProdosFormatDisk.create(
|
FormattedDisk[] disks = ProdosFormatDisk.create(
|
||||||
"createanddelete-test-prodos-800k.dsk", "TEST",
|
"createanddelete-test-prodos-800k.dsk", "TEST",
|
||||||
ProdosFormatDisk.APPLE_800KB_2IMG_DISK);
|
imageOrder);
|
||||||
createAndDeleteFiles(disks, "BIN");
|
createAndDeleteFiles(disks, "BIN");
|
||||||
saveDisks(disks);
|
saveDisks(disks);
|
||||||
}
|
}
|
||||||
@ -159,8 +195,10 @@ public class DiskWriterTest extends TestCase {
|
|||||||
*/
|
*/
|
||||||
public void testCreateDeleteCreateDosDisk()
|
public void testCreateDeleteCreateDosDisk()
|
||||||
throws DiskFullException, IOException {
|
throws DiskFullException, IOException {
|
||||||
|
ByteArrayImageLayout imageLayout = new ByteArrayImageLayout(Disk.APPLE_140KB_DISK);
|
||||||
|
ImageOrder imageOrder = new DosOrder(imageLayout);
|
||||||
FormattedDisk[] disks = DosFormatDisk.create(
|
FormattedDisk[] disks = DosFormatDisk.create(
|
||||||
"createdeletecreate-test-dos-140k.dsk");
|
"createdeletecreate-test-dos-140k.dsk", imageOrder);
|
||||||
createDeleteCreate(disks, "B");
|
createDeleteCreate(disks, "B");
|
||||||
saveDisks(disks);
|
saveDisks(disks);
|
||||||
}
|
}
|
||||||
@ -171,8 +209,10 @@ public class DiskWriterTest extends TestCase {
|
|||||||
*/
|
*/
|
||||||
public void testCreateDeleteCreateOzdosDisk()
|
public void testCreateDeleteCreateOzdosDisk()
|
||||||
throws DiskFullException, IOException {
|
throws DiskFullException, IOException {
|
||||||
|
ByteArrayImageLayout imageLayout = new ByteArrayImageLayout(Disk.APPLE_800KB_DISK);
|
||||||
|
ImageOrder imageOrder = new ProdosOrder(imageLayout);
|
||||||
FormattedDisk[] disks = OzDosFormatDisk.create(
|
FormattedDisk[] disks = OzDosFormatDisk.create(
|
||||||
"createdeletecreate-test-ozdos-800k.po");
|
"createdeletecreate-test-ozdos-800k.po", imageOrder);
|
||||||
createDeleteCreate(disks, "B");
|
createDeleteCreate(disks, "B");
|
||||||
saveDisks(disks);
|
saveDisks(disks);
|
||||||
}
|
}
|
||||||
@ -183,8 +223,10 @@ public class DiskWriterTest extends TestCase {
|
|||||||
*/
|
*/
|
||||||
public void testCreateDeleteCreateUnidosDisk()
|
public void testCreateDeleteCreateUnidosDisk()
|
||||||
throws DiskFullException, IOException {
|
throws DiskFullException, IOException {
|
||||||
|
ByteArrayImageLayout imageLayout = new ByteArrayImageLayout(Disk.APPLE_140KB_DISK);
|
||||||
|
ImageOrder imageOrder = new ProdosOrder(imageLayout);
|
||||||
FormattedDisk[] disks = UniDosFormatDisk.create(
|
FormattedDisk[] disks = UniDosFormatDisk.create(
|
||||||
"createdeletecreate-test-unidos-800k.dsk");
|
"createdeletecreate-test-unidos-800k.dsk", imageOrder);
|
||||||
createDeleteCreate(disks, "B");
|
createDeleteCreate(disks, "B");
|
||||||
saveDisks(disks);
|
saveDisks(disks);
|
||||||
}
|
}
|
||||||
@ -195,9 +237,11 @@ public class DiskWriterTest extends TestCase {
|
|||||||
*/
|
*/
|
||||||
public void testCreateDeleteCreateProdosDisk()
|
public void testCreateDeleteCreateProdosDisk()
|
||||||
throws DiskFullException, IOException {
|
throws DiskFullException, IOException {
|
||||||
|
ByteArrayImageLayout imageLayout = new ByteArrayImageLayout(Disk.APPLE_140KB_DISK);
|
||||||
|
ImageOrder imageOrder = new ProdosOrder(imageLayout);
|
||||||
FormattedDisk[] disks = ProdosFormatDisk.create(
|
FormattedDisk[] disks = ProdosFormatDisk.create(
|
||||||
"createdeletecreate-test-prodos-140k.dsk", "TEST",
|
"createdeletecreate-test-prodos-140k.dsk", "TEST",
|
||||||
ProdosFormatDisk.APPLE_140KB_DISK);
|
imageOrder);
|
||||||
createDeleteCreate(disks, "BIN");
|
createDeleteCreate(disks, "BIN");
|
||||||
saveDisks(disks);
|
saveDisks(disks);
|
||||||
}
|
}
|
||||||
@ -224,7 +268,8 @@ public class DiskWriterTest extends TestCase {
|
|||||||
writeFile(disk,
|
writeFile(disk,
|
||||||
"This is a test text file create from the DiskWriterTest".getBytes(),
|
"This is a test text file create from the DiskWriterTest".getBytes(),
|
||||||
textType, testText);
|
textType, testText);
|
||||||
if (disk.getPhysicalSize() > Disk.APPLE_140KB_DISK) {
|
if (disk.getPhysicalSize() > Disk.APPLE_140KB_DISK
|
||||||
|
&& disk.getPhysicalSize() != Disk.APPLE_140KB_NIBBLE_DISK) {
|
||||||
// create a few big files
|
// create a few big files
|
||||||
writeFile(disk, 150000, binaryType, true);
|
writeFile(disk, 150000, binaryType, true);
|
||||||
writeFile(disk, 300000, binaryType, true);
|
writeFile(disk, 300000, binaryType, true);
|
||||||
|
@ -28,6 +28,9 @@ import com.webcodepro.applecommander.storage.FileEntry;
|
|||||||
import com.webcodepro.applecommander.storage.FileFilter;
|
import com.webcodepro.applecommander.storage.FileFilter;
|
||||||
import com.webcodepro.applecommander.storage.FormattedDisk;
|
import com.webcodepro.applecommander.storage.FormattedDisk;
|
||||||
import com.webcodepro.applecommander.storage.ProdosFormatDisk;
|
import com.webcodepro.applecommander.storage.ProdosFormatDisk;
|
||||||
|
import com.webcodepro.applecommander.storage.physical.ByteArrayImageLayout;
|
||||||
|
import com.webcodepro.applecommander.storage.physical.ImageOrder;
|
||||||
|
import com.webcodepro.applecommander.storage.physical.ProdosOrder;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -210,8 +213,10 @@ public class ac {
|
|||||||
*/
|
*/
|
||||||
static void createPDisk(String fileName, String volName, int imageSize)
|
static void createPDisk(String fileName, String volName, int imageSize)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
|
ByteArrayImageLayout layout = new ByteArrayImageLayout(imageSize);
|
||||||
|
ImageOrder imageOrder = new ProdosOrder(layout);
|
||||||
FormattedDisk[] disks =
|
FormattedDisk[] disks =
|
||||||
ProdosFormatDisk.create(fileName, volName, imageSize);
|
ProdosFormatDisk.create(fileName, volName, imageOrder);
|
||||||
disks[0].save();
|
disks[0].save();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -57,6 +57,7 @@ public class DiskImageFormatPane extends WizardPane {
|
|||||||
switch (wizard.getFormat()) {
|
switch (wizard.getFormat()) {
|
||||||
case DiskImageWizard.FORMAT_DOS33:
|
case DiskImageWizard.FORMAT_DOS33:
|
||||||
case DiskImageWizard.FORMAT_RDOS:
|
case DiskImageWizard.FORMAT_RDOS:
|
||||||
|
case DiskImageWizard.FORMAT_CPM:
|
||||||
wizard.setOrder(DiskImageWizard.ORDER_DOS);
|
wizard.setOrder(DiskImageWizard.ORDER_DOS);
|
||||||
wizard.setSize(FormattedDisk.APPLE_140KB_DISK);
|
wizard.setSize(FormattedDisk.APPLE_140KB_DISK);
|
||||||
return new DiskImageNamePane(parent, wizard);
|
return new DiskImageNamePane(parent, wizard);
|
||||||
@ -123,6 +124,8 @@ public class DiskImageFormatPane extends WizardPane {
|
|||||||
+ "that I've seen have been mapped onto a 16 sector disk (leaving 3\n"
|
+ "that I've seen have been mapped onto a 16 sector disk (leaving 3\n"
|
||||||
+ "sectors of each track unused. The only image size RDOS supports\n"
|
+ "sectors of each track unused. The only image size RDOS supports\n"
|
||||||
+ "is 140K.");
|
+ "is 140K.");
|
||||||
|
createRadioButton(buttonSubpanel, "CP/M", DiskImageWizard.FORMAT_CPM,
|
||||||
|
"CP/M for the Apple computer.");
|
||||||
control.pack();
|
control.pack();
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
@ -19,6 +19,8 @@
|
|||||||
*/
|
*/
|
||||||
package com.webcodepro.applecommander.ui.swt;
|
package com.webcodepro.applecommander.ui.swt;
|
||||||
|
|
||||||
|
import com.webcodepro.applecommander.storage.Disk;
|
||||||
|
|
||||||
import org.eclipse.swt.SWT;
|
import org.eclipse.swt.SWT;
|
||||||
import org.eclipse.swt.events.SelectionAdapter;
|
import org.eclipse.swt.events.SelectionAdapter;
|
||||||
import org.eclipse.swt.events.SelectionEvent;
|
import org.eclipse.swt.events.SelectionEvent;
|
||||||
@ -87,6 +89,13 @@ public class DiskImageOrderPane extends WizardPane {
|
|||||||
createRadioButton(buttonSubpanel, "ProDOS ordered",
|
createRadioButton(buttonSubpanel, "ProDOS ordered",
|
||||||
DiskImageWizard.ORDER_PRODOS,
|
DiskImageWizard.ORDER_PRODOS,
|
||||||
"Indicates that image data should be stored by block.");
|
"Indicates that image data should be stored by block.");
|
||||||
|
if (wizard.getSize() == Disk.APPLE_140KB_DISK) {
|
||||||
|
createRadioButton(buttonSubpanel, "Nibble ordered",
|
||||||
|
DiskImageWizard.ORDER_NIBBLE,
|
||||||
|
"Indicates that this is a disk stored as a nibble image. This is "
|
||||||
|
+ "an image that consists of disk bytes. It is only available for "
|
||||||
|
+ "140KB 5.25\" disks.");
|
||||||
|
}
|
||||||
|
|
||||||
label = new Label(control, SWT.WRAP);
|
label = new Label(control, SWT.WRAP);
|
||||||
if (wizard.isHardDisk()) {
|
if (wizard.isHardDisk()) {
|
||||||
|
@ -27,6 +27,12 @@ import com.webcodepro.applecommander.storage.PascalFormatDisk;
|
|||||||
import com.webcodepro.applecommander.storage.ProdosFormatDisk;
|
import com.webcodepro.applecommander.storage.ProdosFormatDisk;
|
||||||
import com.webcodepro.applecommander.storage.RdosFormatDisk;
|
import com.webcodepro.applecommander.storage.RdosFormatDisk;
|
||||||
import com.webcodepro.applecommander.storage.UniDosFormatDisk;
|
import com.webcodepro.applecommander.storage.UniDosFormatDisk;
|
||||||
|
import com.webcodepro.applecommander.storage.cpm.CpmFormatDisk;
|
||||||
|
import com.webcodepro.applecommander.storage.physical.ByteArrayImageLayout;
|
||||||
|
import com.webcodepro.applecommander.storage.physical.DosOrder;
|
||||||
|
import com.webcodepro.applecommander.storage.physical.ImageOrder;
|
||||||
|
import com.webcodepro.applecommander.storage.physical.NibbleOrder;
|
||||||
|
import com.webcodepro.applecommander.storage.physical.ProdosOrder;
|
||||||
|
|
||||||
import org.eclipse.swt.widgets.Shell;
|
import org.eclipse.swt.widgets.Shell;
|
||||||
|
|
||||||
@ -43,8 +49,10 @@ public class DiskImageWizard extends Wizard {
|
|||||||
public static final int FORMAT_PASCAL = 4;
|
public static final int FORMAT_PASCAL = 4;
|
||||||
public static final int FORMAT_RDOS = 5;
|
public static final int FORMAT_RDOS = 5;
|
||||||
public static final int FORMAT_OZDOS = 6;
|
public static final int FORMAT_OZDOS = 6;
|
||||||
|
public static final int FORMAT_CPM = 7;
|
||||||
public static final int ORDER_DOS = 1;
|
public static final int ORDER_DOS = 1;
|
||||||
public static final int ORDER_PRODOS = 2;
|
public static final int ORDER_PRODOS = 2;
|
||||||
|
public static final int ORDER_NIBBLE = 3;
|
||||||
private int format = FORMAT_DOS33;
|
private int format = FORMAT_DOS33;
|
||||||
private int size = FormattedDisk.APPLE_140KB_DISK;
|
private int size = FormattedDisk.APPLE_140KB_DISK;
|
||||||
private String fileName = "";
|
private String fileName = "";
|
||||||
@ -79,19 +87,34 @@ public class DiskImageWizard extends Wizard {
|
|||||||
if (isCompressed()) {
|
if (isCompressed()) {
|
||||||
name.append(".gz");
|
name.append(".gz");
|
||||||
}
|
}
|
||||||
|
ByteArrayImageLayout imageLayout = new ByteArrayImageLayout(getSize());
|
||||||
|
ImageOrder imageOrder = null;
|
||||||
|
switch (getOrder()) {
|
||||||
|
case ORDER_DOS:
|
||||||
|
imageOrder = new DosOrder(imageLayout);
|
||||||
|
break;
|
||||||
|
case ORDER_NIBBLE:
|
||||||
|
imageOrder = new NibbleOrder(imageLayout);
|
||||||
|
break;
|
||||||
|
case ORDER_PRODOS:
|
||||||
|
imageOrder = new ProdosOrder(imageLayout);
|
||||||
|
break;
|
||||||
|
}
|
||||||
switch (format) {
|
switch (format) {
|
||||||
case FORMAT_DOS33:
|
case FORMAT_DOS33:
|
||||||
return DosFormatDisk.create(name.toString());
|
return DosFormatDisk.create(name.toString(), imageOrder);
|
||||||
case FORMAT_OZDOS:
|
case FORMAT_OZDOS:
|
||||||
return OzDosFormatDisk.create(name.toString());
|
return OzDosFormatDisk.create(name.toString(), imageOrder);
|
||||||
case FORMAT_PASCAL:
|
case FORMAT_PASCAL:
|
||||||
return PascalFormatDisk.create(name.toString(), volumeName, size);
|
return PascalFormatDisk.create(name.toString(), volumeName, imageOrder);
|
||||||
case FORMAT_PRODOS:
|
case FORMAT_PRODOS:
|
||||||
return ProdosFormatDisk.create(name.toString(), volumeName, size);
|
return ProdosFormatDisk.create(name.toString(), volumeName, imageOrder);
|
||||||
case FORMAT_RDOS:
|
case FORMAT_RDOS:
|
||||||
return RdosFormatDisk.create(name.toString());
|
return RdosFormatDisk.create(name.toString(), imageOrder);
|
||||||
case FORMAT_UNIDOS:
|
case FORMAT_UNIDOS:
|
||||||
return UniDosFormatDisk.create(name.toString());
|
return UniDosFormatDisk.create(name.toString(), imageOrder);
|
||||||
|
case FORMAT_CPM:
|
||||||
|
return CpmFormatDisk.create(name.toString(), imageOrder);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user