Class CpmFormatDisk
java.lang.Object
com.webcodepro.applecommander.storage.Disk
com.webcodepro.applecommander.storage.FormattedDisk
com.webcodepro.applecommander.storage.os.cpm.CpmFormatDisk
- All Implemented Interfaces:
DirectoryEntry
Manages a disk that is in the Apple CP/M format.
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class com.webcodepro.applecommander.storage.FormattedDisk
FormattedDisk.DiskInformation, FormattedDisk.DiskUsage, FormattedDisk.FileColumnHeader
Nested classes/interfaces inherited from class com.webcodepro.applecommander.storage.Disk
Disk.FilenameFilter
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
The number of CP/M blocks per physical track.static final int
The size of a CP/M block.static final int
The number of CP/M sectors per CP/M block.static final int
The size of the CP/M sector.static final int
The track number which CP/M block #0 resides at.static final int
The number of physical sectors per CP/M block.static final int[]
The sector skew of the CP/M disk image.Fields inherited from class com.webcodepro.applecommander.storage.FormattedDisk
FILE_DISPLAY_DETAIL, FILE_DISPLAY_NATIVE, FILE_DISPLAY_STANDARD
Fields inherited from class com.webcodepro.applecommander.storage.Disk
APPLE_10MB_HARDDISK, APPLE_140KB_DISK, APPLE_140KB_NIBBLE_DISK, APPLE_20MB_HARDDISK, APPLE_32MB_HARDDISK, APPLE_5MB_HARDDISK, APPLE_800KB_2IMG_DISK, APPLE_800KB_DISK, BLOCK_SIZE, DOS33_SECTORS_ON_140KB_DISK, PRODOS_BLOCKS_ON_140KB_DISK, SECTOR_SIZE
-
Constructor Summary
ConstructorsConstructorDescriptionCpmFormatDisk
(String filename, ImageOrder imageOrder) Construct a CP/M formatted disk. -
Method Summary
Modifier and TypeMethodDescriptionboolean
Identify if additional directories can be created.boolean
Indicates if this disk image can create a file.boolean
Indicates if this disk image can delete a file.boolean
Identify if this disk format is capable of having directories.boolean
Indicates if this disk image can read data from a file.boolean
Indicates if this disk image can write data to a file.void
changeImageOrder
(ImageOrder imageOrder) Change to a different ImageOrder.protected int
computeSector
(int block) Compute the physical sector number.protected int
computeTrack
(int block) Compute the physical track number.static CpmFormatDisk[]
create
(String filename, ImageOrder imageOrder) Create a CpmFormatDisk.createDirectory
(String name) Create a new DirectoryEntry.Create a new FileEntry.void
format()
Format the disk.int[]
Get suggested dimensions for display of bitmap.String[]
Get the labels to use in the bitmap.int
Get the length of the bitmap.int
Compute the number of CP/M blocks that are currently used.Gives an indication on how this disk's geometry should be handled.There apparently is no corresponding CP/M disk name.Get the disk usage iterator.getFileColumnHeaders
(int displayMode) Get the standard file column header information.byte[]
getFileData
(FileEntry fileEntry) Get the data associated with the specified FileEntry.getFiles()
Answer with a list of file entries.String[]
Returns a list of possible file types.Identify the operating system format of this disk.int
Return the amount of free space in bytes.int
Returns the logical disk number.getSuggestedFilename
(String filename) Returns a valid filename for the given filename.getSuggestedFiletype
(String filetype) Returns a valid filetype for the given filename.int
Return the amount of used space in bytes.boolean
needsAddress
(String filetype) Indicates if this filetype requires an address component.byte[]
readCpmBlock
(int block) Read a CP/M block (1K in size).byte[]
void
setFileData
(FileEntry fileEntry, byte[] fileData) Writes the raw bytes into the file.boolean
Indicates if this disk format supports "deleted" files.boolean
Indicates if this FormattedDisk supports a disk map.toNativeFiletype
(String prodosFiletype) Provides conversation from a given ProDOS file type since as it is common across many archiving tools.toProdosFiletype
(String nativeFiletype) Provides conversation to a given ProDOS file type since as it is common across many archiving tools.void
writeCpmBlock
(int block, byte[] data) Write a CP/M block.void
writeCpmFileEntries
(byte[] data) Methods inherited from class com.webcodepro.applecommander.storage.FormattedDisk
getDirname, getDiskInformation, getFile, getFile, getFormattedDisk, resizeDiskImage, setDiskName, writeBootCode
Methods inherited from class com.webcodepro.applecommander.storage.Disk
getAllExtensions, getDiskImageManager, getFilename, getFilenameFilters, getFormattedDisks, getImageOrder, getOrderName, getPhysicalSize, hasChanged, is140KbDisk, is2ImgOrder, is800KbDisk, isBXY, isCompressed, isCpmFormat, isDC42, isDosFormat, isDosOrder, isNakedosFormat, isNewImage, isNibbleOrder, isOzDosFormat, isPascalFormat, isProdosFormat, isProdosOrder, isRdos33Format, isRdosFormat, isSDK, isSHK, isUniDosFormat, isWPFormat, makeDosOrder, makeProdosOrder, readBlock, readSector, resizeDiskImage, save, saveAs, setFilename, setImageOrder, sizeToFit, testImageOrder, writeBlock, writeSector
-
Field Details
-
CPM_SECTORSIZE
public static final int CPM_SECTORSIZEThe size of the CP/M sector. Assumed to be 128.- See Also:
-
CPM_BLOCKSIZE
public static final int CPM_BLOCKSIZEThe size of a CP/M block. Assumed to be 1K.- See Also:
-
CPM_SECTORS_PER_CPM_BLOCK
public static final int CPM_SECTORS_PER_CPM_BLOCKThe number of CP/M sectors per CP/M block.- See Also:
-
CPM_BLOCKS_PER_TRACK
public static final int CPM_BLOCKS_PER_TRACKThe number of CP/M blocks per physical track.- See Also:
-
PHYSICAL_SECTORS_PER_BLOCK
public static final int PHYSICAL_SECTORS_PER_BLOCKThe number of physical sectors per CP/M block.- See Also:
-
PHYSICAL_BLOCK_TRACK_START
public static final int PHYSICAL_BLOCK_TRACK_STARTThe track number which CP/M block #0 resides at. (The other tracks are boot-related and not available.)- See Also:
-
sectorSkew
public static final int[] sectorSkewThe sector skew of the CP/M disk image.
-
-
Constructor Details
-
CpmFormatDisk
Construct a CP/M formatted disk.
-
-
Method Details
-
create
Create a CpmFormatDisk. All CP/M disk images are expected to be 140K in size. -
getDiskName
There apparently is no corresponding CP/M disk name.- Specified by:
getDiskName
in classFormattedDisk
- See Also:
-
getFormat
Identify the operating system format of this disk.- Specified by:
getFormat
in classFormattedDisk
- See Also:
-
getFreeSpace
public int getFreeSpace()Return the amount of free space in bytes.- Specified by:
getFreeSpace
in classFormattedDisk
- See Also:
-
getUsedSpace
public int getUsedSpace()Return the amount of used space in bytes.- Specified by:
getUsedSpace
in classFormattedDisk
- See Also:
-
getBlocksUsed
public int getBlocksUsed()Compute the number of CP/M blocks that are currently used. -
getBitmapDimensions
public int[] getBitmapDimensions()Get suggested dimensions for display of bitmap. Typically, this will be only used for 5.25" floppies. This can return null if there is no suggestion.- Specified by:
getBitmapDimensions
in classFormattedDisk
- See Also:
-
getBitmapLength
public int getBitmapLength()Get the length of the bitmap. This is hard-coded to 140.- Specified by:
getBitmapLength
in classFormattedDisk
- See Also:
-
getDiskUsage
Get the disk usage iterator.- Specified by:
getDiskUsage
in classFormattedDisk
- See Also:
-
getBitmapLabels
Get the labels to use in the bitmap.- Specified by:
getBitmapLabels
in classFormattedDisk
- See Also:
-
supportsDeletedFiles
public boolean supportsDeletedFiles()Indicates if this disk format supports "deleted" files.- Specified by:
supportsDeletedFiles
in classFormattedDisk
- See Also:
-
canReadFileData
public boolean canReadFileData()Indicates if this disk image can read data from a file.- Specified by:
canReadFileData
in classFormattedDisk
- See Also:
-
canWriteFileData
public boolean canWriteFileData()Indicates if this disk image can write data to a file.- Specified by:
canWriteFileData
in classFormattedDisk
- See Also:
-
canHaveDirectories
public boolean canHaveDirectories()Identify if this disk format is capable of having directories.- Specified by:
canHaveDirectories
in classFormattedDisk
- See Also:
-
canDeleteFile
public boolean canDeleteFile()Indicates if this disk image can delete a file.- Specified by:
canDeleteFile
in classFormattedDisk
- See Also:
-
getFileData
Get the data associated with the specified FileEntry. This is just the raw data. Use the FileEntry itself to read data appropriately!- Specified by:
getFileData
in classFormattedDisk
- See Also:
-
format
public void format()Format the disk. Simply wipes the disk to all 0xE5 - this seems to be the standard (or a requirement).Note: Assumes that this is a 140K CP/M disk of 35 tracks and 16 physical sectors.
- Specified by:
format
in classFormattedDisk
- See Also:
-
getLogicalDiskNumber
public int getLogicalDiskNumber()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.- Specified by:
getLogicalDiskNumber
in classFormattedDisk
- See Also:
-
getSuggestedFilename
Returns a valid filename for the given filename. The assumed rules are that the name must be 8 characters long (padded on the end with spaces) and alphanumeric, starting with a character.- Specified by:
getSuggestedFilename
in classFormattedDisk
- See Also:
-
getSuggestedFiletype
Returns a valid filetype for the given filename. Rules are very similar to the filename, but trim to 3 characters.- Specified by:
getSuggestedFiletype
in classFormattedDisk
- See Also:
-
getFiletypes
Returns a list of possible file types. Since the filetype is specific to each operating system, a simple String is used.- Specified by:
getFiletypes
in classFormattedDisk
- See Also:
-
needsAddress
Indicates if this filetype requires an address component.- Specified by:
needsAddress
in classFormattedDisk
- See Also:
-
getFiles
Answer with a list of file entries.- See Also:
-
createFile
Create a new FileEntry.- Throws:
DiskFullException
- See Also:
-
canCreateDirectories
public boolean canCreateDirectories()Identify if additional directories can be created. CP/M doesn't support directories.- See Also:
-
canCreateFile
public boolean canCreateFile()Indicates if this disk image can create a file.- See Also:
-
readCpmBlock
public byte[] readCpmBlock(int block) Read a CP/M block (1K in size). -
readCpmFileEntries
public byte[] readCpmFileEntries() -
writeCpmFileEntries
public void writeCpmFileEntries(byte[] data) -
computeTrack
protected int computeTrack(int block) Compute the physical track number. -
computeSector
protected int computeSector(int block) Compute the physical sector number. The rest of the block follows in sequential order. -
writeCpmBlock
public void writeCpmBlock(int block, byte[] data) Write a CP/M block. -
getFileColumnHeaders
Get the standard file column header information. This default implementation is intended only for standard mode.- Overrides:
getFileColumnHeaders
in classFormattedDisk
-
supportsDiskMap
public boolean supportsDiskMap()Indicates if this FormattedDisk supports a disk map.- Overrides:
supportsDiskMap
in classFormattedDisk
-
changeImageOrder
Change to a different ImageOrder. Remains in CP/M format but the underlying order can change.- Specified by:
changeImageOrder
in classFormattedDisk
- See Also:
-
setFileData
Writes the raw bytes into the file. This bypasses any special formatting of the data (such as prepending the data with a length and/or an address). Typically, the FileEntry.setFileData method should be used.- Specified by:
setFileData
in classFormattedDisk
- Throws:
DiskFullException
-
createDirectory
Create a new DirectoryEntry.- Throws:
DiskFullException
- See Also:
-
getDiskGeometry
Gives an indication on how this disk's geometry should be handled.- Specified by:
getDiskGeometry
in classFormattedDisk
-
toNativeFiletype
Provides conversation from a given ProDOS file type since as it is common across many archiving tools.- Specified by:
toNativeFiletype
in classFormattedDisk
-
toProdosFiletype
Provides conversation to a given ProDOS file type since as it is common across many archiving tools.- Specified by:
toProdosFiletype
in classFormattedDisk
-