openMSX
Classes | Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
openmsx::RealDrive Class Referencefinal

This class implements a real drive, single or double sided. More...

#include <RealDrive.hh>

Inheritance diagram for openmsx::RealDrive:
Inheritance graph
[legend]
Collaboration diagram for openmsx::RealDrive:
Collaboration graph
[legend]

Public Types

using DrivesInUse = std::bitset< MAX_DRIVES >
 
- Public Types inherited from openmsx::DiskDrive
enum class  TrackMode { NORMAL , YAMAHA_FD_03 }
 

Public Member Functions

 RealDrive (MSXMotherBoard &motherBoard, EmuDuration::param motorTimeout, bool signalsNeedMotorOn, bool doubleSided, DiskDrive::TrackMode trackMode)
 
 ~RealDrive () override
 
bool isDiskInserted () const override
 Is drive ready? More...
 
bool isWriteProtected () const override
 Is disk write protected? More...
 
bool isDoubleSided () override
 Is disk double sided? More...
 
bool isTrack00 () const override
 Head above track 0. More...
 
void setSide (bool side) override
 Side select. More...
 
bool getSide () const override
 
void step (bool direction, EmuTime::param time) override
 Step head. More...
 
void setMotor (bool status, EmuTime::param time) override
 Set motor on/off. More...
 
bool getMotor () const override
 Returns the previously set motor status. More...
 
bool indexPulse (EmuTime::param time) override
 Gets the state of the index pulse. More...
 
EmuTime getTimeTillIndexPulse (EmuTime::param time, int count) override
 Return the time till the start of the next index pulse When there is no disk in the drive or when the disk is not spinning, this function returns the current time. More...
 
unsigned getTrackLength () override
 
void writeTrackByte (int idx, uint8_t val, bool addIdam) override
 
uint8_t readTrackByte (int idx) override
 
EmuTime getNextSector (EmuTime::param time, RawTrack::Sector &sector) override
 
void flushTrack () override
 
bool diskChanged () override
 Is disk changed? More...
 
bool peekDiskChanged () const override
 
bool isDummyDrive () const override
 Is there a dummy (unconnected) drive? More...
 
void applyWd2793ReadTrackQuirk () override
 See RawTrack::applyWd2793ReadTrackQuirk() More...
 
void invalidateWd2793ReadTrackQuirk () override
 
void getMediaInfo (TclObject &result) override
 This method gets called when information is required on the media inserted in the media slot of the provider. More...
 
template<typename Archive >
void serialize (Archive &ar, unsigned version)
 
- Public Member Functions inherited from openmsx::DiskDrive
virtual ~DiskDrive ()=default
 
virtual bool isDiskInserted () const =0
 Is drive ready? More...
 
virtual bool isWriteProtected () const =0
 Is disk write protected? More...
 
virtual bool isDoubleSided ()=0
 Is disk double sided? More...
 
virtual bool isTrack00 () const =0
 Head above track 0. More...
 
virtual void setSide (bool side)=0
 Side select. More...
 
virtual bool getSide () const =0
 
virtual void step (bool direction, EmuTime::param time)=0
 Step head. More...
 
virtual void setMotor (bool status, EmuTime::param time)=0
 Set motor on/off. More...
 
virtual bool getMotor () const =0
 Returns the previously set motor status. More...
 
virtual bool indexPulse (EmuTime::param time)=0
 Gets the state of the index pulse. More...
 
virtual EmuTime getTimeTillIndexPulse (EmuTime::param time, int count=1)=0
 Return the time till the start of the next index pulse When there is no disk in the drive or when the disk is not spinning, this function returns the current time. More...
 
virtual unsigned getTrackLength ()=0
 
virtual void writeTrackByte (int idx, uint8_t val, bool addIdam=false)=0
 
virtual uint8_t readTrackByte (int idx)=0
 
virtual EmuTime getNextSector (EmuTime::param time, RawTrack::Sector &sector)=0
 
virtual void flushTrack ()=0
 
virtual bool diskChanged ()=0
 Is disk changed? More...
 
virtual bool peekDiskChanged () const =0
 
virtual bool isDummyDrive () const =0
 Is there a dummy (unconnected) drive? More...
 
