Klasse GCR

java.lang.Object
libsidplay.components.c1541.GCR

public final class GCR extends Object
Group Coded Recording.
Autor:
Ken Händel
  • Feldübersicht

    Felder
    Modifizierer und Typ
    Feld
    Beschreibung
    static final byte
    Begin of sector block header.
    private byte[]
    Complete disk image as GCR data.
    static final byte
    Begin of sector data header.
    private int
    Offset into GCR data, the start of the current GCR track data.
    private static final byte[]
    GCR to byte table.
    private static final int
    GCR byte size of a whole sector's data.
    private int
    Offset of the R/W head on the current track (bytes).
    private boolean
    Is a disk attached to the disk drive?
    static final int
    Number of tracks we emulate.
    static final int
    Number of bytes in one raw track.
    static final int
    Byte size of a whole sector.
    private static final byte[]
    Convert a nybble to GCR code.
  • Konstruktorübersicht

    Konstruktoren
    Konstruktor
    Beschreibung
    GCR()
     
  • Methodenübersicht

    Modifizierer und Typ
    Methode
    Beschreibung
    protected void
    Attach disk.
    private void
    convert4BytesToGCR(byte[] source, int srcPos, byte[] dest, int dstPos)
    Convert 4 bytes into the GCR coded form (5 bytes).
    private void
    convertGCRTo4Bytes(byte[] source, byte[] dest, int destPos)
    Convert 5-byte GCR code to 4-byte.
    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 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 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)
     

    Von Klasse geerbte Methoden java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Felddetails

    • MAX_GCR_TRACKS

      public static final int MAX_GCR_TRACKS
      Number of tracks we emulate.
      Siehe auch:
    • NUM_MAX_BYTES_TRACK

      public static final int NUM_MAX_BYTES_TRACK
      Number of bytes in one raw track.
      Siehe auch:
    • SECTOR_SIZE

      public static final int SECTOR_SIZE
      Byte size of a whole sector.
      Siehe auch:
    • GCR_SECTOR_SIZE_DATA_ONLY

      private static final int GCR_SECTOR_SIZE_DATA_ONLY
      GCR byte size of a whole sector's data.
      Siehe auch:
    • BLOCK_HEADER_START

      public static final byte BLOCK_HEADER_START
      Begin of sector block header.
      Siehe auch:
    • DATA_HEADER_START

      public static final byte DATA_HEADER_START
      Begin of sector data header.
      Siehe auch:
    • TO_GCR

      private static final byte[] TO_GCR
      Convert 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_GCR
      GCR to byte table.
    • data

      private byte[] data
      Complete disk image as GCR data.
    • dataPos

      private int dataPos
      Offset into GCR data, the start of the current GCR track data.
    • gcrHeadOffset

      private int gcrHeadOffset
      Offset of the R/W head on the current track (bytes).
    • isDiskAttached

      private boolean isDiskAttached
      Is 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 offset
      trackSize - 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 offset
      trackSize - track size
      byt - 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 track
      trackPos - track offset
      trackSize - 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 convert
      off - position of result
      track - track, where sector is located in
      sector - sector to convert
      diskID1 - first byte of the disk ID
      diskID2 - second byte of the disk ID
      errorCode - 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 source
      dest - resulting byte array
      dstPos - 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 array
      dstPos - position of the GCR data containing the sector the sector
      trackSize - 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 in
      sector - sector to search for
      trackSize - 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 position
      trackSize - 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 result
      destPos - 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 set
      oldTrackSize -
      currentTrackSize -