openMSX
DriveMultiplexer.hh
Go to the documentation of this file.
1 #ifndef DRIVEMULTIPLEXER_HH
2 #define DRIVEMULTIPLEXER_HH
3 
4 #include "DiskDrive.hh"
5 
6 namespace openmsx {
7 
12 class DriveMultiplexer final : public DiskDrive
13 {
14 public:
15  enum DriveNum {
16  DRIVE_A = 0,
17  DRIVE_B = 1,
18  DRIVE_C = 2,
19  DRIVE_D = 3,
21  };
22 
23  // Multiplexer interface
24  explicit DriveMultiplexer(DiskDrive* drive[4]);
25  void selectDrive(DriveNum num, EmuTime::param time);
26 
27  // DiskDrive interface
28  bool isDiskInserted() const override;
29  bool isWriteProtected() const override;
30  bool isDoubleSided() const override;
31  bool isTrack00() const override;
32  void setSide(bool side) override;
33  void step(bool direction, EmuTime::param time) override;
34  void setMotor(bool status, EmuTime::param time) override;
35  bool indexPulse(EmuTime::param time) override;
36  EmuTime getTimeTillIndexPulse(EmuTime::param time, int count) override;
37  unsigned getTrackLength() override;
38  void writeTrackByte(int idx, byte val, bool addIdam) override;
39  byte readTrackByte(int idx) override;
40  EmuTime getNextSector(EmuTime::param time, RawTrack::Sector& sector) override;
41  void flushTrack() override;
42  bool diskChanged() override;
43  bool peekDiskChanged() const override;
44  bool isDummyDrive() const override;
45  void applyWd2793ReadTrackQuirk() override;
46  void invalidateWd2793ReadTrackQuirk() override;
47 
48  template<typename Archive>
49  void serialize(Archive& ar, unsigned version);
50 
51 private:
52  DummyDrive dummyDrive;
53  DiskDrive* drive[5];
54  DriveNum selected;
55  bool motor;
56  bool side;
57 };
58 
59 } // namespace openmsx
60 
61 #endif
EmuTime getNextSector(EmuTime::param time, RawTrack::Sector &sector) override
byte readTrackByte(int idx) override
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...
bool isDiskInserted() const override
Is drive ready?
uint8_t byte
8 bit unsigned integer
Definition: openmsx.hh:26
This class connects to a FDC as a normal DiskDrive and deligates all requests to one of four other Di...
void serialize(Archive &ar, unsigned version)
bool isDummyDrive() const override
Is there a dummy (unconncted) drive?
bool isWriteProtected() const override
Is disk write protected?
void applyWd2793ReadTrackQuirk() override
See RawTrack::applyWd2793ReadTrackQuirk()
void invalidateWd2793ReadTrackQuirk() override
void step(bool direction, EmuTime::param time) override
Step head.
bool isTrack00() const override
Head above track 0.
Thanks to enen for testing this on a real cartridge:
Definition: Autofire.cc:5
This class implements a not connected disk drive.
Definition: DiskDrive.hh:92
void setMotor(bool status, EmuTime::param time) override
Set motor on/off.
bool indexPulse(EmuTime::param time) override
Gets the state of the index pulse.
unsigned getTrackLength() override
void setSide(bool side) override
Side select.
bool diskChanged() override
Is disk changed?
This (abstract) class defines the DiskDrive interface.
Definition: DiskDrive.hh:12
bool isDoubleSided() const override
Is disk double sided?
DriveMultiplexer(DiskDrive *drive[4])
void selectDrive(DriveNum num, EmuTime::param time)
bool peekDiskChanged() const override
void writeTrackByte(int idx, byte val, bool addIdam) override