Package drivers.nxfa
Class XfaDriver
java.lang.Object
drivers.nxfa.XfaDriver
- All Implemented Interfaces:
DeviceDriver
The File Access device driver template class that allows SMSQE to access native files.
This should be extended by other drivers.
It implements 8 "drives" (xxx1_ to xxx8_) which point to native dirs.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected MC68000Cpu
protected int
protected int
protected boolean[][]
protected String[]
protected ByteBuffer
protected int
protected boolean
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
XfaDriver
(boolean useXTcc) Creates the object with a cpu. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Closes all files on all drives on this device.void
closeFile
(int driveNumber, int fileID) Closes the file.static final String
convertFilename
(String mainDir, String originalName) This is an attempt to handle smsqe filenames intelligently.static final String
convertFilename2
(String mainDir, String originalName) This is an attempt to handle smsqe filenames intelligently.boolean
deleteFile
(int driveNumber, byte[] fname, File file) Deletes a file.boolean
Return true if the device is a (native) directory.boolean
formatMedium
(String formatName, inifile.IniFile inifile) Formats a medium.int
Gets the device ID for this device, eg.getName
(int drive) Gets the name of the native directory used for one drive of the device, or the current usage name of the device.String[]
getNames()
Gets the names of the native directories used for each drive of the device.int
getUsage()
This gets the usage name of the device.static final String
This makes a filename with native file separators replacing the "_" where appropriate, ie where the "_" denotes a subdir and not simply a part of the filename.boolean
openFile
(int devDriverLinkageBlock, int channelDefinitionBlock, int openType, int driveNumber, byte[] fname, byte[] uncased) Opens a file.void
setCpu
(MC68000Cpu cpu) Sets the cpu used by the device driver.void
setDirname
(int driveNumber, String dirname) Sets the native dir this drive points to.void
setFilenameChange
(int change) This sets how a filename case should be changed (or not).boolean
Sets the names for the drivesvoid
setUsage
(int usage) This sets the usage name of the device, eg.void
trap3OK
(int driveNumber, int trapKey, int channelDefinitionBlock, int fileNbr) This checks whether a file is from this driver and if so returns it.void
writeBack
(int driveNbr) Writes the drive back to a native file
-
Field Details
-
deviceID
protected int deviceID -
nativeDir
-
cpu
-
fileNumber
protected boolean[][] fileNumber -
usage
protected int usage -
filenameChange
protected int filenameChange -
tempHeader
-
useXTcc
protected boolean useXTcc
-
-
Constructor Details
-
XfaDriver
protected XfaDriver(boolean useXTcc) Creates the object with a cpu.- Parameters:
useXTcc
-
-
-
Method Details
-
openFile
public boolean openFile(int devDriverLinkageBlock, int channelDefinitionBlock, int openType, int driveNumber, byte[] fname, byte[] uncased) Opens a file.- Specified by:
openFile
in interfaceDeviceDriver
- Parameters:
devDriverLinkageBlock
- pointer to the device driver linkage block (a3).channelDefinitionBlock
- pointer to the channel definition block (a0).openType
- which kind of open is requested? (0 - old exclusive, 1 old shared,2 new exclusive,3 new overwrite,4 open dir).driveNumber
- which drive number the file is to be opened on.fname
- the (SMSQE) name of the file to open.uncased
- the lower cased (SMSQE) name of the file to open.- Returns:
- true if open OK, false if not.
- See Also:
-
closeFile
public void closeFile(int driveNumber, int fileID) Closes the file. For an explanation of the parameters, see the DeviceDriver interface.- Specified by:
closeFile
in interfaceDeviceDriver
- Parameters:
driveNumber
- the drive on which the file to close lies.fileID
- ID (numbrer) of the file to close.- See Also:
-
formatMedium
Formats a medium. This will fail for sfa and nfa devices.- Specified by:
formatMedium
in interfaceDeviceDriver
- Parameters:
formatName
- the name to give to the formatted drive.inifile
- the ".ini" file object.- Returns:
true
if deviceID corresponded to this device,false
if not.This method MUST set the D0 register to signal success (or not) of the operation to SMSQE.
-
deleteFile
Deletes a file.- Parameters:
driveNumber
- number of drive on which to delete the file.fname
- the name of the file to delete..file
- the file to delete.- Returns:
true
if the file deleted.
-
setNames
public boolean setNames(String[] names, inifile.IniFile inifile, boolean forceRemoval, boolean suppressWarnings) Sets the names for the drives- Specified by:
setNames
in interfaceDeviceDriver
- Parameters:
names
- an 8 elements String array with the names.inifile
- the initialization object.forceRemoval
- true if files/drives should removed before being remounted, IGNORED here!suppressWarnings
- = true if warnings about absent etc. devices should be suppressed (e.g. in case of reset)s- Returns:
true
if deviceDriver name is for my device,false
if not.
-
setDirname
Sets the native dir this drive points to.- Parameters:
driveNumber
- number of drive to set dir for, starting at 0.dirname
- the name of the dir. NO CHECK IS MADE THAT THIS IS A VALID DIR!!!!!.
-
trap3OK
public void trap3OK(int driveNumber, int trapKey, int channelDefinitionBlock, int fileNbr) This checks whether a file is from this driver and if so returns it.- Specified by:
trap3OK
in interfaceDeviceDriver
- Parameters:
driveNumber
- number of drive on which to open the filetrapKey
- what kind of trap #3 is it?channelDefinitionBlock
- pointer to the SMSQE channel definition block (a0)fileNbr
- the file number given by the ddd when file was opened (A0+0x1e)- See Also:
-
setUsage
public void setUsage(int usage) This sets the usage name of the device, eg. "NFA_USE WIN"- Specified by:
setUsage
in interfaceDeviceDriver
- Parameters:
usage
- the usage name as an int
-
convertFilename
This is an attempt to handle smsqe filenames intelligently. The smsqe "_" separator may be part of a simple filename, but also of a directory.- Parameters:
mainDir
- the name of the main dir for this drive.originalName
- the original filename.- Returns:
- the converted filename as used by java.
-
convertFilename2
This is an attempt to handle smsqe filenames intelligently. The smsqe "_" separator may be part of a simple filename, but also of a directory.- Parameters:
mainDir
- the name of the main dir for this drive.originalName
- the original filename.- Returns:
- the converted filename as used by java.
-
makeName
This makes a filename with native file separators replacing the "_" where appropriate, ie where the "_" denotes a subdir and not simply a part of the filename.- Parameters:
subnames
- the array to convert : this contains all parts of the original filename that were separated by a "_".current
- pointer to first element of the array (name part) that isn't part of a subdir.- Returns:
- the complete filename.
-
setFilenameChange
public void setFilenameChange(int change) This sets how a filename case should be changed (or not).- Specified by:
setFilenameChange
in interfaceDeviceDriver
- Parameters:
change
- how a filename case should be changed (or not):- 0 = no change
- 1 = all to upper case
- 2 = all to lower case
-
getDeviceID
public int getDeviceID()Gets the device ID for this device, eg. SFA0.- Specified by:
getDeviceID
in interfaceDeviceDriver
- Returns:
- the device ID as int.
-
getNames
Gets the names of the native directories used for each drive of the device.In keeping with standard SMSQE practice, it is presumed throughout that each device may have 8 drives.
- Specified by:
getNames
in interfaceDeviceDriver
- Returns:
- A string array with the names, or
null
if the device ID wasn't mine.
-
closeAllFiles
public void closeAllFiles()Closes all files on all drives on this device.- Specified by:
closeAllFiles
in interfaceDeviceDriver
-
setCpu
Sets the cpu used by the device driver.- Specified by:
setCpu
in interfaceDeviceDriver
- Parameters:
cpu
- the cpu to be set.
-
getName
Gets the name of the native directory used for one drive of the device, or the current usage name of the device.In keeping with standard SMSQE practice, it is presumed throughout that each device may have 8 drives.
- Specified by:
getName
in interfaceDeviceDriver
- Parameters:
drive
- the drive (from 1 to 8) for which the name is to be obtained, or 0 if the current usage name is to be returned.- Returns:
- A string array with the name, or
null
if the device ID wasn't mine, or "" if the device ID was mine but the drive didn't exist..
-
getUsage
public int getUsage()This gets the usage name of the device.- Specified by:
getUsage
in interfaceDeviceDriver
- Returns:
- the usage name as an int, or 0 if this wasn't for this device
-
writeBack
public void writeBack(int driveNbr) Writes the drive back to a native file- Specified by:
writeBack
in interfaceDeviceDriver
- Parameters:
driveNbr
- the drive number (1...8)
-
deviceIsDir
public boolean deviceIsDir()Return true if the device is a (native) directory.- Specified by:
deviceIsDir
in interfaceDeviceDriver
- Returns:
- always true
-