Package drivers.win

Class WinDriver

java.lang.Object
drivers.win.WinDriver
All Implemented Interfaces:
DeviceDriver

public class WinDriver extends Object implements DeviceDriver
This is the device driver enabling SMSQmulator to read QXL.Win files. It maintains a list of 8 drives.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected MC68000Cpu
     
    protected int
     
    protected WinDrive[]
     
    static final int
     
    protected static String[]
     
    static final int
     
    protected int
     
    protected Warnings
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates the driver object.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    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.
    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
    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
    Sets the cpu to be used.
    void
    setFilenameChange(int change)
    Changes the filename case - not necessary for this driver.
    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.
    void
    setRemovableStatus(int drive, boolean status)
    Sets the removable status of a win drive
    void
    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.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • deviceID

      protected int deviceID
    • drives

      protected WinDrive[] drives
    • nativeDir

      protected static String[] nativeDir
    • cpu

      protected MC68000Cpu cpu
    • usage

      protected int usage
    • QLWA

      public static final int QLWA
      See Also:
    • warnings

      protected Warnings warnings
    • HEADER_LENGTH

      public static final int HEADER_LENGTH
      See Also:
  • Constructor Details

    • WinDriver

      public WinDriver(Warnings warn)
      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 interface DeviceDriver
      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 interface DeviceDriver
      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 interface DeviceDriver
      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

      public boolean formatMedium(String formatName, inifile.IniFile inifile)
      Formats a medium. This creates the corresponding qxl.win file. Formatting fails if a file of that name exists.
      Specified by:
      formatMedium in interface DeviceDriver
      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 interface DeviceDriver
      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

      public String[] 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 interface DeviceDriver
      Returns:
      An 8 elements string array with the names.. Individual elements may be null or empty if the corresponding drive isn't assigned.
    • getName

      public String getName(int drive)
      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 interface DeviceDriver
      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 interface DeviceDriver
      Parameters:
      usage - the usage name as an int
    • getUsage

      public int getUsage()
      This gets the usage name of the device.
      Specified by:
      getUsage in interface DeviceDriver
      Returns:
      the usage name as an int.
    • getDeviceID

      public int getDeviceID()
      Gets this device's deviceID.
      Specified by:
      getDeviceID in interface DeviceDriver
      Returns:
      this device's deviceID.
    • setCpu

      public void setCpu(MC68000Cpu cpu)
      Sets the cpu to be used.
      Specified by:
      setCpu in interface DeviceDriver
      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 interface DeviceDriver
      Parameters:
      change - unused here
    • closeAllFiles

      public void closeAllFiles()
      Closes all files opened by all drives of this device driver.
      Specified by:
      closeAllFiles in interface DeviceDriver
    • writeBack

      public void writeBack(int driveNbr)
      Writes the drive back to a native file - not implemented.
      Specified by:
      writeBack in interface DeviceDriver
      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

      public static String[] 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 interface DeviceDriver
      Returns:
      always false