23 bool signalsNeedMotorOn,
bool doubleSided,
31 [[nodiscard]]
bool isTrack00()
const override;
32 void setSide(
bool side)
override;
33 [[nodiscard]]
bool getSide()
const override;
34 void step(
bool direction, EmuTime::param time)
override;
35 void setMotor(
bool status, EmuTime::param time)
override;
36 [[nodiscard]]
bool getMotor()
const override;
37 [[nodiscard]]
bool indexPulse(EmuTime::param time)
override;
55 template<
typename Archive>
56 void serialize(Archive& ar,
unsigned version);
62 void executeUntil(EmuTime::param )
override {
64 drive.execLoadingTimeout();
71 void executeUntil(EmuTime::param time)
override {
73 drive.execMotorTimeout(time);
77 void execLoadingTimeout();
78 void execMotorTimeout(EmuTime::param time);
79 [[nodiscard]] EmuTime::param getCurrentTime()
const {
return syncLoadingTimeout.getCurrentTime(); }
81 void doSetMotor(
bool status, EmuTime::param time);
82 void setLoading(EmuTime::param time);
83 [[nodiscard]]
unsigned getCurrentAngle(EmuTime::param time)
const;
85 [[nodiscard]]
unsigned getMaxTrack()
const;
86 [[nodiscard]] std::optional<unsigned> getDiskReadTrack()
const;
87 [[nodiscard]] std::optional<unsigned> getDiskWriteTrack()
const;
89 void invalidateTrack();
92 static constexpr unsigned TICKS_PER_ROTATION = 200000;
93 static constexpr unsigned INDEX_DURATION = TICKS_PER_ROTATION / 50;
101 std::optional<DiskChanger> changer;
102 unsigned headPos = 0;
104 unsigned startAngle = 0;
105 bool motorStatus =
false;
106 const bool doubleSizedDrive;
107 const bool signalsNeedMotorOn;
110 static constexpr unsigned MAX_DRIVES = 26;
111 using DrivesInUse = std::bitset<MAX_DRIVES>;
112 std::shared_ptr<DrivesInUse> drivesInUse;
115 bool trackValid =
false;
116 bool trackDirty =
false;
This (abstract) class defines the DiskDrive interface.
Used by a device to indicate when it is loading.
This class implements a real drive, single or double sided.
void applyWd2793ReadTrackQuirk() override
See RawTrack::applyWd2793ReadTrackQuirk()
bool peekDiskChanged() const override
void serialize(Archive &ar, unsigned version)
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.
bool diskChanged() override
Is disk changed?
bool indexPulse(EmuTime::param time) override
Gets the state of the index pulse.
RealDrive(MSXMotherBoard &motherBoard, EmuDuration::param motorTimeout, bool signalsNeedMotorOn, bool doubleSided, DiskDrive::TrackMode trackMode)
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.
ALWAYS_INLINE unsigned count(const uint8_t *pIn, const uint8_t *pMatch, const uint8_t *pInLimit)
This file implemented 3 utility functions:
SERIALIZE_CLASS_VERSION(CassettePlayer, 2)
#define OUTER(type, member)