openMSX
Classes | Public Member Functions | Static Public Attributes | List of all members
openmsx::RawTrack Class Reference

#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< SectordecodeAll () const
 Get info on all sectors in this track.
 
std::optional< SectordecodeNextSector (unsigned startIdx) const
 Get the next sector (starting from a certain index).
 
std::optional< SectordecodeSector (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
 

Detailed Description

Definition at line 65 of file RawTrack.hh.

Constructor & Destructor Documentation

◆ RawTrack()

openmsx::RawTrack::RawTrack ( unsigned  size = STANDARD_SIZE)
explicit

Definition at line 13 of file RawTrack.cc.

References clear().

Member Function Documentation

◆ addIdam()

void openmsx::RawTrack::addIdam ( unsigned  idx)

Definition at line 24 of file RawTrack.cc.

Referenced by openmsx::DMKDiskImage::readTrack().

◆ applyWd2793ReadTrackQuirk()

void openmsx::RawTrack::applyWd2793ReadTrackQuirk ( )

Definition at line 190 of file RawTrack.cc.

References read(), and write().

Referenced by openmsx::RealDrive::applyWd2793ReadTrackQuirk().

◆ calcCrc()

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().

◆ clear()

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().

◆ decodeAll()

std::vector< RawTrack::Sector > openmsx::RawTrack::decodeAll ( ) const

Get info on all sectors in this track.

Definition at line 110 of file RawTrack.cc.

◆ decodeNextSector()

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().

◆ decodeSector()

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().

◆ getIdamBuffer()

const auto & openmsx::RawTrack::getIdamBuffer ( ) const
inline

Definition at line 119 of file RawTrack.hh.

◆ getLength()

unsigned openmsx::RawTrack::getLength ( ) const
inline

Get track length.

Definition at line 100 of file RawTrack.hh.

Referenced by openmsx::RealDrive::getNextSector(), and openmsx::RealDrive::getTrackLength().

◆ getRawBuffer() [1/2]

std::span< uint8_t > openmsx::RawTrack::getRawBuffer ( )
inline

Definition at line 117 of file RawTrack.hh.

Referenced by openmsx::DMKDiskImage::readTrack().

◆ getRawBuffer() [2/2]

std::span< const uint8_t > openmsx::RawTrack::getRawBuffer ( ) const
inline

Definition at line 118 of file RawTrack.hh.

◆ read()

uint8_t openmsx::RawTrack::read ( int  idx) const
inline

Definition at line 107 of file RawTrack.hh.

References wrapIndex().

Referenced by applyWd2793ReadTrackQuirk(), readBlock(), and openmsx::RealDrive::readTrackByte().

◆ readBlock()

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().

◆ serialize()

template<typename Archive >
void openmsx::RawTrack::serialize ( Archive &  ar,
unsigned  version 
)

Definition at line 265 of file RawTrack.cc.

◆ updateCrc()

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().

◆ wrapIndex()

int openmsx::RawTrack::wrapIndex ( int  idx) const
inline

Definition at line 109 of file RawTrack.hh.

Referenced by read(), updateCrc(), and write().

◆ write()

void openmsx::RawTrack::write ( int  idx,
uint8_t  val,
bool  setIdam = false 
)

◆ writeBlock()

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().

Member Data Documentation

◆ STANDARD_SIZE

constexpr unsigned openmsx::RawTrack::STANDARD_SIZE = 6250
staticconstexpr

The documentation for this class was generated from the following files: