Package drivers.nxfa
Class XfaFile
java.lang.Object
drivers.nxfa.XfaFile
A file for an (X)FA device. Each SMSQE file should be mapped to one of these.
This implements files for the NFA and SFA devices.
In a dir, the file header contains at offset the length of the file including the length of the file header (=smsqmulator.Types.SMSEHeaderLength)
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final int
protected int
protected ByteBuffer
protected static String[]
protected int
protected File
protected String
protected int
protected int
protected int
protected XfaFileheader
protected int
protected FileChannel
protected boolean
protected String[]
protected File[]
protected RandomAccessFile
protected boolean
protected TimeZone
protected int
protected int
-
Constructor Summary
ConstructorsConstructorDescriptionXfaFile
(File file, String filename, boolean isDir, int driveNumber, String[] names, int deviceID, int filenameChange, int usageName, boolean useXTcc) Create a directory "file" for read only access.XfaFile
(RandomAccessFile aFile, FileChannel inoutChannel, boolean lockTheFile, File file, String filename, boolean isDir, int deviceID, int driveNumber, String[] names, int filenameChange, int usageName, boolean useXTcc) Creates this object for any file that isn't a dir file. -
Method Summary
Modifier and TypeMethodDescriptionvoid
close
(MC68000Cpu cpu) Close this file : release file locks, if any and flush headers.void
Flush the file header(write to disk).Get the name of the file.void
handleTrap3
(int trapKey, int channelDefinitionBlock, MC68000Cpu cpu, String nativeDir) This dispatches the file I/O routines (=SMSQE TRAP#3 routines).boolean
isIsDir()
Checks whether this file is a dir.void
setAsDir()
Signals that this file should be treated as a dir.
-
Field Details
-
raFile
-
inoutChannel
-
header
-
isDir
protected boolean isDir -
file
-
driveNumber
protected int driveNumber -
totalSize
protected int totalSize -
freeSize
protected int freeSize -
allocSize
protected static final int allocSize- See Also:
-
myFiles
-
myFileNames
-
filePosition
protected int filePosition -
driveNames
-
deviceID
protected int deviceID -
headerOffset
protected int headerOffset -
filename
-
readOnly
protected boolean readOnly -
filenameChange
protected int filenameChange -
usageName
protected int usageName -
timeZone
-
dirBuffer
-
-
Constructor Details
-
XfaFile
public XfaFile(RandomAccessFile aFile, FileChannel inoutChannel, boolean lockTheFile, File file, String filename, boolean isDir, int deviceID, int driveNumber, String[] names, int filenameChange, int usageName, boolean useXTcc) Creates this object for any file that isn't a dir file.- Parameters:
aFile
- ajava.io.RandomAccessFile
representing the true OS's file.inoutChannel
- ajava.nio.channels.FileChannel
for that file.lockTheFile
- should we lock this file( granting execlusive access)?file
- ajava.io.File
for the same file.filename
- the name of the file. This may be put to upper/lower case (NIY).isDir
- should befalse
.deviceID
- the deviceID of the driver.driveNumber
- the number of the drive (eg. 0 for xFA1_ etc).names
- the names of subdrs, if any.filenameChange
- type of filename change (0,1,2).usageName
- usage name for this device.useXTcc
-
-
XfaFile
public XfaFile(File file, String filename, boolean isDir, int driveNumber, String[] names, int deviceID, int filenameChange, int usageName, boolean useXTcc) throws DoNothingException Create a directory "file" for read only access.- Parameters:
file
- the file to use.filename
- its filename.isDir
- should be true.driveNumber
- the number of he drive on which this file is (starting at 0).names
- the names of the native dirs the "drives" point to.deviceID
- the deviceID of the driver.filenameChange
- type of filename change (0,1,2).usageName
- usage name for this device.useXTcc
- true if one should check for the XTcc flag that might be tacked onto the end of the file.- Throws:
DoNothingException
- if I can't read a directory file.
-
-
Method Details
-
close
Close this file : release file locks, if any and flush headers. The SMSQE close routine for ths driver handles releasing the cdb lock etc- Parameters:
cpu
- the CPU object used for executing the program.
-
handleTrap3
This dispatches the file I/O routines (=SMSQE TRAP#3 routines).- Parameters:
trapKey
- what kind of trap#3 are we dealing with?channelDefinitionBlock
- = A0cpu
- the CPU.nativeDir
- the name of hte native dir this file belongs to (necessary for renaming).
-
isIsDir
public boolean isIsDir()Checks whether this file is a dir.- Returns:
true
if this file is a dir,false
if not.
-
setAsDir
public void setAsDir()Signals that this file should be treated as a dir. -
flushHeader
public void flushHeader()Flush the file header(write to disk). -
getFilename
Get the name of the file.- Returns:
- the name of the file.
-