diff --git a/src/com/webcodepro/applecommander/storage/DosFormatDisk.java b/src/com/webcodepro/applecommander/storage/DosFormatDisk.java index 12d6656..e986072 100644 --- a/src/com/webcodepro/applecommander/storage/DosFormatDisk.java +++ b/src/com/webcodepro/applecommander/storage/DosFormatDisk.java @@ -474,4 +474,11 @@ public class DosFormatDisk extends FormattedDisk { + ") combination."); } } + + /** + * Returns the logical disk number. Returns a 0 to indicate no numbering. + */ + public int getLogicalDiskNumber() { + return 0; + } } diff --git a/src/com/webcodepro/applecommander/storage/FormattedDisk.java b/src/com/webcodepro/applecommander/storage/FormattedDisk.java index 039034e..b337edc 100644 --- a/src/com/webcodepro/applecommander/storage/FormattedDisk.java +++ b/src/com/webcodepro/applecommander/storage/FormattedDisk.java @@ -322,4 +322,12 @@ public abstract class FormattedDisk extends Disk { } } } + + /** + * Returns the logical disk number. This can be used to identify + * between disks when a format supports multiple logical volumes. + * If a value of 0 is returned, there is not multiple logical + * volumes to distinguish. + */ + public abstract int getLogicalDiskNumber(); } diff --git a/src/com/webcodepro/applecommander/storage/PascalFormatDisk.java b/src/com/webcodepro/applecommander/storage/PascalFormatDisk.java index 88235af..432f2e5 100644 --- a/src/com/webcodepro/applecommander/storage/PascalFormatDisk.java +++ b/src/com/webcodepro/applecommander/storage/PascalFormatDisk.java @@ -417,4 +417,10 @@ public class PascalFormatDisk extends FormattedDisk { writeDirectory(directory); } + /** + * Returns the logical disk number. Returns a 0 to indicate no numbering. + */ + public int getLogicalDiskNumber() { + return 0; + } } diff --git a/src/com/webcodepro/applecommander/storage/ProdosFormatDisk.java b/src/com/webcodepro/applecommander/storage/ProdosFormatDisk.java index 81af7c6..a448020 100644 --- a/src/com/webcodepro/applecommander/storage/ProdosFormatDisk.java +++ b/src/com/webcodepro/applecommander/storage/ProdosFormatDisk.java @@ -487,4 +487,10 @@ public class ProdosFormatDisk extends FormattedDisk { writeVolumeBitMap(bitmap); } + /** + * Returns the logical disk number. Returns a 0 to indicate no numbering. + */ + public int getLogicalDiskNumber() { + return 0; + } } diff --git a/src/com/webcodepro/applecommander/storage/RdosFormatDisk.java b/src/com/webcodepro/applecommander/storage/RdosFormatDisk.java index 65fea17..bda81da 100644 --- a/src/com/webcodepro/applecommander/storage/RdosFormatDisk.java +++ b/src/com/webcodepro/applecommander/storage/RdosFormatDisk.java @@ -391,4 +391,10 @@ public class RdosFormatDisk extends FormattedDisk { writeRdosBlock(13, data); } + /** + * Returns the logical disk number. Returns a 0 to indicate no numbering. + */ + public int getLogicalDiskNumber() { + return 0; + } } diff --git a/src/com/webcodepro/applecommander/storage/UniDosFormatDisk.java b/src/com/webcodepro/applecommander/storage/UniDosFormatDisk.java new file mode 100644 index 0000000..746681e --- /dev/null +++ b/src/com/webcodepro/applecommander/storage/UniDosFormatDisk.java @@ -0,0 +1,99 @@ +/* + * AppleCommander - An Apple ][ image utility. + * Copyright (C) 2002 by Robert Greene + * robgreene at users.sourceforge.net + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +package com.webcodepro.applecommander.storage; + +/** + * Manages a disk that is in UniDOS format. + * This is basically DOS 3.3 except that the disk has two volumes of + * each 400K. + *
+ * Created on Dec 13, 2002. + * @author Rob + */ +public class UniDosFormatDisk extends DosFormatDisk { + /** + * Use this indicator to work with logical disk #1. + * It is essentially the 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. + */ + public static final int UNIDOS_DISK_2 = 409600; + /** + * Indicates which logical disk to work with (by offset + * into the disk image itself). + */ + private int logicalOffset; + /** + * Constructor for UniDosFormatDisk. + * @param filename + * @param diskImage + */ + public UniDosFormatDisk(String filename, byte[] diskImage, int logicalOffset) { + super(filename, diskImage); + this.logicalOffset = logicalOffset; + } + /** + * Constructor for UniDosFormatDisk. + * @param filename + */ + public UniDosFormatDisk(String filename, int logicalOffset) { + super(filename); + this.logicalOffset = logicalOffset; + } + /** + * Answer with the name of this disk. + * @see com.webcodepro.applecommander.storage.FormattedDisk#getDiskName() + */ + public String getDiskName() { + if (logicalOffset == UNIDOS_DISK_1) { + return super.getDiskName() + " (Disk 1)"; + } else if (logicalOffset == UNIDOS_DISK_2) { + return super.getDiskName() + " (Disk 2)"; + } else { + return super.getDiskName(); + } + } + + /** + * 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 + * between disks when a format supports multiple logical volumes. + */ + public int getLogicalDiskNumber() { + if (logicalOffset == UNIDOS_DISK_1) { + return 1; + } else if (logicalOffset == UNIDOS_DISK_2) { + return 2; + } else { + return 0; + } + } +}