1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-11-26 08:49:37 +00:00

Flips meaning of ejected bit, to please the IIgs.

This commit is contained in:
Thomas Harte 2020-11-18 17:20:48 -05:00
parent 62f936128d
commit cddd72876f
4 changed files with 13 additions and 7 deletions

View File

@ -142,8 +142,11 @@ bool DoubleDensityDrive::read() {
return !get_is_track_zero(); return !get_is_track_zero();
case CA1|CA0: // Disk has been ejected. case CA1|CA0: // Disk has been ejected.
// (0 = user has ejected disk) // (1 = user has ejected disk)
return !has_new_disk_; //
// TODO: does this really mean _user_ has ejected disk? If so then I should avoid
// changing the flag upon a programmatic eject.
return has_new_disk_;
case CA1|CA0|SEL: // Tachometer. case CA1|CA0|SEL: // Tachometer.
// (arbitrary) // (arbitrary)
@ -174,6 +177,6 @@ bool DoubleDensityDrive::read() {
} }
} }
void DoubleDensityDrive::did_set_disk() { void DoubleDensityDrive::did_set_disk(bool did_replace) {
has_new_disk_ = true; has_new_disk_ = did_replace;
} }

View File

@ -39,7 +39,7 @@ class DoubleDensityDrive: public IWMDrive {
// To receive the proper notifications from Storage::Disk::Drive. // To receive the proper notifications from Storage::Disk::Drive.
void did_step(Storage::Disk::HeadPosition to_position) final; void did_step(Storage::Disk::HeadPosition to_position) final;
void did_set_disk() final; void did_set_disk(bool) final;
const bool is_800k_; const bool is_800k_;
bool has_new_disk_ = false; bool has_new_disk_ = false;

View File

@ -58,12 +58,13 @@ void Drive::set_disk(const std::shared_ptr<Disk> &disk) {
if(ready_type_ == ReadyType::ShugartModifiedRDY || ready_type_ == ReadyType::IBMRDY) { if(ready_type_ == ReadyType::ShugartModifiedRDY || ready_type_ == ReadyType::IBMRDY) {
is_ready_ = false; is_ready_ = false;
} }
const bool had_disk = bool(disk_);
if(disk_) disk_->flush_tracks(); if(disk_) disk_->flush_tracks();
disk_ = disk; disk_ = disk;
has_disk_ = !!disk_; has_disk_ = !!disk_;
invalidate_track(); invalidate_track();
did_set_disk(); did_set_disk(had_disk);
update_clocking_observer(); update_clocking_observer();
} }

View File

@ -187,8 +187,10 @@ class Drive: public ClockingHint::Source, public TimedEventLoop {
/*! /*!
Announces new media installation. Announces new media installation.
@c did_replace is @c true if a previous disk was replaced; @c false if the drive was previously empty.
*/ */
virtual void did_set_disk() {} virtual void did_set_disk(bool did_replace [[maybe_unused]]) {}
/*! /*!
@returns the current rotation of the disk, a float in the half-open range @returns the current rotation of the disk, a float in the half-open range