mirror of
https://github.com/TomHarte/CLK.git
synced 2024-09-30 07:55:01 +00:00
Adds has-new-disk flag, allowing mounting of software from the desktop.
This commit is contained in:
parent
59b5dfddec
commit
2c39229b13
@ -71,29 +71,30 @@ void DoubleDensityDrive::set_control_lines(int lines) {
|
|||||||
|
|
||||||
// Catch low-to-high LSTRB transitions.
|
// Catch low-to-high LSTRB transitions.
|
||||||
if((old_state ^ control_state_) & control_state_ & Line::LSTRB) {
|
if((old_state ^ control_state_) & control_state_ & Line::LSTRB) {
|
||||||
switch(control_state_ & (Line::CA1 | Line::CA0 | Line::SEL)) {
|
switch(control_state_ & (Line::CA2 | Line::CA1 | Line::CA0 | Line::SEL)) {
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0: // Set step direction — CA2 set => step outward.
|
case 0: // Set step direction — CA2 set => step outward.
|
||||||
|
case Line::CA2:
|
||||||
step_direction_ = (control_state_ & Line::CA2) ? -1 : 1;
|
step_direction_ = (control_state_ & Line::CA2) ? -1 : 1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Line::CA1: // Set drive motor — CA2 set => motor off.
|
case Line::CA1: // Set drive motor — CA2 set => motor off.
|
||||||
|
case Line::CA1|Line::CA2:
|
||||||
set_motor_on(!(control_state_ & Line::CA2));
|
set_motor_on(!(control_state_ & Line::CA2));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Line::CA0: // Initiate a step, if CA2 is clear.
|
case Line::CA0: // Initiate a step.
|
||||||
if(!(control_state_ & Line::CA2))
|
step(Storage::Disk::HeadPosition(step_direction_));
|
||||||
step(Storage::Disk::HeadPosition(step_direction_));
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Line::SEL: // Reset has-been-ejected flag (if CA2 is set?)
|
case Line::SEL|Line::CA2: // Reset new disk flag.
|
||||||
|
has_new_disk_ = false;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Line::CA1 | Line::CA0: // Eject the disk if CA2 is set.
|
case Line::CA2 | Line::CA1 | Line::CA0: // Eject the disk.
|
||||||
if(control_state_ & Line::CA2)
|
set_disk(nullptr);
|
||||||
set_disk(nullptr); // TODO: should probably trigger the disk has been ejected bit?
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -131,7 +132,7 @@ bool DoubleDensityDrive::read() {
|
|||||||
|
|
||||||
case CA1|CA0: // Disk has been ejected.
|
case CA1|CA0: // Disk has been ejected.
|
||||||
// (0 = user has ejected disk)
|
// (0 = user has ejected disk)
|
||||||
return false;
|
return !has_new_disk_;
|
||||||
|
|
||||||
case CA1|CA0|SEL: // Tachometer.
|
case CA1|CA0|SEL: // Tachometer.
|
||||||
// (arbitrary)
|
// (arbitrary)
|
||||||
@ -163,3 +164,7 @@ bool DoubleDensityDrive::read() {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DoubleDensityDrive::did_set_disk() {
|
||||||
|
has_new_disk_ = true;
|
||||||
|
}
|
||||||
|
@ -25,10 +25,12 @@ class DoubleDensityDrive: public IWMDrive {
|
|||||||
private:
|
private:
|
||||||
// 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) override;
|
void did_step(Storage::Disk::HeadPosition to_position) override;
|
||||||
|
void did_set_disk() override;
|
||||||
|
|
||||||
bool is_800k_;
|
const bool is_800k_;
|
||||||
int control_state_;
|
bool has_new_disk_ = false;
|
||||||
int step_direction_;
|
int control_state_ = 0;
|
||||||
|
int step_direction_ = 1;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -53,6 +53,7 @@ void Drive::set_disk(const std::shared_ptr<Disk> &disk) {
|
|||||||
has_disk_ = !!disk_;
|
has_disk_ = !!disk_;
|
||||||
|
|
||||||
invalidate_track();
|
invalidate_track();
|
||||||
|
did_set_disk();
|
||||||
update_clocking_observer();
|
update_clocking_observer();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -165,6 +165,11 @@ class Drive: public ClockingHint::Source, public TimedEventLoop {
|
|||||||
*/
|
*/
|
||||||
virtual void did_step(HeadPosition to_position) {}
|
virtual void did_step(HeadPosition to_position) {}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
Announces new media installation.
|
||||||
|
*/
|
||||||
|
virtual void did_set_disk() {}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@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
|
||||||
0.0 (the index hole) to 1.0 (back to the index hole, a whole rotation later).
|
0.0 (the index hole) to 1.0 (back to the index hole, a whole rotation later).
|
||||||
|
Loading…
Reference in New Issue
Block a user