Interface TrackSectorDevice
- All Superinterfaces:
CapabilityProvider, Container, Device, HintProvider, InformationProvider
- All Known Implementing Classes:
BlockToTrackSectorAdapter, OrderedTrackSectorDevice, SkewedTrackSectorDevice, TrackSectorNibbleDevice
A TrackSectorDevice is any type of device that supports track and sector
geometry. Most of the time, this is a physical 5.25" floppy, but that can
be virtualized through various mechanisms, such as UniDOS.
Note that the read and write take logical sectors, and the device handles the translation (skewing) into physical sectors.
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptiondefault intcalculateRequiredSectors(int size) A handy/common function to calculate the number of sectors needed for the given size.default voidformat()Format a disk.Get information that describes the disk geometry.Get the sector order.default booleandefault voidperformRange(int track, int sector, int totalSectors, TriIntConsumer actionFn) A utility method that performs an operation across a range of sectors.default DataBufferreadRange(int track, int sector, int totalSectors) Read a range of sectors.default DataBufferreadSector(int track, int sector) Read a single sector from the disk.voidreadSector(int track, int sector, int offset, DataBuffer data) Read a single sector from the disk into the givenDataBufferat the given offset.default TrackSectorDevicerequest(SectorOrder sectorOrder) Request a track/sector device with the given sector ordering.default DataBuffersizeBuffer(DataBuffer dataBuffer) Size the givenDataBufferto be a multiple of the sector size.default voidwriteRange(int track, int sector, DataBuffer data) Write a range of sectors to the disk.voidwriteSector(int track, int sector, DataBuffer data) Write a single sector to the disk.Methods inherited from interface CapabilityProvider
canMethods inherited from interface HintProvider
isAnyMethods inherited from interface InformationProvider
information
-
Field Details
-
SECTOR_SIZE
static final int SECTOR_SIZE- See Also:
-
-
Method Details
-
getGeometry
TrackSectorDevice.Geometry getGeometry()Get information that describes the disk geometry. -
getSectorOrder
SectorOrder getSectorOrder()Get the sector order. -
request
Request a track/sector device with the given sector ordering. If the current device already supports the requested order, the same device will be returned. Otherwise, the correct skew will be identified and a wrapper device will be returned. -
is
- Specified by:
isin interfaceHintProvider
-
readSector
Read a single sector from the disk. -
readSector
Read a single sector from the disk into the givenDataBufferat the given offset. -
readRange
Read a range of sectors. -
writeSector
Write a single sector to the disk. -
writeRange
Write a range of sectors to the disk. Note that the data buffer is modified to be a multiple of sector size. -
performRange
A utility method that performs an operation across a range of sectors. Mostly reusable code for thereadRangeandwriteRangeoperations. -
sizeBuffer
Size the givenDataBufferto be a multiple of the sector size. -
calculateRequiredSectors
default int calculateRequiredSectors(int size) A handy/common function to calculate the number of sectors needed for the given size. -
format
default void format()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.
-