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. More...
 
unsigned getLength () const
 Get track length. More...
 
void addIdam (unsigned idx)
 
byte read (int idx) const
 
void write (int idx, byte val, bool setIdam=false)
 
int wrapIndex (int idx) const
 
bytegetRawBuffer ()
 
const bytegetRawBuffer () const
 
const std::vector< unsigned > & getIdamBuffer () const
 
std::vector< SectordecodeAll () const
 Get info on all sectors in this track. More...
 
std::optional< SectordecodeNextSector (unsigned startIdx) const
 Get the next sector (starting from a certain index). More...
 
std::optional< SectordecodeSector (byte sectorNum) const
 Get a sector with a specific number. More...
 
void readBlock (int idx, span< byte > destination) const
 Like memcpy() but copy from/to circular buffer. More...
 
void writeBlock (int idx, span< const byte > source)
 
word calcCrc (int idx, int size) const
 Convenience method to calculate CRC for part of this track. More...
 
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 64 of file RawTrack.hh.

Constructor & Destructor Documentation

◆ RawTrack()

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

Definition at line 15 of file RawTrack.cc.

References clear(), and utf8::unchecked::size().

Member Function Documentation

◆ addIdam()

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

Definition at line 26 of file RawTrack.cc.

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

◆ applyWd2793ReadTrackQuirk()

void openmsx::RawTrack::applyWd2793ReadTrackQuirk ( )

Definition at line 192 of file RawTrack.cc.

References read(), and write().

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

◆ calcCrc()

word openmsx::RawTrack::calcCrc ( int  idx,
int  size 
) const

Convenience method to calculate CRC for part of this track.

Definition at line 185 of file RawTrack.cc.

References openmsx::CRC16::getValue(), utf8::unchecked::size(), and updateCrc().

◆ clear()

void openmsx::RawTrack::clear ( unsigned  size)

Clear track data.

Also sets the track length.

Definition at line 20 of file RawTrack.cc.

References utf8::unchecked::size().

Referenced by RawTrack(), and openmsx::DMKDiskImage::readTrack().

◆ decodeAll()

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

Get info on all sectors in this track.

Definition at line 112 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 134 of file RawTrack.cc.

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

◆ decodeSector()

std::optional< RawTrack::Sector > openmsx::RawTrack::decodeSector ( byte  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 145 of file RawTrack.cc.

Referenced by openmsx::DMKDiskImage::readSectorImpl(), and openmsx::DMKDiskImage::writeSectorImpl().

◆ getIdamBuffer()

const std::vector<unsigned>& openmsx::RawTrack::getIdamBuffer ( ) const
inline

Definition at line 117 of file RawTrack.hh.

◆ getLength()

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

Get track length.

Definition at line 99 of file RawTrack.hh.

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

◆ getRawBuffer() [1/2]

byte* openmsx::RawTrack::getRawBuffer ( )
inline

Definition at line 115 of file RawTrack.hh.

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

◆ getRawBuffer() [2/2]

const byte* openmsx::RawTrack::getRawBuffer ( ) const
inline

Definition at line 116 of file RawTrack.hh.

◆ read()

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

Definition at line 106 of file RawTrack.hh.

References wrapIndex().

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

◆ readBlock()

void openmsx::RawTrack::readBlock ( int  idx,
span< byte destination 
) const

Like memcpy() but copy from/to circular buffer.

Definition at line 159 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 266 of file RawTrack.cc.

◆ updateCrc()

void openmsx::RawTrack::updateCrc ( CRC16 crc,
int  idx,
int  size 
) const

Definition at line 172 of file RawTrack.cc.

References end(), utf8::unchecked::size(), openmsx::CRC16::update(), and wrapIndex().

Referenced by calcCrc().

◆ wrapIndex()

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

Definition at line 108 of file RawTrack.hh.

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

◆ write()

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

◆ writeBlock()

void openmsx::RawTrack::writeBlock ( int  idx,
span< const byte source 
)

Definition at line 165 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: