28 bool signalsNeedMotorOn,
bool doubleSided,
36 [[nodiscard]]
bool isTrack00()
const override;
37 void setSide(
bool side)
override;
38 [[nodiscard]]
bool getSide()
const override;
39 void step(
bool direction, EmuTime::param time)
override;
40 void setMotor(
bool status, EmuTime::param time)
override;
41 [[nodiscard]]
bool getMotor()
const override;
42 [[nodiscard]]
bool indexPulse(EmuTime::param time)
override;
60 template<
typename Archive>
61 void serialize(Archive& ar,
unsigned version);
67 void executeUntil(EmuTime::param )
override {
69 drive.execLoadingTimeout();
75 explicit SyncMotorTimeout(Scheduler& s) :
Schedulable(s) {}
76 void executeUntil(EmuTime::param time)
override {
77 auto& drive =
OUTER(RealDrive, syncMotorTimeout);
78 drive.execMotorTimeout(time);
82 void execLoadingTimeout();
83 void execMotorTimeout(EmuTime::param time);
84 [[nodiscard]] EmuTime::param getCurrentTime()
const {
return syncLoadingTimeout.getCurrentTime(); }
86 void doSetMotor(
bool status, EmuTime::param time);
87 void setLoading(EmuTime::param time);
88 [[nodiscard]]
unsigned getCurrentAngle(EmuTime::param time)
const;
90 [[nodiscard]]
unsigned getMaxTrack()
const;
91 [[nodiscard]] std::optional<unsigned> getDiskReadTrack()
const;
92 [[nodiscard]] std::optional<unsigned> getDiskWriteTrack()
const;
94 void invalidateTrack();
97 static constexpr unsigned TICKS_PER_ROTATION = 200000;
98 static constexpr unsigned INDEX_DURATION = TICKS_PER_ROTATION / 50;
100 MSXMotherBoard& motherBoard;
101 LoadingIndicator loadingIndicator;
102 const EmuDuration motorTimeout;
104 using MotorClock = Clock<TICKS_PER_ROTATION * ROTATIONS_PER_SECOND>;
105 MotorClock motorTimer;
106 std::optional<DiskChanger> changer;
107 unsigned headPos = 0;
109 unsigned startAngle = 0;
110 bool motorStatus =
false;
111 const bool doubleSizedDrive;
112 const bool signalsNeedMotorOn;
115 std::shared_ptr<DrivesInUse> drivesInUse;
118 bool trackValid =
false;
119 bool trackDirty =
false;
This (abstract) class defines the DiskDrive interface.
This class implements a real drive, single or double sided.
void applyWd2793ReadTrackQuirk() override
See RawTrack::applyWd2793ReadTrackQuirk()
static constexpr unsigned MAX_DRIVES
bool peekDiskChanged() const override
void serialize(Archive &ar, unsigned version)
static std::shared_ptr< DrivesInUse > getDrivesInUse(MSXMotherBoard &motherBoard)
bool isTrack00() const override
Head above track 0.
void step(bool direction, EmuTime::param time) override
Step head.
bool isDoubleSided() override
Is disk double sided?
void invalidateWd2793ReadTrackQuirk() override
bool isWriteProtected() const override
Is disk write protected?
bool getMotor() const override
Returns the previously set motor status.
uint8_t readTrackByte(int idx) override
void setMotor(bool status, EmuTime::param time) override
Set motor on/off.
void setSide(bool side) override
Side select.
std::bitset< MAX_DRIVES > DrivesInUse
bool diskChanged() override
Is disk changed?
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...
bool isDummyDrive() const override
Is there a dummy (unconnected) drive?
void flushTrack() override
void writeTrackByte(int idx, uint8_t val, bool addIdam) override
bool isDiskInserted() const override
Is drive ready?
EmuTime getNextSector(EmuTime::param time, RawTrack::Sector §or) override
unsigned getTrackLength() override
bool getSide() const override
void getMediaInfo(TclObject &result) override
This method gets called when information is required on the media inserted in the media slot of the p...
Every class that wants to get scheduled at some point must inherit from this class.
Schedulable(const Schedulable &)=delete
This file implemented 3 utility functions:
#define OUTER(type, member)