public final class GCR extends Object
Modifier and Type | Field and Description |
---|---|
static byte |
BLOCK_HEADER_START
Begin of sector block header.
|
static byte |
DATA_HEADER_START
Begin of sector data header.
|
static int |
MAX_GCR_TRACKS
Number of tracks we emulate.
|
static int |
NUM_MAX_BYTES_TRACK
Number of bytes in one raw track.
|
static int |
SECTOR_SIZE
Byte size of a whole sector.
|
Constructor and Description |
---|
GCR() |
Modifier and Type | Method and Description |
---|---|
protected void |
attach()
Attach disk.
|
protected void |
convertGCRToSector(byte[] dest,
int dstPos,
int trackSize)
Convert a GCR coded sector into bytes.
|
protected void |
convertSectorToGCR(byte[] sectorBytes,
int off,
int track,
int sector,
byte diskID1,
byte diskID2,
DOSErrorCodes errorCode)
Convert the contents of a disk sector to GCR coded bytes.
|
protected void |
detach()
Detach disk, reset GCR data.
|
protected int |
findSectorData(int sectorHeaderPos,
int trackSize)
Find sector GCR data starting at the sector header position.
|
protected int |
findSectorHeader(int track,
int sector,
int trackSize)
Search for the sector header of the given track and sector in the GCR
data.
|
protected byte[] |
getTrackData(int trackPos,
int trackSize)
Get GCR data of a whole track.
|
protected int |
readNextBit(int currentTrackSize) |
protected void |
reset()
Reset GCR data offset.
|
protected void |
setHalfTrack(int num,
int oldTrackSize,
int currentTrackSize)
Set the current GCR data track position.
|
protected void |
setTrackData(byte[] trackBytes,
int trackPos,
int trackSize)
Set GCR data of a whole track.
|
protected void |
setTrackData(int trackPos,
int trackSize,
byte byt)
Set GCR data of a whole track.
|
protected void |
writeNextBit(boolean value,
int currentTrackSize) |
public static final int MAX_GCR_TRACKS
public static final int NUM_MAX_BYTES_TRACK
public static final int SECTOR_SIZE
public static final byte BLOCK_HEADER_START
public static final byte DATA_HEADER_START
protected byte[] getTrackData(int trackPos, int trackSize)
trackPos
- track offsettrackSize
- track sizeprotected void setTrackData(int trackPos, int trackSize, byte byt)
trackPos
- track offsettrackSize
- track sizebyt
- GCR value to be used for the whole trackprotected void setTrackData(byte[] trackBytes, int trackPos, int trackSize)
trackBytes
- GCR data of a whole tracktrackPos
- track offsettrackSize
- track sizeprotected void attach()
protected void detach()
protected void reset()
protected void convertSectorToGCR(byte[] sectorBytes, int off, int track, int sector, byte diskID1, byte diskID2, DOSErrorCodes errorCode)
sectorBytes
- sector data to convertoff
- position of resulttrack
- track, where sector is located insector
- sector to convertdiskID1
- first byte of the disk IDdiskID2
- second byte of the disk IDerrorCode
- error codeprotected void convertGCRToSector(byte[] dest, int dstPos, int trackSize)
dest
- resulting GCR byte arraydstPos
- position of the GCR data containing the sector the sectortrackSize
- the track sizeprotected int findSectorHeader(int track, int sector, int trackSize)
track
- track where the sector is contained insector
- sector to search fortrackSize
- the track sizeprotected int findSectorData(int sectorHeaderPos, int trackSize)
sectorHeaderPos
- search start positiontrackSize
- the track sizeprotected int readNextBit(int currentTrackSize)
protected void writeNextBit(boolean value, int currentTrackSize)
protected final void setHalfTrack(int num, int oldTrackSize, int currentTrackSize)
num
- half-track to setoldTrackSize
- currentTrackSize
- Copyright © 2018 Ken Händel. All rights reserved.