Class TrackSectorToBlockAdapter

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

public class TrackSectorToBlockAdapter extends Object implements BlockDevice
Provides a _very simple_ mapping from Track/Sectors to blocks. All sector skewing is expected to be handled in the TrackSectorDevice. As such, this device expects to map sectors in the given ("natural") order. (That is, ProDOS blocks are sectors 0,1 and 2,3 and 3,4 etc. RDOS is in physical order. CP/M is in CP/M's expected order.)
  • Constructor Details

  • Method Details

    • 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 BlockDevice.Geometry getGeometry()
      Specified by:
      getGeometry in interface BlockDevice
    • readBlock

      public DataBuffer readBlock(int block)
      Specified by:
      readBlock in interface BlockDevice
    • writeBlock

      public void writeBlock(int block, DataBuffer blockData)
      Specified by:
      writeBlock in interface BlockDevice
    • format

      public void format()
      Description copied from interface: BlockDevice
      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 BlockDevice