openMSX
|
#include <RawTrack.hh>
Classes | |
struct | Sector |
Public Member Functions | |
RawTrack (unsigned size=STANDARD_SIZE) | |
void | clear (unsigned size) |
Clear track data. | |
unsigned | getLength () const |
Get track length. | |
void | addIdam (unsigned idx) |
uint8_t | read (int idx) const |
void | write (int idx, uint8_t val, bool setIdam=false) |
int | wrapIndex (int idx) const |
std::span< uint8_t > | getRawBuffer () |
std::span< const uint8_t > | getRawBuffer () const |
const auto & | getIdamBuffer () const |
std::vector< Sector > | decodeAll () const |
Get info on all sectors in this track. | |
std::optional< Sector > | decodeNextSector (unsigned startIdx) const |
Get the next sector (starting from a certain index). | |
std::optional< Sector > | decodeSector (uint8_t sectorNum) const |
Get a sector with a specific number. | |
void | readBlock (int idx, std::span< uint8_t > destination) const |
Like memcpy() but copy from/to circular buffer. | |
void | writeBlock (int idx, std::span< const uint8_t > source) |
uint16_t | calcCrc (int idx, int size) const |
Convenience method to calculate CRC for part of this track. | |
void | updateCrc (CRC16 &crc, int idx, int size) const |
void | applyWd2793ReadTrackQuirk () |
template<typename Archive > | |
void | serialize (Archive &ar, unsigned version) |
Static Public Attributes | |
static constexpr unsigned | STANDARD_SIZE = 6250 |
Definition at line 65 of file RawTrack.hh.
|
explicit |
Definition at line 13 of file RawTrack.cc.
References clear().
void openmsx::RawTrack::addIdam | ( | unsigned | idx | ) |
Definition at line 24 of file RawTrack.cc.
Referenced by openmsx::DMKDiskImage::readTrack().
void openmsx::RawTrack::applyWd2793ReadTrackQuirk | ( | ) |
Definition at line 190 of file RawTrack.cc.
References read(), and write().
Referenced by openmsx::RealDrive::applyWd2793ReadTrackQuirk().
uint16_t openmsx::RawTrack::calcCrc | ( | int | idx, |
int | size | ||
) | const |
Convenience method to calculate CRC for part of this track.
Definition at line 183 of file RawTrack.cc.
References openmsx::CRC16::getValue(), and updateCrc().
void openmsx::RawTrack::clear | ( | unsigned | size | ) |
Clear track data.
Also sets the track length.
Definition at line 18 of file RawTrack.cc.
Referenced by RawTrack(), and openmsx::DMKDiskImage::readTrack().
std::vector< RawTrack::Sector > openmsx::RawTrack::decodeAll | ( | ) | const |
Get info on all sectors in this track.
Definition at line 110 of file RawTrack.cc.
std::optional< RawTrack::Sector > openmsx::RawTrack::decodeNextSector | ( | unsigned | startIdx | ) | const |
Get the next sector (starting from a certain index).
Definition at line 132 of file RawTrack.cc.
Referenced by openmsx::RealDrive::getNextSector().
std::optional< RawTrack::Sector > openmsx::RawTrack::decodeSector | ( | uint8_t | sectorNum | ) | const |
Get a sector with a specific number.
Note that if a sector with the same number occurs multiple times, this method will always return the same (the first) sector. So don't use it in the implementation of FDC / DiskDrive code.
Definition at line 143 of file RawTrack.cc.
Referenced by openmsx::DMKDiskImage::readSectorImpl(), and openmsx::DMKDiskImage::writeSectorImpl().
|
inline |
Definition at line 119 of file RawTrack.hh.
|
inline |
Get track length.
Definition at line 100 of file RawTrack.hh.
Referenced by openmsx::RealDrive::getNextSector(), and openmsx::RealDrive::getTrackLength().
|
inline |
Definition at line 117 of file RawTrack.hh.
Referenced by openmsx::DMKDiskImage::readTrack().
|
inline |
Definition at line 118 of file RawTrack.hh.
|
inline |
Definition at line 107 of file RawTrack.hh.
References wrapIndex().
Referenced by applyWd2793ReadTrackQuirk(), readBlock(), and openmsx::RealDrive::readTrackByte().
void openmsx::RawTrack::readBlock | ( | int | idx, |
std::span< uint8_t > | destination | ||
) | const |
Like memcpy() but copy from/to circular buffer.
Definition at line 157 of file RawTrack.cc.
References enumerate(), and read().
Referenced by openmsx::DMKDiskImage::readSectorImpl().
void openmsx::RawTrack::serialize | ( | Archive & | ar, |
unsigned | version | ||
) |
Definition at line 265 of file RawTrack.cc.
void openmsx::RawTrack::updateCrc | ( | CRC16 & | crc, |
int | idx, | ||
int | size | ||
) | const |
Definition at line 170 of file RawTrack.cc.
References end(), subspan(), openmsx::CRC16::update(), and wrapIndex().
Referenced by calcCrc().
|
inline |
Definition at line 109 of file RawTrack.hh.
Referenced by read(), updateCrc(), and write().
void openmsx::RawTrack::write | ( | int | idx, |
uint8_t | val, | ||
bool | setIdam = false |
||
) |
Definition at line 31 of file RawTrack.cc.
References end(), ranges::lower_bound(), and wrapIndex().
Referenced by applyWd2793ReadTrackQuirk(), writeBlock(), and openmsx::RealDrive::writeTrackByte().
void openmsx::RawTrack::writeBlock | ( | int | idx, |
std::span< const uint8_t > | source | ||
) |
Definition at line 163 of file RawTrack.cc.
References enumerate(), and write().
Referenced by openmsx::DMKDiskImage::writeSectorImpl().
|
staticconstexpr |
Definition at line 74 of file RawTrack.hh.
Referenced by openmsx::DummyDrive::getTrackLength(), openmsx::TC8566AF::TC8566AF(), and openmsx::WD2793::WD2793().