|
jmce - 1_02 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjmce.sim.AbstractHardware
jmce.sim.AbstractPeripheral
jmce.sim.disk.AbstractDisk
public abstract class AbstractDisk
Abstract implementation of Disk
.
Subclass must implements only the write
and
read
method to access the phisical disk and if
necessary can override the mount
and
dismount
method.
Field Summary | |
---|---|
protected byte[] |
buffer
Buffer for one sector |
protected int |
head
Disk current position |
protected boolean |
mounted
|
protected int |
numHead
|
protected int |
numSector
|
protected int |
numTrack
|
protected boolean |
readOnly
|
protected int |
sector
Disk current position |
protected int |
sectorSize
|
protected int |
track
Disk current position |
Fields inherited from class jmce.sim.AbstractPeripheral |
---|
cpu |
Fields inherited from interface jmce.sim.Disk |
---|
ERROR, ERROR_SEEK, ERROR_WRITE_PROTECT |
Constructor Summary | |
---|---|
AbstractDisk()
Default contructor. |
|
AbstractDisk(int track,
int head,
int sector,
int ssize)
Constructor with the specified geometry. |
Method Summary | |
---|---|
void |
dismount()
Dismount the disk |
void |
format()
Format one track. |
byte[] |
getBuffer()
Return one array used for data transfer. |
int |
getDiskSize()
|
java.lang.String |
getDiskSizeString()
|
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 read only. |
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. |
protected abstract int |
read(int pos)
Read one sector. |
int |
read(int track,
int head,
int sector)
|
void |
setHead(int head)
Set the head number |
protected boolean |
setMounted(boolean b)
|
void |
setNumHead(int h)
Set the number of head. |
void |
setNumSector(int s)
Set the number of sector. |
void |
setNumTrack(int t)
Set the number of track. |
void |
setReadOnly(boolean mode)
Set the read only status for the disk. |
void |
setSector(int sector)
Set the sector number |
void |
setSectorSize(int size)
Set the sector size in byte. |
void |
setTrack(int track)
Set the track number |
int |
write()
Write one sector. |
protected abstract int |
write(int pos)
Write one sector. |
int |
write(int track,
int head,
int sector)
|
Methods inherited from class jmce.sim.AbstractPeripheral |
---|
idle, registerCPU, setIdle, setLive |
Methods inherited from class jmce.sim.AbstractHardware |
---|
addHardware, createFrame, destroy, getHardware, getHardware, getHardware, getHardware, getHardware, getHardwareCount, getHardwareForName, getHardwareInstances, getHardwareTree, getName, getParent, init, initSwing, removeHardware, removeHardware, reset, setHardware, setHardware, setName, toString |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
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 |
---|
protected int numTrack
protected int numHead
protected int numSector
protected int sectorSize
protected boolean mounted
protected boolean readOnly
protected byte[] buffer
protected int track
protected int head
protected int sector
Constructor Detail |
---|
public AbstractDisk()
public AbstractDisk(int track, int head, int sector, int ssize)
track
- - Number of track.head
- - Number of head.sector
- - Number of sector.ssize
- - Sector size in bytes.Method Detail |
---|
public void setNumTrack(int t)
Disk
setNumTrack
in interface Disk
t
- - Number of track.public int getNumTrack()
Disk
getNumTrack
in interface Disk
public void setNumSector(int s)
Disk
setNumSector
in interface Disk
s
- - Total number of sector.public int getNumSector()
Disk
getNumSector
in interface Disk
public void setNumHead(int h)
Disk
setNumHead
in interface Disk
h
- - Number of head.public int getNumHead()
Disk
getNumHead
in interface Disk
public void setSectorSize(int size)
Disk
setSectorSize
in interface Disk
public byte[] getBuffer()
Disk
getBuffer
in interface Disk
public void dismount() throws SIMException
Disk
dismount
in interface Disk
SIMException
public boolean isMounted()
Disk
isMounted
in interface Disk
protected boolean setMounted(boolean b)
public boolean mount() throws SIMException
Disk
mount
in interface Disk
SIMException
public int read(int track, int head, int sector) throws SIMException
SIMException
public int read() throws SIMException
Disk
read
in interface Disk
SIMException
Disk.getBuffer()
public int write(int track, int head, int sector) throws SIMException
SIMException
public int write() throws SIMException
Disk
write
in interface Disk
SIMException
public int getSectorSize()
Disk
getSectorSize
in interface Disk
public int getSector()
Disk
getSector
in interface Disk
public int getHead()
Disk
getHead
in interface Disk
public int getTrack()
Disk
getTrack
in interface Disk
public void setHead(int head)
Disk
setHead
in interface Disk
public void setSector(int sector)
Disk
setSector
in interface Disk
public void setTrack(int track)
Disk
setTrack
in interface Disk
public void format() throws SIMException
format
in interface Disk
SIMException
protected abstract int write(int pos) throws SIMException
SIMException
protected abstract int read(int pos) throws SIMException
SIMException
public int getDiskSize()
public java.lang.String getDiskSizeString()
public boolean getReadOnly()
getReadOnly
in interface Disk
public void setReadOnly(boolean mode)
setReadOnly
in interface Disk
|
jmce - 1_02 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |