Package drivers.win
Class WinDriver
java.lang.Object
drivers.win.WinDriver
- All Implemented Interfaces:
DeviceDriver
This is the device driver enabling SMSQmulator to read QXL.Win files.
It maintains a list of 8 drives.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Closes all files opened by all drives of this device driver.void
closeFile
(int driveNbr, int fileID) Closes the file.boolean
Return true if the device is a (native) directory.boolean
formatMedium
(String formatName, inifile.IniFile inifile) Formats a medium.int
Gets this device's deviceID.getName
(int drive) Gets the names of the native file used for one drive of the device.String[]
getNames()
Gets the names of the native files used for each drive of the device.static String[]
Gets the names of the native qxl.win type files.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 - not necessary for this driver.boolean
Sets the names for the native files containing the drives and creates the drive objects.void
setRemovableStatus
(int drive, boolean status) Sets the removable status of a win drivevoid
setUsage
(int usage) This sets the usage name of the device, eg.void
trap3OK
(int driveNumber, int trapKey, int channelDefinitionBlock, int fileNbr) Handles trap#3 I/O calls by calling the corresponding method on the drive.void
writeBack
(int driveNbr) Writes the drive back to a native file - not implemented.
-
Field Details
-
deviceID
protected int deviceID -
drives
-
nativeDir
-
cpu
-
usage
protected int usage -
QLWA
public static final int QLWA- See Also:
-
warnings
-
HEADER_LENGTH
public static final int HEADER_LENGTH- See Also:
-
-
Constructor Details
-
WinDriver
Creates the driver object.- Parameters:
warn
- object with warning flags.
-
-
Method Details
-
openFile
public boolean openFile(int devDriverLinkageBlock, int channelDefinitionBlock, int openType, int driveNumber, byte[] filename, 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.filename
- the (SMSQE) name of the file to open.uncased
- the lower cased (SMSQE) name of the file to open.- Returns:
- true if file opened ok.
-
closeFile
public void closeFile(int driveNbr, int fileID) Closes the file.- Specified by:
closeFile
in interfaceDeviceDriver
- Parameters:
driveNbr
- which drive number the file to be closed is on.fileID
- the file number (index into array). This does NOT indicate the success of the close call which is set in register D0.
-
trap3OK
public void trap3OK(int driveNumber, int trapKey, int channelDefinitionBlock, int fileNbr) Handles trap#3 I/O calls by calling the corresponding method on the drive.- Specified by:
trap3OK
in interfaceDeviceDriver
- Parameters:
driveNumber
- number of drive on which the file is supposed to be.trapKey
- 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 opoened (A0+0x1e)
-
formatMedium
Formats a medium. This creates the corresponding qxl.win file. Formatting fails if a file of that name exists.- Specified by:
formatMedium
in interfaceDeviceDriver
- Parameters:
formatName
- the name to give to the formatted drive. This MUST be at least 5 chars long, which is presumed and NOT checked here. TrapDispatcher has checked it.inifile
- the ".ini" file with initialized values.- 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.
-
setNames
public boolean setNames(String[] names, inifile.IniFile inifile, boolean forceRemove, boolean suppressWarnings) Sets the names for the native files containing the drives and creates the drive objects.- Specified by:
setNames
in interfaceDeviceDriver
- Parameters:
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).- Returns:
true
if operation successful.
-
getNames
Gets the names of the native files 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:
- An 8 elements string array with the names..
Individual elements may be
null
or empty if the corresponding drive isn't assigned.
-
getName
Gets the names of the native file used for one drive 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 with the name or "" if the drive name doesn't exist.
-
setUsage
public void setUsage(int usage) This sets the usage name of the device, eg. "WIN_USE QXL"- Specified by:
setUsage
in interfaceDeviceDriver
- Parameters:
usage
- the usage name as an int
-
getUsage
public int getUsage()This gets the usage name of the device.- Specified by:
getUsage
in interfaceDeviceDriver
- Returns:
- the usage name as an int.
-
getDeviceID
public int getDeviceID()Gets this device's deviceID.- Specified by:
getDeviceID
in interfaceDeviceDriver
- Returns:
- this device's deviceID.
-
setCpu
Sets the cpu to be used.- Specified by:
setCpu
in interfaceDeviceDriver
- Parameters:
cpu
- the cpu to use.
-
setFilenameChange
public void setFilenameChange(int change) Changes the filename case - not necessary for this driver.- Specified by:
setFilenameChange
in interfaceDeviceDriver
- Parameters:
change
- unused here
-
closeAllFiles
public void closeAllFiles()Closes all files opened by all drives of this device driver.- Specified by:
closeAllFiles
in interfaceDeviceDriver
-
writeBack
public void writeBack(int driveNbr) Writes the drive back to a native file - not implemented.- Specified by:
writeBack
in interfaceDeviceDriver
- Parameters:
driveNbr
- the drive number (1...8)
-
setRemovableStatus
public void setRemovableStatus(int drive, boolean status) Sets the removable status of a win drive- Parameters:
drive
-status
-
-
getNativeNames
Gets the names of the native qxl.win type files.- Returns:
-
deviceIsDir
public boolean deviceIsDir()Return true if the device is a (native) directory.- Specified by:
deviceIsDir
in interfaceDeviceDriver
- Returns:
- always false
-