Go to the documentation of this file.
4 #include "DiskDrive.hh"
6 namespace openmsx {
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,
20  NO_DRIVE = 4
21  };
23  // Multiplexer interface
24  explicit DriveMultiplexer(DiskDrive* drv[4]);
26  void selectDrive(DriveNum num, EmuTime::param time);
27  [[nodiscard]] DriveNum getSelectedDrive() const { return selected; }
29  // DiskDrive interface
30  [[nodiscard]] bool isDiskInserted() const override;
31  [[nodiscard]] bool isWriteProtected() const override;
32  [[nodiscard]] bool isDoubleSided() override;
33  [[nodiscard]] bool isTrack00() const override;
34  void setSide(bool side) override;
35  [[nodiscard]] bool getSide() const override;
36  void step(bool direction, EmuTime::param time) override;
37  void setMotor(bool status, EmuTime::param time) override;
38  [[nodiscard]] bool getMotor() const override;
39  [[nodiscard]] bool indexPulse(EmuTime::param time) override;
40  [[nodiscard]] EmuTime getTimeTillIndexPulse(EmuTime::param time, int count) override;
41  [[nodiscard]] unsigned getTrackLength() override;
42  void writeTrackByte(int idx, byte val, bool addIdam) override;
43  [[nodiscard]] byte readTrackByte(int idx) override;
44  EmuTime getNextSector(EmuTime::param time, RawTrack::Sector& sector) override;
45  void flushTrack() override;
46  bool diskChanged() override;
47  [[nodiscard]] bool peekDiskChanged() const override;
48  [[nodiscard]] bool isDummyDrive() const override;
49  void applyWd2793ReadTrackQuirk() override;
50  void invalidateWd2793ReadTrackQuirk() override;
52  [[nodiscard]] bool isDiskInserted(DriveNum num) const;
53  bool diskChanged(DriveNum num);
54  [[nodiscard]] bool peekDiskChanged(DriveNum num) const;
56  template<typename Archive>
57  void serialize(Archive& ar, unsigned version);
59 private:
60  DummyDrive dummyDrive;
61  DiskDrive* drive[5];
62  DriveNum selected;
63  bool motor;
64  bool side;
65 };
67 } // namespace openmsx
69 #endif
This (abstract) class defines the DiskDrive interface.
Definition: DiskDrive.hh:13
This class connects to a FDC as a normal DiskDrive and deligates all requests to one of four other Di...
EmuTime getNextSector(EmuTime::param time, RawTrack::Sector &sector) override
void setMotor(bool status, EmuTime::param time) override
Set motor on/off.
void invalidateWd2793ReadTrackQuirk() override
byte readTrackByte(int idx) override
bool isTrack00() const override
Head above track 0.
bool isWriteProtected() const override
Is disk write protected?
bool peekDiskChanged() const override
void selectDrive(DriveNum num, EmuTime::param time)
bool isDiskInserted() const override
Is drive ready?
DriveNum getSelectedDrive() const
DriveMultiplexer(DiskDrive *drv[4])
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 getMotor() const override
Returns the previously set motor status.
bool getSide() const override
bool diskChanged() override
Is disk changed?
void serialize(Archive &ar, unsigned version)
bool isDummyDrive() const override
Is there a dummy (unconnected) drive?
void applyWd2793ReadTrackQuirk() override
See RawTrack::applyWd2793ReadTrackQuirk()
bool indexPulse(EmuTime::param time) override
Gets the state of the index pulse.
void step(bool direction, EmuTime::param time) override
Step head.
void writeTrackByte(int idx, byte val, bool addIdam) override
void setSide(bool side) override
Side select.
bool isDoubleSided() override
Is disk double sided?
unsigned getTrackLength() override
This class implements a not connected disk drive.
Definition: DiskDrive.hh:106
ALWAYS_INLINE unsigned count(const uint8_t *pIn, const uint8_t *pMatch, const uint8_t *pInLimit)
This file implemented 3 utility functions: