Class CpmFileEntry
java.lang.Object
com.webcodepro.applecommander.storage.os.cpm.CpmFileEntry
- All Implemented Interfaces:
 FileEntry
Support the CP/M file entry.  Note that this may actually contain references
 to multiple file entries via the extent counter.
 
- 
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intThe number of bytes used if all records in an extent are filled.static final intBeginning of block allocations.List of known MBASIC/GBASIC/BASIC-80 filetypes.List of known filetypes that can be disassembled.static final intThe standard CP/M file entry length.static final intOffset to the extent counter (EX) field.static final intFilename length (excluding extension).static final intOffset to beginning of the filename.static final intFiletype length.static final intOffset to beginning of the filetype.static final intOffset to the filetype "T1" entry.static final intOffset to the filetype "T2" entry.static final intOffset to the filetype "T3" entry.static final intThe maximum number of extents per file entry record.static final intOffset to the record count (RC) field.A short collection of known text-type files.static final intThe user number (UU) field is to distinguish multiple files with the same filename. - 
Constructor Summary
Constructors - 
Method Summary
Modifier and TypeMethodDescriptionvoidaddOffset(int offset) Add another directory offset to this file entry.voiddelete()There appears to be no disk map involved, so deleting a file consists of writing a 0xe5 to the user number.protected intLocate the largest extent for this file.intGet the address that this file loads at.int[]Answer with a list of blocks allocated to this file.intCompute the number of blocks used.intgetExtentCounterLow(int entryNumber) Read the extent number, low byte.getFileColumnData(int displayMode) Get the standard file column header information.byte[]Get file data.Answer with the name of the file.Answer with the filetype.bytegetFileTypeT1(int entryNumber) Read the file type T1 entry.bytegetFileTypeT2(int entryNumber) Read the file type T2 entry.bytegetFileTypeT3(int entryNumber) Read the file type T3 entry.Answer with the formatted disk.intAnswer with the maximum filename length.intgetNumberOfRecordsUsed(int entryNumber) Return the number of records used in this extent, low byte.intgetSize()Compute the size of this file (in bytes).Get the suggested FileFilter.intgetUserNumber(int entryNumber) Return the user number (UU).booleanIndicates if this fileEntry is a deleted file.booleanApple CP/M does not support directories.booleanisEmpty()Indicates if this is an empty file entry.booleanisLocked()Indicates if this file is locked.booleanIndicates if this filetype requires an address component.protected byte[]readFileEntry(int number) Read the fileEntry bytes from the disk image.voidsetAddress(int address) Set the address that this file loads at.voidsetFileData(byte[] data) Set file data.voidsetFilename(String filename) Set the filename.voidsetFiletype(String filetype) Set the filetype.voidsetFileTypeT1(int entryNumber, int t1) Write the file type T1 entry.voidsetFileTypeT2(int entryNumber, int t2) Write the file type T2 entry.voidsetFileTypeT3(int entryNumber, int t3) Write the file type T3 entry.voidsetLocked(boolean lock) Set the locked status.voidsetUserNumber(int entryNumber, int userNumber) Write the user number (UU).protected voidwriteFileEntry(int number, byte[] entry) Write the fileEntry bytes back to the disk image. 
- 
Field Details
- 
ENTRY_LENGTH
public static final int ENTRY_LENGTHThe standard CP/M file entry length.- See Also:
 
 - 
MAX_EXTENTS_PER_ENTRY
public static final int MAX_EXTENTS_PER_ENTRYThe maximum number of extents per file entry record.- See Also:
 
 - 
ALL_RECORDS_FILLED_SIZE
public static final int ALL_RECORDS_FILLED_SIZEThe number of bytes used if all records in an extent are filled. (MAX_EXTENTS_PER_ENTRY * CPM_SECTOR_SIZE)- See Also:
 
 - 
USER_NUMBER_OFFSET
public static final int USER_NUMBER_OFFSETThe user number (UU) field is to distinguish multiple files with the same filename. This appears to be primarily with deleted files?- See Also:
 
 - 
FILENAME_OFFSET
public static final int FILENAME_OFFSETOffset to beginning of the filename.- See Also:
 
 - 
FILENAME_LENGTH
public static final int FILENAME_LENGTHFilename length (excluding extension).- See Also:
 
 - 
FILETYPE_OFFSET
public static final int FILETYPE_OFFSETOffset to beginning of the filetype.- See Also:
 
 - 
FILETYPE_LENGTH
public static final int FILETYPE_LENGTHFiletype length.- See Also:
 
 - 
FILETYPE_T1_OFFSET
public static final int FILETYPE_T1_OFFSETOffset to the filetype "T1" entry. Indicates read-only.- See Also:
 
 - 
FILETYPE_T2_OFFSET
public static final int FILETYPE_T2_OFFSETOffset to the filetype "T2" entry. Indicates system or hidden file.- See Also:
 
 - 
FILETYPE_T3_OFFSET
public static final int FILETYPE_T3_OFFSETOffset to the filetype "T3" entry. Backup bit (CP/M 3.1 and later).- See Also:
 
 - 
EXTENT_COUNTER_OFFSET
public static final int EXTENT_COUNTER_OFFSETOffset to the extent counter (EX) field.- See Also:
 
 - 
RECORD_COUNT_OFFSET
public static final int RECORD_COUNT_OFFSETOffset to the record count (RC) field.- See Also:
 
 - 
ALLOCATION_OFFSET
public static final int ALLOCATION_OFFSETBeginning of block allocations.- See Also:
 
 - 
