openMSX
Public Types | Public Member Functions | List of all members
openmsx::DriveMultiplexer Class Referencefinal

This class connects to a FDC as a normal DiskDrive and delegates all requests to one of four other DiskDrives. More...

#include <DriveMultiplexer.hh>

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

Public Types

enum class  Drive {
  A , B , C , D ,
  NONE , NUM
}
 
- Public Types inherited from openmsx::DiskDrive
enum class  TrackMode { NORMAL , YAMAHA_FD_03 }
 

Public Member Functions

 DriveMultiplexer (std::span< std::unique_ptr< DiskDrive >, 4 > drv)
 
void selectDrive (Drive num, EmuTime::param time)
 
Drive getSelectedDrive () const
 
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
 
bool isDiskInserted (Drive num) const
 
bool diskChanged (Drive num)
 
bool peekDiskChanged (Drive num) const
 
template<typename Archive >
void serialize (Archive &ar, unsigned version)
 
- Public Member Functions inherited from openmsx::DiskDrive
virtual ~DiskDrive ()=default
 

Additional Inherited Members

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

Detailed Description

This class connects to a FDC as a normal DiskDrive and delegates all requests to one of four other DiskDrives.

Definition at line 15 of file DriveMultiplexer.hh.

Member Enumeration Documentation

◆ Drive

Enumerator
NONE 
NUM 

Definition at line 18 of file DriveMultiplexer.hh.

Constructor & Destructor Documentation

◆ DriveMultiplexer()

openmsx::DriveMultiplexer::DriveMultiplexer ( std::span< std::unique_ptr< DiskDrive >, 4 >  drv)
explicit

Definition at line 6 of file DriveMultiplexer.cc.

References A, B, C, D, and NONE.

Member Function Documentation

◆ applyWd2793ReadTrackQuirk()

void openmsx::DriveMultiplexer::applyWd2793ReadTrackQuirk ( )
overridevirtual

◆ diskChanged() [1/2]

bool openmsx::DriveMultiplexer::diskChanged ( )
overridevirtual

◆ diskChanged() [2/2]

bool openmsx::DriveMultiplexer::diskChanged ( Drive  num)

Definition at line 117 of file DriveMultiplexer.cc.

◆ flushTrack()

void openmsx::DriveMultiplexer::flushTrack ( )
overridevirtual

Implements openmsx::DiskDrive.

Definition at line 107 of file DriveMultiplexer.cc.

◆ getMotor()

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

Returns the previously set motor status.

Implements openmsx::DiskDrive.

Definition at line 72 of file DriveMultiplexer.cc.

Referenced by openmsx::ToshibaFDC::peekMem().

◆ getNextSector()

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

Implements openmsx::DiskDrive.

Definition at line 102 of file DriveMultiplexer.cc.

◆ getSelectedDrive()

Drive openmsx::DriveMultiplexer::getSelectedDrive ( ) const
inline

Definition at line 27 of file DriveMultiplexer.hh.

Referenced by openmsx::ToshibaFDC::peekMem().

◆ getSide()

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

Implements openmsx::DiskDrive.

Definition at line 51 of file DriveMultiplexer.cc.

Referenced by openmsx::ToshibaFDC::peekMem().

◆ getTimeTillIndexPulse()

EmuTime openmsx::DriveMultiplexer::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 82 of file DriveMultiplexer.cc.

◆ getTrackLength()

unsigned openmsx::DriveMultiplexer::getTrackLength ( )
overridevirtual

Implements openmsx::DiskDrive.

Definition at line 87 of file DriveMultiplexer.cc.

◆ indexPulse()

bool openmsx::DriveMultiplexer::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 77 of file DriveMultiplexer.cc.

◆ invalidateWd2793ReadTrackQuirk()

void openmsx::DriveMultiplexer::invalidateWd2793ReadTrackQuirk ( )
overridevirtual

Implements openmsx::DiskDrive.

Definition at line 142 of file DriveMultiplexer.cc.

◆ isDiskInserted() [1/2]

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

Is drive ready?

Implements openmsx::DiskDrive.

Definition at line 25 of file DriveMultiplexer.cc.

Referenced by openmsx::YamahaFDC::peekMem(), and openmsx::YamahaFDC::readMem().

◆ isDiskInserted() [2/2]

bool openmsx::DriveMultiplexer::isDiskInserted ( Drive  num) const

Definition at line 30 of file DriveMultiplexer.cc.

◆ isDoubleSided()

bool openmsx::DriveMultiplexer::isDoubleSided ( )
overridevirtual

Is disk double sided?

Implements openmsx::DiskDrive.

Definition at line 40 of file DriveMultiplexer.cc.

◆ isDummyDrive()

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

Is there a dummy (unconnected) drive?

Implements openmsx::DiskDrive.

Definition at line 132 of file DriveMultiplexer.cc.

◆ isTrack00()

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

Head above track 0.

Implements openmsx::DiskDrive.

Definition at line 61 of file DriveMultiplexer.cc.

◆ isWriteProtected()

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

Is disk write protected?

Implements openmsx::DiskDrive.

Definition at line 35 of file DriveMultiplexer.cc.

◆ peekDiskChanged() [1/2]

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

◆ peekDiskChanged() [2/2]

bool openmsx::DriveMultiplexer::peekDiskChanged ( Drive  num) const

Definition at line 127 of file DriveMultiplexer.cc.

◆ readTrackByte()

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

Implements openmsx::DiskDrive.

Definition at line 97 of file DriveMultiplexer.cc.

◆ selectDrive()

void openmsx::DriveMultiplexer::selectDrive ( Drive  num,
EmuTime::param  time 
)

◆ serialize()

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

Definition at line 158 of file DriveMultiplexer.cc.

◆ setMotor()

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

◆ setSide()

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

◆ step()

void openmsx::DriveMultiplexer::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 56 of file DriveMultiplexer.cc.

◆ writeTrackByte()

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

Implements openmsx::DiskDrive.

Definition at line 92 of file DriveMultiplexer.cc.


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