jmce - 1_02

jmce.sim
Interface Disk

All Superinterfaces:
Hardware, Peripheral
All Known Subinterfaces:
DiskCPM
All Known Implementing Classes:
AbstractDisk, DirDiskCPM, ImageDisk, ImageDiskCPM, MemoryDisk, NullDisk

public interface Disk
extends Peripheral

Interface to descibe a phisical disk. This interface define a phisical disk unit and permit all the basic operation like read,write,etc. to the phisical disk.

For historical reason the first track and head number is 0 and the first sector number is 1.

Data are moved to and from one buffer allocated from the disk and the function for read and write only specify the sector number.

Version:
1.01
Author:
Mario Viara

Field Summary
static int ERROR
          Deprecated.  
static int ERROR_SEEK
          Seek error.
static int ERROR_WRITE_PROTECT
          Error for disk write protect
 
Method Summary
 void dismount()
          Dismount the disk
 void format()
          Format a track
 byte[] getBuffer()
          Return one array used for data transfer.
 int getHead()
          Get the current head
 int getNumHead()
          Return the number of head
 int getNumSector()
          Return the number of sector
 int getNumTrack()
          Return the numebr of track
 boolean getReadOnly()
          Return true if the disk is r/o
 int getSector()
          Get the current sector
 int getSectorSize()
          Return the sector size in bytes
 int getTrack()
          Get the current track
 boolean isMounted()
          Retrun true if the disk is mounted.
 boolean mount()
          Mount the disk.
 int read()
          Read one sector.
 void setHead(int head)
          Set the head number
 void setNumHead(int head)
          Set the number of head.
 void setNumSector(int sector)
          Set the number of sector.
 void setNumTrack(int track)
          Set the number of track.
 void setReadOnly(boolean mode)
          Set the disk r/o
 void setSector(int sector)
          Set the sector number
 void setSectorSize(int v)
          Set the sector size in byte.
 void setTrack(int track)
          Set the track number
 int write()
          Write one sector.
 
Methods inherited from interface jmce.sim.Peripheral
idle, registerCPU
 
Methods inherited from interface jmce.sim.Hardware
addHardware, destroy, getHardware, getHardware, getHardware, getHardware, getHardwareCount, getHardwareInstances, getHardwareTree, getName, getParent, init, initSwing, removeHardware, removeHardware, reset, setHardware, setHardware, setName
 

Field Detail

ERROR

@Deprecated
static final int ERROR
Deprecated. 
Generic error on read / write

See Also:
Constant Field Values

ERROR_WRITE_PROTECT

static final int ERROR_WRITE_PROTECT
Error for disk write protect

Since:
1.01
See Also:
Constant Field Values

ERROR_SEEK

static final int ERROR_SEEK
Seek error.

Since:
1.01
See Also:
Constant Field Values
Method Detail

getSectorSize

int getSectorSize()
Return the sector size in bytes


getNumTrack

int getNumTrack()
Return the numebr of track


getNumSector

int getNumSector()
Return the number of sector


getNumHead

int getNumHead()
Return the number of head


setSectorSize

void setSectorSize(int v)
Set the sector size in byte.


setNumTrack

void setNumTrack(int track)
Set the number of track. Set the total number of track. vlaid track number are 0 to track -1.

Parameters:
track - - Number of track.

setNumSector

void setNumSector(int sector)
Set the number of sector. Set the toral number of sector. Valid sector number are 1 to sector.

Parameters:
sector - - Total number of sector.

setNumHead

void setNumHead(int head)
Set the number of head. Set the total number of head. Valid head number are 0 to head - 1.

Parameters:
head - - Number of head.

dismount

void dismount()
              throws SIMException
Dismount the disk

Throws:
SIMException

mount

boolean mount()
              throws SIMException
Mount the disk.

Returns:
true if the disk is correctly mounted.
Throws:
SIMException

isMounted

boolean isMounted()
Retrun true if the disk is mounted.


getBuffer

byte[] getBuffer()
Return one array used for data transfer. Is responsabity of the disk alloc one array of byte and use it for data transfer.

Returns:
The array for one sector.

read

int read()
         throws SIMException
Read one sector. The specified sector is readed form the disk and the data are moved in the allocated buffer.

Returns:
number of bytes readed.
Throws:
SIMException
See Also:
getBuffer()

write

int write()
          throws SIMException
Write one sector. Before to call this function data must be moved in the allocated buffer.

Returns:
number of bytes written.
Throws:
SIMException

format

void format()
            throws SIMException
Format a track

Throws:
SIMException

getSector

int getSector()
Get the current sector


getHead

int getHead()
Get the current head


getTrack

int getTrack()
Get the current track


setTrack

void setTrack(int track)
              throws SIMException
Set the track number

Throws:
SIMException

setSector

void setSector(int sector)
               throws SIMException
Set the sector number

Throws:
SIMException

setHead

void setHead(int head)
             throws SIMException
Set the head number

Throws:
SIMException

setReadOnly

void setReadOnly(boolean mode)
Set the disk r/o

Since:
1.01

getReadOnly

boolean getReadOnly()
Return true if the disk is r/o

Since:
1.01

jmce - 1_02