TEXT_FILETYPES
A short collection of known text-type files. - 
BASIC_FILETYPES
List of known MBASIC/GBASIC/BASIC-80 filetypes. - 
DISASSEMBLY_FILETYPES
List of known filetypes that can be disassembled. 
 - 
 - 
Constructor Details
- 
CpmFileEntry
Construct a CP/M file entry. 
 - 
 - 
Method Details
- 
addOffset
public void addOffset(int offset) Add another directory offset to this file entry. - 
readFileEntry
protected byte[] readFileEntry(int number) Read the fileEntry bytes from the disk image. - 
writeFileEntry
protected void writeFileEntry(int number, byte[] entry) Write the fileEntry bytes back to the disk image. - 
getFilename
Answer with the name of the file. Note that CP/M doesn't really support filetype, so the extension portion of the name is also the filetype.- Specified by:
 getFilenamein interfaceFileEntry- See Also:
 
 - 
setFilename
Set the filename. Note that this assumes the file extension is completely separate and does not validate characters that are being set!- Specified by:
 setFilenamein interfaceFileEntry- See Also:
 
 - 
getFiletype
Answer with the filetype.- Specified by:
 getFiletypein interfaceFileEntry- See Also:
 
 - 
setFiletype
Set the filetype. Note that the highbits need to be preserved.- Specified by:
 setFiletypein interfaceFileEntry- See Also:
 
 - 
isLocked
public boolean isLocked()Indicates if this file is locked. - 
getFileTypeT1
public byte getFileTypeT1(int entryNumber) Read the file type T1 entry. This is the 1st character of the file type and the high bit indicates read-only. - 
setFileTypeT1
public void setFileTypeT1(int entryNumber, int t1) Write the file type T1 entry. - 
getFileTypeT2
public byte getFileTypeT2(int entryNumber) Read the file type T2 entry. This is the 2nd character of the file type and the high bit indicates a system or hidden file. - 
setFileTypeT2
public void setFileTypeT2(int entryNumber, int t2) Write the file type T2 entry. - 
getFileTypeT3
public byte getFileTypeT3(int entryNumber) Read the file type T3 entry. This is the 3rd character of the file type and the high bit is the backup bit (CP/M 3.1 and later). - 
setFileTypeT3
public void setFileTypeT3(int entryNumber, int t3) Write the file type T3 entry. - 
setLocked
public void setLocked(boolean lock) Set the locked status. This is interpreted as read-only. - 
getExtentCounterLow
public int getExtentCounterLow(int entryNumber) Read the extent number, low byte. - 
getSize
public int getSize()Compute the size of this file (in bytes). - 
findLargestExtent
protected int findLargestExtent()Locate the largest extent for this file. - 
getBlocksUsed
public int getBlocksUsed()Compute the number of blocks used. - 
getNumberOfRecordsUsed
public int getNumberOfRecordsUsed(int entryNumber) Return the number of records used in this extent, low byte. 1 record = 128 bytes. - 
isDirectory
public boolean isDirectory()Apple CP/M does not support directories.- Specified by:
 isDirectoryin interfaceFileEntry- See Also:
 
 - 
isDeleted
public boolean isDeleted()Indicates if this fileEntry is a deleted file. - 
getUserNumber
public int getUserNumber(int entryNumber) Return the user number (UU). 0-15 on Apple CP/M (can range to 31 on some systems). The user number allows multiple files with the same name to coexist on the disk. Apparently, this is used in conjunction with deleted files. - 
setUserNumber
public void setUserNumber(int entryNumber, int userNumber) Write the user number (UU). - 
delete
public void delete()There appears to be no disk map involved, so deleting a file consists of writing a 0xe5 to the user number. - 
getFileColumnData
Get the standard file column header information. This default implementation is intended only for standard mode. displayMode is specified in FormattedDisk.- Specified by:
 getFileColumnDatain interfaceFileEntry
 - 
getFileData
public byte[] getFileData()Get file data. This handles any operating-system specific issues.- Specified by:
 getFileDatain interfaceFileEntry- See Also:
 
 - 
setFileData
public void setFileData(byte[] data) Set file data. This, essentially, is saving data to disk using this file entry.- Specified by:
 setFileDatain interfaceFileEntry- See Also:
 
 - 
getSuggestedFilter
Get the suggested FileFilter. This is a guess based on what appears to be text-based files.- Specified by:
 getSuggestedFilterin interfaceFileEntry- See Also:
 
 - 
getFormattedDisk
Answer with the formatted disk.- Specified by:
 getFormattedDiskin interfaceFileEntry- See Also:
 
 - 
getMaximumFilenameLength
public int getMaximumFilenameLength()Answer with the maximum filename length.- Specified by:
 getMaximumFilenameLengthin interfaceFileEntry- See Also:
 
 - 
needsAddress
public boolean needsAddress()Indicates if this filetype requires an address component.- Specified by:
 needsAddressin interfaceFileEntry- See Also:
 
 - 
setAddress
public void setAddress(int address) Set the address that this file loads at.- Specified by:
 setAddressin interfaceFileEntry- See Also:
 
 - 
getAddress
public int getAddress()Get the address that this file loads at.- Specified by:
 getAddressin interfaceFileEntry
 - 
isEmpty
public boolean isEmpty()Indicates if this is an empty file entry. An empty file entry contains all 0xE5. - 
getAllocations
public int[] getAllocations()Answer with a list of blocks allocated to this file. 
 -