public class XfaDriver extends java.lang.Object implements DeviceDriver
Modifier and Type | Field and Description |
---|---|
protected MC68000Cpu |
cpu |
protected int |
deviceID |
protected int |
filenameChange |
protected boolean[][] |
fileNumber |
protected java.lang.String[] |
nativeDir |
protected java.nio.ByteBuffer |
tempHeader |
protected int |
usage |
Constructor and Description |
---|
XfaDriver(MC68000Cpu cpu)
Creates the object with a cpu.
|
Modifier and Type | Method and Description |
---|---|
void |
closeAllFiles()
Closes all files on all drives on this device.
|
boolean |
closeFile(int driveNumber,
int fileID)
Closes the file.
|
static java.lang.String |
convertFilename(java.lang.String mainDir,
java.lang.String originalName)
This is an attempt to handle smsqe filenames intelligently.
|
boolean |
deleteFile(int driveNumber,
byte[] fname,
java.io.File file)
Deletes a file.
|
boolean |
formatMedium(java.lang.String formatName,
inifile.IniFile inifile)
Formats a medium.
|
int |
getDeviceID()
Gets the device ID for this device, eg.
|
java.lang.String |
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.
|
java.lang.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 java.lang.String |
makeName(java.lang.String[] subnames,
int current)
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,
java.lang.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 |
setNames(java.lang.String[] names,
inifile.IniFile inifile,
boolean forceRemoval,
boolean suppressWarnings)
Sets the names for the drives
|
void |
setUsage(int usage)
This sets the usage name of the device, eg.
|
boolean |
trap3OK(int driveNumber,
int trapKey,
int channelDefinitionBlock,
int fileNbr)
This checks whether a file is from this driver and if so returns it (if it exists).
|
void |
writeBack(int driveNbr)
Writes the drive back to a native file
|
protected int deviceID
protected java.lang.String[] nativeDir
protected MC68000Cpu cpu
protected boolean[][] fileNumber
protected int usage
protected int filenameChange
protected java.nio.ByteBuffer tempHeader
public XfaDriver(MC68000Cpu cpu)
cpu
- the cpu the object refers to for I/O operations and more.public boolean openFile(int devDriverLinkageBlock, int channelDefinitionBlock, int openType, int driveNumber, byte[] fname, byte[] uncased)
openFile
in interface DeviceDriver
devDriverLinkageBlock
- pointer to the device driver linkage block (a3).channelDefinitionBlock
- pointer to the channel defintiion 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 drivenumver 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.DeviceDriver for more information on file open operations.
public boolean closeFile(int driveNumber, int fileID)
closeFile
in interface DeviceDriver
driveNumber
- the drive on which the file to close lies.fileID
- ID (numbrer) of the file to close.For an explanation of the parameters, see the DeviceDriver class.
public boolean formatMedium(java.lang.String formatName, inifile.IniFile inifile)
formatMedium
in interface DeviceDriver
formatName
- the name to give to the formatted drive.inifile
- the ".ini" file object.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.
public boolean deleteFile(int driveNumber, byte[] fname, java.io.File file)
deleteFile
in interface DeviceDriver
fname
- the name of the file to delete..driveNumber
- number of drive on which to delete the file.file
- the file to delete.true
if the file deleted.public boolean setNames(java.lang.String[] names, inifile.IniFile inifile, boolean forceRemoval, boolean suppressWarnings)
setNames
in interface DeviceDriver
names
- an 8 elements String array with the names.inifile
- the initialization object.suppressWarnings
- = true if warnings about absent etc. devices should be suppressed (e.g. in case of reset)sforceRemoval
- true if files/drives should removed before being remounted, IGNORED here!true
if deviceDriver name is for my device, false
if not.public void setDirname(int driveNumber, java.lang.String dirname)
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!!!!!.public boolean trap3OK(int driveNumber, int trapKey, int channelDefinitionBlock, int fileNbr)
For params see info at :
trap3OK
in interface DeviceDriver
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)true
if file was for this device, else false
. This says nothing about the success of the trap #3
operation in itself, it only shows that the device driver recognized that this I/O operation was for a file on one of its drives.
This method MUST set the D0 register to signal success (or not) of the operation to SMSQE.
DeviceDriver.trap3OK(int driveNumber,int trapKey,int channelDefinitionBlock,int fileNbr)
public void setUsage(int usage)
setUsage
in interface DeviceDriver
usage
- the usage name as an intpublic static final java.lang.String convertFilename(java.lang.String mainDir, java.lang.String originalName)
mainDir
- the name of the main dir for this drive.originalName
- the original filename.public static final java.lang.String makeName(java.lang.String[] subnames, int current)
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.public void setFilenameChange(int change)
setFilenameChange
in interface DeviceDriver
change
- how a filename case should be changed (or not):
public int getDeviceID()
getDeviceID
in interface DeviceDriver
public java.lang.String[] getNames()
In keeping with standard SMSQE practice, it is presumed throughout that each device may have 8 drives.
getNames
in interface DeviceDriver
null
if the device ID wasn't mine.public void closeAllFiles()
closeAllFiles
in interface DeviceDriver
public void setCpu(MC68000Cpu cpu)
setCpu
in interface DeviceDriver
cpu
- the cpu to be set.public java.lang.String getName(int drive)
In keeping with standard SMSQE practice, it is presumed throughout that each device may have 8 drives.
getName
in interface DeviceDriver
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.null
if the device ID wasn't mine, or "" if the device ID was mine but the drive didn't exist..public int getUsage()
getUsage
in interface DeviceDriver
public void writeBack(int driveNbr)
writeBack
in interface DeviceDriver
driveNbr
- the drive number (1...8)