Class TrackSectorNibbleDevice

java.lang.Object
org.applecommander.device.TrackSectorNibbleDevice
All Implemented Interfaces:
CapabilityProvider, Device, TrackSectorDevice, HintProvider, Container

public class TrackSectorNibbleDevice extends Object implements TrackSectorDevice
  • Method Details

    • create

      public static TrackSectorDevice create(NibbleTrackReaderWriter trackReaderWriter, int sectorsPerTrack)
      Create a TrackSectorNibbleDevice. Device is not formatted but does not need to go through an identification routine (which would fail with a blank image).
    • identify

      public static Optional<TrackSectorDevice> identify(NibbleTrackReaderWriter trackReaderWriter)
      Brute force attempt to identify 13 or 16 sector tracks. Note we only test track 0. Also note, we can do much better -- but all the nibble stuff will need to be reconfigured to allow different prologs/epilogs per track*. This likely can enable reading early software protection schemes that just fiddled with those bytes. DOS likely got moved around, so that would be coupled with more flexibility in DOS. See the "experimenting/identifying-nibble-prolog-bytes" for some experimental work.

      Note: the variance in prolog/epilog can be super detailed, but it is unlikely a DOS clone has different prolog/epilog bytes per sector. Per track may be a bit over-the-top. Except, that it appears Ultima I may have used it. :-)

    • get

      public <T> Optional<T> get(Class<T> iface)
      Specified by:
      get in interface Container
    • is

      public boolean is(Hint hint)
      Specified by:
      is in interface HintProvider
    • can

      public boolean can(Capability capability)
      Specified by:
      can in interface CapabilityProvider
    • getGeometry

      public TrackSectorDevice.Geometry getGeometry()
      Specified by:
      getGeometry in interface TrackSectorDevice
    • information

      public List<Information> information()
    • locateField

      public static int locateField(int[] prolog, DataBuffer trackData, DataBuffer 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.

    • findSector

      public int findSector(DataBuffer trackData, int track, int sector)
    • readSector

      public DataBuffer readSector(int track, int sector)
      Specified by:
      readSector in interface TrackSectorDevice
    • writeSector

      public void writeSector(int track, int sector, DataBuffer data)
      Specified by:
      writeSector in interface TrackSectorDevice
    • format

      public void format()
      Description copied from interface: TrackSectorDevice
      Format a disk. For most disks, this is simply a wipe to all zeros. If this disk has extended format (such as nibble formats), this is the opportunity to write out that format.

      NOTE: Adapter type devices have to be cautious about what device is responsible about formatting. For example, a UniDOS disk is 2x400K volumes on an 800K block device -- if they defer formatting to the 800K block device, a format on one volume also wipes out the other (in this case, do not defer to the "parent"). However, if the block adapter contains a nibble-based TrackSectorDevice, the actual formatting needs to get to the nibble device so it can lay down sector markers and the rest of the track structure.

      Specified by:
      format in interface TrackSectorDevice