virtual void applyWd2793ReadTrackQuirk ()=0
 See RawTrack::applyWd2793ReadTrackQuirk() More...
 
virtual void invalidateWd2793ReadTrackQuirk ()=0
 
- Public Member Functions inherited from openmsx::MediaInfoProvider
 MediaInfoProvider (const MediaInfoProvider &)=delete
 
MediaInfoProvideroperator= (const MediaInfoProvider &)=delete
 
virtual void getMediaInfo (TclObject &result)=0
 This method gets called when information is required on the media inserted in the media slot of the provider. More...
 

Static Public Member Functions

static std::shared_ptr< DrivesInUsegetDrivesInUse (MSXMotherBoard &motherBoard)
 

Static Public Attributes

static constexpr unsigned MAX_DRIVES = 26
 
- Static Public Attributes inherited from openmsx::DiskDrive
static constexpr unsigned ROTATIONS_PER_SECOND = 5
 

Additional Inherited Members

- Protected Member Functions inherited from openmsx::MediaInfoProvider
 MediaInfoProvider ()=default
 
 ~MediaInfoProvider ()=default
 

Detailed Description

This class implements a real drive, single or double sided.

Definition at line 19 of file RealDrive.hh.

Member Typedef Documentation

◆ DrivesInUse

Definition at line 23 of file RealDrive.hh.

Constructor & Destructor Documentation

◆ RealDrive()

openmsx::RealDrive::RealDrive ( MSXMotherBoard motherBoard,
EmuDuration::param  motorTimeout,
bool  signalsNeedMotorOn,
bool  doubleSided,
DiskDrive::TrackMode  trackMode 
)

◆ ~RealDrive()

openmsx::RealDrive::~RealDrive ( )
override

Member Function Documentation

◆ applyWd2793ReadTrackQuirk()

void openmsx::RealDrive::applyWd2793ReadTrackQuirk ( )
overridevirtual

◆ diskChanged()

bool openmsx::RealDrive::diskChanged ( )
overridevirtual

Is disk changed?

Implements openmsx::DiskDrive.

Definition at line 472 of file RealDrive.cc.

◆ flushTrack()

void openmsx::RealDrive::flushTrack ( )
overridevirtual

Implements openmsx::DiskDrive.

Definition at line 460 of file RealDrive.cc.

Referenced by ~RealDrive().

◆ getDrivesInUse()

std::shared_ptr< RealDrive::DrivesInUse > openmsx::RealDrive::getDrivesInUse ( MSXMotherBoard motherBoard)
static

Definition at line 21 of file RealDrive.cc.

References openmsx::MSXMotherBoard::getSharedStuff().

Referenced by RealDrive().

◆ getMediaInfo()

void openmsx::RealDrive::getMediaInfo ( TclObject result)
overridevirtual

This method gets called when information is required on the media inserted in the media slot of the provider.

The provider must attach the info as a dictionary to the given TclObject.

Implements openmsx::MediaInfoProvider.

Definition at line 79 of file RealDrive.cc.

References openmsx::TclObject::addDictKeyValue(), openmsx::TclObject::addDictKeyValues(), openmsx::TclObject::addListElements(), openmsx::SectorAccessibleDisk::SECTOR_SIZE, and view::transform().

◆ getMotor()

bool openmsx::RealDrive::getMotor ( ) const
overridevirtual

Returns the previously set motor status.

Implements openmsx::DiskDrive.

Definition at line 295 of file RealDrive.cc.

◆ getNextSector()

EmuTime openmsx::RealDrive::getNextSector ( EmuTime::param  time,
RawTrack::Sector sector 
)
overridevirtual

◆ getSide()

bool openmsx::RealDrive::getSide ( ) const
overridevirtual

Implements openmsx::DiskDrive.

Definition at line 147 of file RealDrive.cc.

◆ getTimeTillIndexPulse()

EmuTime openmsx::RealDrive::getTimeTillIndexPulse ( EmuTime::param  time,
int  count 
)
overridevirtual

Return the time till the start of the next index pulse When there is no disk in the drive or when the disk is not spinning, this function returns the current time.

Parameters
timeThe current time
countNumber of required index pulses.

Implements openmsx::DiskDrive.

