Class NibbleOrder


  • public class NibbleOrder
    extends DosOrder
    Supports disk images stored in nibbilized DOS physical order.

    • Field Detail

      • readTranslateTable

        public int[] readTranslateTable
        The read translation table. Constructed from the write translate table. Used to decode a disk byte into a value from 0x00 to 0x3f which is further decoded...
    • Constructor Detail

      • NibbleOrder

        public NibbleOrder​(ByteArrayImageLayout diskImageManager)
        Construct a NibbleOrder.
    • Method Detail

      • readTrackData

        protected byte[] readTrackData​(int track)
        Read nibbilized track data.
      • writeTrackData

        protected void writeTrackData​(int track,
                                      byte[] trackData)
        Write nibbilized track data.
      • readSector

        public byte[] readSector​(int track,
                                 int dosSector)
                          throws java.lang.IllegalArgumentException
        Retrieve the specified sector. The primary source of information for this process is directly from Beneath Apple DOS, chapter 3.
        Overrides:
        readSector in class DosOrder
        Throws:
        java.lang.IllegalArgumentException
      • locateField

        protected int locateField​(int byte1,
                                  int byte2,
                                  int byte3,
                                  byte[] trackData,
                                  byte[] fieldData,
                                  int startingOffset)
        Locate a field on the track. These are identified by a 3 byte unique signature. Because of the way in which disk bytes are captured, we need to wrap around the track to ensure all sequences of bytes are accounted for.

        This method fills fieldData as well as returning the last position referenced in the track buffer.

      • decodeOddEven

        protected int decodeOddEven​(byte[] buffer,
                                    int offset)
        Decode odd-even bytes as stored on disk. The format will be in two bytes. They are stored as such:
             XX = 1d1d1d1d (odd data bits)
             YY = 1d1d1d1d (even data bits)
         
        XX is then shifted by a bit and ANDed with YY to get the data byte. See page 3-12 in Beneath Apple DOS for more information.
      • encodeOddEven

        protected void encodeOddEven​(byte[] buffer,
                                     int offset,
                                     int value)
        Encode odd-even bytes to be stored on disk. See decodeOddEven for the format.
        See Also:
        decodeOddEven(byte[], int)
      • writeSector

        public void writeSector​(int track,
                                int dosSector,
                                byte[] sectorData)
                         throws java.lang.IllegalArgumentException
        Write the specified sector.
        Overrides:
        writeSector in class DosOrder
        Throws:
        java.lang.IllegalArgumentException
      • getTracksPerDisk

        public int getTracksPerDisk()
        Answer with the number of tracks on this device.
        Overrides:
        getTracksPerDisk in class ImageOrder
      • getSectorsPerTrack

        public int getSectorsPerTrack()
        Answer with the number of sectors per track on this device.
        Overrides:
        getSectorsPerTrack in class ImageOrder
      • getBlocksOnDevice

        public int getBlocksOnDevice()
        Answer with the number of blocks on this device. This cannot be computed since the physical size relates to disk bytes (6+2 encoded) instead of a full 8-bit byte.
        Overrides:
        getBlocksOnDevice in class ImageOrder
      • format

        public void format()
        Format the media. Formatting at the ImageOrder level deals with low-level issues. A typical ordering just needs to have the image "wiped," and that is the assumed implementation. However, specialized orders - such as a nibbilized disk - need to lay down track and sector markers.
        Overrides:
        format in class ImageOrder