Package libsidplay.components.c1541
Klasse GCR
java.lang.Object
libsidplay.components.c1541.GCR
Group Coded Recording.
- Autor:
- Ken Händel
-
Feldübersicht
FelderModifizierer und TypFeldBeschreibungstatic final byteBegin of sector block header.private byte[]Complete disk image as GCR data.static final byteBegin of sector data header.private intOffset into GCR data, the start of the current GCR track data.private static final byte[]GCR to byte table.private static final intGCR byte size of a whole sector's data.private intOffset of the R/W head on the current track (bytes).private booleanIs a disk attached to the disk drive?static final intNumber of tracks we emulate.static final intNumber of bytes in one raw track.static final intByte size of a whole sector.private static final byte[]Convert a nybble to GCR code. -
Konstruktorübersicht
Konstruktoren -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungprotected voidattach()Attach disk.private voidconvert4BytesToGCR(byte[] source, int srcPos, byte[] dest, int dstPos) Convert 4 bytes into the GCR coded form (5 bytes).private voidconvertGCRTo4Bytes(byte[] source, byte[] dest, int destPos) Convert 5-byte GCR code to 4-byte.protected voidconvertGCRToSector(byte[] dest, int dstPos, int trackSize) Convert a GCR coded sector into bytes.protected voidconvertSectorToGCR(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 voiddetach()Detach disk, reset GCR data.protected intfindSectorData(int sectorHeaderPos, int trackSize) Find sector GCR data starting at the sector header position.protected intfindSectorHeader(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 intreadNextBit(int currentTrackSize) protected voidreset()Reset GCR data offset.protected voidsetHalfTrack(int num, int oldTrackSize, int currentTrackSize) Set the current GCR data track position.protected voidsetTrackData(byte[] trackBytes, int trackPos, int trackSize) Set GCR data of a whole track.protected voidsetTrackData(int trackPos, int trackSize, byte byt) Set GCR data of a whole track.protected voidwriteNextBit(boolean value, int currentTrackSize)
-
Felddetails
-
MAX_GCR_TRACKS
public static final int MAX_GCR_TRACKSNumber of tracks we emulate.- Siehe auch:
-
NUM_MAX_BYTES_TRACK
public static final int NUM_MAX_BYTES_TRACKNumber of bytes in one raw track.- Siehe auch:
-
SECTOR_SIZE
public static final int SECTOR_SIZEByte size of a whole sector.- Siehe auch:
-
GCR_SECTOR_SIZE_DATA_ONLY
private static final int GCR_SECTOR_SIZE_DATA_ONLYGCR byte size of a whole sector's data.- Siehe auch:
-
BLOCK_HEADER_START
public static final byte BLOCK_HEADER_STARTBegin of sector block header.- Siehe auch:
-
DATA_HEADER_START
public static final byte DATA_HEADER_STARTBegin of sector data header.- Siehe auch:
-
TO_GCR
private static final byte[] TO_GCRConvert a nybble to GCR code.Nybble Code 0000 01010 0001 01011 0010 10010 0011 10011 0100 01110 0101 01111 0110 10110 0111 10111 1000 01001 1001 11001 1010 11010 1011 11011 1100 01101 1101 11101 1110 11110 1111 10101
-
FROM_GCR
private static final byte[] FROM_GCRGCR to byte table. -
data
private byte[] dataComplete disk image as GCR data. -
dataPos
private int dataPosOffset into GCR data, the start of the current GCR track data. -
gcrHeadOffset
private int gcrHeadOffsetOffset of the R/W head on the current track (bytes). -
isDiskAttached
private boolean isDiskAttachedIs a disk attached to the disk drive?
-
-
Konstruktordetails
-
GCR
public GCR()
-
-
Methodendetails
-
getTrackData
protected byte[] getTrackData(int trackPos, int trackSize) Get GCR data of a whole track.- Parameter:
trackPos- track offsettrackSize- track size- Gibt zurück:
- GCR data
-
setTrackData
protected void setTrackData(int trackPos, int trackSize, byte byt) Set GCR data of a whole track.- Parameter:
trackPos- track offsettrackSize- track sizebyt- GCR value to be used for the whole track
-
setTrackData
protected void setTrackData(byte[] trackBytes, int trackPos, int trackSize) Set GCR data of a whole track.- Parameter:
trackBytes- GCR data of a whole tracktrackPos- track offsettrackSize- track size
-
attach
protected void attach()Attach disk. -
detach
protected void detach()Detach disk, reset GCR data. -
reset
protected void reset()Reset GCR data offset. -
convertSectorToGCR
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. Input is a pre-formatted sector filled with 0x55 bytes (gap data).- Parameter:
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 code
-
convert4BytesToGCR
private void convert4BytesToGCR(byte[] source, int srcPos, byte[] dest, int dstPos) Convert 4 bytes into the GCR coded form (5 bytes).- Parameter:
source- byte array to convert containing 4 bytes.srcPos- position of sourcedest- resulting byte arraydstPos- position of dest
-
convertGCRToSector
protected void convertGCRToSector(byte[] dest, int dstPos, int trackSize) Convert a GCR coded sector into bytes.- Parameter:
dest- resulting GCR byte arraydstPos- position of the GCR data containing the sector the sectortrackSize- the track size
-
findSectorHeader
protected int findSectorHeader(int track, int sector, int trackSize) Search for the sector header of the given track and sector in the GCR data.- Parameter:
track- track where the sector is contained insector- sector to search fortrackSize- the track size- Gibt zurück:
- offset in the GCR data pointing to the sector or -1 (not found)
-
findSectorData
protected int findSectorData(int sectorHeaderPos, int trackSize) Find sector GCR data starting at the sector header position.- Parameter:
sectorHeaderPos- search start positiontrackSize- the track size- Gibt zurück:
- offset in the GCR data pointing to the sector data or -1 (not found)
-
convertGCRTo4Bytes
private void convertGCRTo4Bytes(byte[] source, byte[] dest, int destPos) Convert 5-byte GCR code to 4-byte.- Parameter:
source- source buffer containing the 5-byte GCR code.dest- target buffer to hold the resultdestPos- off set into the target buffer
-
readNextBit
protected int readNextBit(int currentTrackSize) -
writeNextBit
protected void writeNextBit(boolean value, int currentTrackSize) -
setHalfTrack
protected void setHalfTrack(int num, int oldTrackSize, int currentTrackSize) Set the current GCR data track position.- Parameter:
num- half-track to setoldTrackSize-currentTrackSize-
-