Class NibbleOrder
- java.lang.Object
-
- com.webcodepro.applecommander.storage.physical.ImageOrder
-
- com.webcodepro.applecommander.storage.physical.DosOrder
-
- com.webcodepro.applecommander.storage.physical.NibbleOrder
-
public class NibbleOrder extends DosOrder
Supports disk images stored in nibbilized DOS physical order.
-
-
Field Summary
Fields Modifier and Type Field Description int[]readTranslateTableThe read translation table.
-
Constructor Summary
Constructors Constructor Description NibbleOrder(ByteArrayImageLayout diskImageManager)Construct a NibbleOrder.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected intdecodeOddEven(byte[] buffer, int offset)Decode odd-even bytes as stored on disk.protected voidencodeOddEven(byte[] buffer, int offset, int value)Encode odd-even bytes to be stored on disk.voidformat()Format the media.intgetBlocksOnDevice()Answer with the number of blocks on this device.intgetSectorsPerTrack()Answer with the number of sectors per track on this device.intgetTracksPerDisk()Answer with the number of tracks on this device.protected intlocateField(int byte1, int byte2, int byte3, byte[] trackData, byte[] fieldData, int startingOffset)Locate a field on the track.byte[]readSector(int track, int dosSector)Retrieve the specified sector.protected byte[]readTrackData(int track)Read nibbilized track data.voidwriteSector(int track, int dosSector, byte[] sectorData)Write the specified sector.protected voidwriteTrackData(int track, byte[] trackData)Write nibbilized track data.-
Methods inherited from class com.webcodepro.applecommander.storage.physical.DosOrder
getName, getOffset, isBlockDevice, isTrackAndSectorDevice, readBlock, writeBlock
-
Methods inherited from class com.webcodepro.applecommander.storage.physical.ImageOrder
getDiskImageManager, getPhysicalSize, getSectorsPerDisk, isSizeApprox, readBytes, setDiskImageManager, writeBytes
-
-
-
-
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.IllegalArgumentExceptionRetrieve the specified sector. The primary source of information for this process is directly from Beneath Apple DOS, chapter 3.- Overrides:
readSectorin classDosOrder- 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.IllegalArgumentExceptionWrite the specified sector.- Overrides:
writeSectorin classDosOrder- Throws:
java.lang.IllegalArgumentException
-
getTracksPerDisk
public int getTracksPerDisk()
Answer with the number of tracks on this device.- Overrides:
getTracksPerDiskin classImageOrder
-
getSectorsPerTrack
public int getSectorsPerTrack()
Answer with the number of sectors per track on this device.- Overrides:
getSectorsPerTrackin classImageOrder
-
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:
getBlocksOnDevicein classImageOrder
-
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:
formatin classImageOrder
-
-