public class WinDriver extends java.lang.Object implements DeviceDriver
Modifier and Type | Field and Description |
---|---|
protected MC68000Cpu |
cpu |
protected int |
deviceID |
protected WinDrive[] |
drives |
static int |
HEADER_LENGTH
Length of one file header.
|
protected java.lang.String[] |
nativeDir |
static int |
QLWA |
protected int |
usage |
protected Warnings |
warnings |
Constructor and Description |
---|
WinDriver(MC68000Cpu cpu,
Warnings warn)
Creates the driver object.
|
Modifier and Type | Method and Description |
---|---|
void |
closeAllFiles()
Closes all files opened by all drives of this device driver.
|
boolean |
closeFile(int driveNbr,
int fileID)
Closes the file.
|
boolean |
deleteFile(int driveNumber,
byte[] filename,
java.io.File file)
Deletes a file.
|
boolean |
formatMedium(java.lang.String formatName,
inifile.IniFile inifile)
Formats a medium.
|
int |
getDeviceID()
Gets this device's deviceID.
|
java.lang.String |
getName(int drive)
Gets the names of the native file used for one drive of the device.
|
java.lang.String[] |
getNames()
Gets the names of the native directories/files used for each drive of the device.
|
int |
getUsage()
This gets the usage name of the device.
|
boolean |
openFile(int devDriverLinkageBlock,
int channelDefinitionBlock,
int openType,
int driveNumber,
byte[] filename,
byte[] uncased)
Opens a file.
|
void |
setCpu(MC68000Cpu cpu)
Sets the cpu to be used.
|
void |
setFilenameChange(int change)
Changes the filename case.
|
boolean |
setNames(java.lang.String[] names,
inifile.IniFile inifile,
boolean forceRemove,
boolean suppressWarnings)
Sets the names for the native files containing the drives and creates the drive objects.
|
void |
setUsage(int usage)
This sets the usage name of the device, eg.
|
boolean |
trap3OK(int driveNumber,
int trapKey,
int channelDefinitionBlock,
int fileNbr)
Handles trap#3 calls (but should check first whether the trap#3 call is, indeed, for this device).
|
void |
writeBack(int driveNbr)
Writes the drive back to a native file
|
protected WinDrive[] drives
protected int deviceID
protected java.lang.String[] nativeDir
protected MC68000Cpu cpu
protected int usage
public static final int QLWA
protected Warnings warnings
public static final int HEADER_LENGTH
public WinDriver(MC68000Cpu cpu, Warnings warn)
cpu
- the cpu for this object.warn
- object with warning flags.public boolean openFile(int devDriverLinkageBlock, int channelDefinitionBlock, int openType, int driveNumber, byte[] filename, byte[] uncased)
openFile
in interface DeviceDriver
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.filename
- the (SMSQE) name of the file to open.uncased
- the lower cased (SMSQE) name of the file to open.public boolean closeFile(int driveNbr, int fileID)
closeFile
in interface DeviceDriver
driveNbr
- which drive number the file to be closed is on.fileID
- the file number (index into array).public boolean trap3OK(int driveNumber, int trapKey, int channelDefinitionBlock, int fileNbr)
DeviceDriver
All device drivers get called in turn for this operation, until one signals that it has handled the trap call. "Handling" the trap call does not mean that the trap call was completed successfully, it only means that the device driver signals that this trap call concerned a file for which it was,indeed, the appropriate driver.
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.
public boolean deleteFile(int driveNumber, byte[] filename, java.io.File file)
DeviceDriver
deleteFile
in interface DeviceDriver
driveNumber
- number of drive on which to delete the file.filename
- the name of the file to open.file
- the file to delete.true
if the file deleted.
This method MUST set the D0 register to signal success (or not) of the operation to SMSQE.
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 with initialized values.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 setNames(java.lang.String[] names, inifile.IniFile inifile, boolean forceRemove, boolean suppressWarnings)
setNames
in interface DeviceDriver
names
- an 8 element string array containing the native names of the container files for the drives.inifile
- the file with initialisation data.forceRemove
- = true if devices should be removed then remounted.suppressWarnings
- = true if warnings about absent etc. devices should be suppressed (e.g. in case of reset).true
if operation successful.public java.lang.String[] getNames()
DeviceDriver
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.
Individual elements may be null
or empty if the corresponding drive isn't assigned.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 void setUsage(int usage)
setUsage
in interface DeviceDriver
usage
- the usage name as an intpublic int getUsage()
getUsage
in interface DeviceDriver
public int getDeviceID()
getDeviceID
in interface DeviceDriver
public void setCpu(MC68000Cpu cpu)
setCpu
in interface DeviceDriver
cpu
- the cpu to use.public void setFilenameChange(int change)
setFilenameChange
in interface DeviceDriver
change
- unused herepublic void closeAllFiles()
DeviceDriver
closeAllFiles
in interface DeviceDriver
public void writeBack(int driveNbr)
writeBack
in interface DeviceDriver
driveNbr
- the drive number (1...8)