Definition at line 364 of file RealDrive.cc.

References openmsx::Clock< TICKS_PER_ROTATION *ROTATIONS_PER_SECOND >::duration(), and isDiskInserted().

◆ getTrackLength()

unsigned openmsx::RealDrive::getTrackLength ( )
overridevirtual

Implements openmsx::DiskDrive.

Definition at line 405 of file RealDrive.cc.

References openmsx::RawTrack::getLength().

◆ indexPulse()

bool openmsx::RealDrive::indexPulse ( EmuTime::param  time)
overridevirtual

Gets the state of the index pulse.

Parameters
timeThe moment in emulated time to get the pulse state for.

Implements openmsx::DiskDrive.

Definition at line 353 of file RealDrive.cc.

References isDiskInserted().

◆ invalidateWd2793ReadTrackQuirk()

void openmsx::RealDrive::invalidateWd2793ReadTrackQuirk ( )
overridevirtual

Implements openmsx::DiskDrive.

Definition at line 492 of file RealDrive.cc.

◆ isDiskInserted()

bool openmsx::RealDrive::isDiskInserted ( ) const
overridevirtual

Is drive ready?

Implements openmsx::DiskDrive.

Definition at line 108 of file RealDrive.cc.

Referenced by getTimeTillIndexPulse(), and indexPulse().

◆ isDoubleSided()

bool openmsx::RealDrive::isDoubleSided ( )
overridevirtual

Is disk double sided?

Implements openmsx::DiskDrive.

Definition at line 135 of file RealDrive.cc.

◆ isDummyDrive()

bool openmsx::RealDrive::isDummyDrive ( ) const
overridevirtual

Is there a dummy (unconnected) drive?

Implements openmsx::DiskDrive.

Definition at line 482 of file RealDrive.cc.

◆ isTrack00()

bool openmsx::RealDrive::isTrack00 ( ) const
overridevirtual

Head above track 0.

Implements openmsx::DiskDrive.

Definition at line 230 of file RealDrive.cc.

◆ isWriteProtected()

bool openmsx::RealDrive::isWriteProtected ( ) const
overridevirtual

Is disk write protected?

Implements openmsx::DiskDrive.

Definition at line 127 of file RealDrive.cc.

◆ peekDiskChanged()

bool openmsx::RealDrive::peekDiskChanged ( ) const
overridevirtual

Implements openmsx::DiskDrive.

Definition at line 477 of file RealDrive.cc.

◆ readTrackByte()

uint8_t openmsx::RealDrive::readTrackByte ( int  idx)
overridevirtual

Implements openmsx::DiskDrive.

Definition at line 420 of file RealDrive.cc.

References openmsx::RawTrack::read().

◆ serialize()

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

◆ setMotor()

void openmsx::RealDrive::setMotor ( bool  status,
EmuTime::param  time 
)
overridevirtual

Set motor on/off.

Parameters
statusfalse = off, true = on.
timeThe moment in emulated time this action takes place.

Implements openmsx::DiskDrive.

Definition at line 240 of file RealDrive.cc.

References openmsx::LoadingIndicator::update().

◆ setSide()

void openmsx::RealDrive::setSide ( bool  side)
overridevirtual

Side select.

Parameters
sidefalse = side 0, true = side 1.

Implements openmsx::DiskDrive.

Definition at line 141 of file RealDrive.cc.

◆ step()

void openmsx::RealDrive::step ( bool  direction,
EmuTime::param  time 
)
overridevirtual

Step head.

Parameters
directionfalse = out, true = in.
timeThe moment in emulated time this action takes place.

Implements openmsx::DiskDrive.

Definition at line 209 of file RealDrive.cc.

◆ writeTrackByte()

void openmsx::RealDrive::writeTrackByte ( int  idx,
uint8_t  val,
bool  addIdam 
)
overridevirtual

Implements openmsx::DiskDrive.

Definition at line 411 of file RealDrive.cc.

References openmsx::RawTrack::write().

Member Data Documentation

◆ MAX_DRIVES

constexpr unsigned openmsx::RealDrive::MAX_DRIVES = 26
staticconstexpr

Definition at line 22 of file RealDrive.hh.

Referenced by RealDrive().


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