Package drivers.nxfa

Class XfaFile

java.lang.Object
drivers.nxfa.XfaFile

public class XfaFile extends Object
A file for an (X)FA device. Each SMSQE file should be mapped to one of these. This implements files for the NFA and SFA devices.

In a dir, the file header contains at offset the length of the file including the length of the file header (=smsqmulator.Types.SMSEHeaderLength)

  • Field Details

    • raFile

      protected RandomAccessFile raFile
    • inoutChannel

      protected FileChannel inoutChannel
    • isDir

      protected boolean isDir
    • file

      protected File file
    • driveNumber

      protected int driveNumber
    • totalSize

      protected int totalSize
    • freeSize

      protected int freeSize
    • allocSize

      protected static final int allocSize
      See Also:
    • myFiles

      protected File[] myFiles
    • myFileNames

      protected String[] myFileNames
    • filePosition

      protected int filePosition
    • driveNames

      protected static String[] driveNames
    • deviceID

      protected int deviceID
    • headerOffset

      protected int headerOffset
    • filename

      protected String filename
    • readOnly

      protected boolean readOnly
    • filenameChange

      protected int filenameChange
    • usageName

      protected int usageName
    • timeZone

      protected TimeZone timeZone
    • dirBuffer

      protected ByteBuffer dirBuffer
  • Constructor Details

    • XfaFile

      public XfaFile(RandomAccessFile aFile, FileChannel inoutChannel, boolean lockTheFile, File file, String filename, boolean isDir, int deviceID, int driveNumber, String[] names, int filenameChange, int usageName, boolean useXTcc)
      Creates this object for any file that isn't a dir file.
      Parameters:
      aFile - a java.io.RandomAccessFile representing the true OS's file.
      inoutChannel - a java.nio.channels.FileChannel for that file.
      lockTheFile - should we lock this file( granting execlusive access)?
      file - a java.io.File for the same file.
      filename - the name of the file. This may be put to upper/lower case (NIY).
      isDir - should be false.
      deviceID - the deviceID of the driver.
      driveNumber - the number of the drive (eg. 0 for xFA1_ etc).
      names - the names of subdrs, if any.
      filenameChange - type of filename change (0,1,2).
      usageName - usage name for this device.
      useXTcc -
    • XfaFile

      public XfaFile(File file, String filename, boolean isDir, int driveNumber, String[] names, int deviceID, int filenameChange, int usageName, boolean useXTcc) throws DoNothingException
      Create a directory "file" for read only access.
      Parameters:
      file - the file to use.
      filename - its filename.
      isDir - should be true.
      driveNumber - the number of he drive on which this file is (starting at 0).
      names - the names of the native dirs the "drives" point to.
      deviceID - the deviceID of the driver.
      filenameChange - type of filename change (0,1,2).
      usageName - usage name for this device.
      useXTcc - true if one should check for the XTcc flag that might be tacked onto the end of the file.
      Throws:
      DoNothingException - if I can't read a directory file.
  • Method Details

    • close

      public void close(MC68000Cpu cpu)
      Close this file : release file locks, if any and flush headers. The SMSQE close routine for ths driver handles releasing the cdb lock etc
      Parameters:
      cpu - the CPU object used for executing the program.
    • handleTrap3

      public void handleTrap3(int trapKey, int channelDefinitionBlock, MC68000Cpu cpu, String nativeDir)
      This dispatches the file I/O routines (=SMSQE TRAP#3 routines).
      Parameters:
      trapKey - what kind of trap#3 are we dealing with?
      channelDefinitionBlock - = A0
      cpu - the CPU.
      nativeDir - the name of hte native dir this file belongs to (necessary for renaming).
    • isIsDir

      public boolean isIsDir()
      Checks whether this file is a dir.
      Returns:
      true if this file is a dir, false if not.
    • setAsDir

      public void setAsDir()
      Signals that this file should be treated as a dir.
    • flushHeader

      public void flushHeader()
      Flush the file header(write to disk).
    • getFilename

      public String getFilename()
      Get the name of the file.
      Returns:
      the name of the file.