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?
 
bool isWriteProtected () const override
 Is disk write protected?
 
bool isDoubleSided () override
 Is disk double sided?
 
bool isTrack00 () const override
 Head above track 0.
 
void setSide (bool side) override
 Side select.
 
bool getSide () const override
 
void step (bool direction, EmuTime::param time) override
 Step head.
 
void setMotor (bool status, EmuTime::param time) override
 Set motor on/off.
 
bool getMotor () const override
 Returns the previously set motor status.
 
bool indexPulse (EmuTime::param time) override
 Gets the state of the index pulse.
 
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.
 
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?
 
bool peekDiskChanged () const override
 
bool isDummyDrive () const override
 Is there a dummy (unconnected) drive?
 
void applyWd2793ReadTrackQuirk () override
 See RawTrack::applyWd2793ReadTrackQuirk()
 
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.
 
template<typename Archive >
void serialize (Archive &ar, unsigned version)
 
- Public Member Functions inherited from openmsx::DiskDrive
virtual ~DiskDrive ()=default
 
- Public Member Functions inherited from openmsx::MediaInfoProvider
 MediaInfoProvider (const MediaInfoProvider &)=delete
 
 MediaInfoProvider (MediaInfoProvider &&)=delete
 
MediaInfoProvideroperator= (const MediaInfoProvider &)=delete
 
MediaInfoProvideroperator= (MediaInfoProvider &&)=delete
 

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 469 of file RealDrive.cc.

◆ flushTrack()

void openmsx::RealDrive::flushTrack ( )
overridevirtual

Implements openmsx::DiskDrive.

Definition at line 457 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 292 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 361 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 402 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 350 of file RealDrive.cc.

References isDiskInserted().

◆ invalidateWd2793ReadTrackQuirk()

void openmsx::RealDrive::invalidateWd2793ReadTrackQuirk ( )
overridevirtual

Implements openmsx::DiskDrive.

Definition at line 489 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 479 of file RealDrive.cc.

◆ isTrack00()

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

Head above track 0.

Implements openmsx::DiskDrive.

Definition at line 227 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 474 of file RealDrive.cc.

◆ readTrackByte()

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

Implements openmsx::DiskDrive.

Definition at line 417 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 237 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 206 of file RealDrive.cc.

◆ writeTrackByte()

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

Implements openmsx::DiskDrive.

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