mirror of
https://github.com/TomHarte/CLK.git
synced 2025-01-13 07:30:21 +00:00
Creates the through-path that will be necessary for RWTS acceleration.
This commit is contained in:
parent
fb4bb21bf6
commit
dde9b73a22
@ -260,3 +260,7 @@ void DiskII::set_activity_observer(Activity::Observer *observer) {
|
|||||||
drives_[0].set_activity_observer(observer, "Drive 1", true);
|
drives_[0].set_activity_observer(observer, "Drive 1", true);
|
||||||
drives_[1].set_activity_observer(observer, "Drive 2", true);
|
drives_[1].set_activity_observer(observer, "Drive 2", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Storage::Disk::Drive &DiskII::get_drive(int index) {
|
||||||
|
return drives_[index];
|
||||||
|
}
|
||||||
|
@ -81,6 +81,10 @@ class DiskII:
|
|||||||
// The Disk II functions as a potential target for @c Activity::Sources.
|
// The Disk II functions as a potential target for @c Activity::Sources.
|
||||||
void set_activity_observer(Activity::Observer *observer);
|
void set_activity_observer(Activity::Observer *observer);
|
||||||
|
|
||||||
|
// Returns the Storage::Disk::Drive in use for drive @c index.
|
||||||
|
// *NOT FOR HARDWARE EMULATION USAGE*.
|
||||||
|
Storage::Disk::Drive &get_drive(int index);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
enum class Control {
|
enum class Control {
|
||||||
P0, P1, P2, P3,
|
P0, P1, P2, P3,
|
||||||
|
@ -57,3 +57,7 @@ void DiskIICard::set_component_prefers_clocking(ClockingHint::Source *component,
|
|||||||
diskii_clocking_preference_ = preference;
|
diskii_clocking_preference_ = preference;
|
||||||
set_select_constraints((preference != ClockingHint::Preference::RealTime) ? (IO | Device) : 0);
|
set_select_constraints((preference != ClockingHint::Preference::RealTime) ? (IO | Device) : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Storage::Disk::Drive &DiskIICard::get_drive(int drive) {
|
||||||
|
return diskii_.get_drive(drive);
|
||||||
|
}
|
||||||
|
@ -32,6 +32,7 @@ class DiskIICard: public Card, public ClockingHint::Observer {
|
|||||||
void set_activity_observer(Activity::Observer *observer) override;
|
void set_activity_observer(Activity::Observer *observer) override;
|
||||||
|
|
||||||
void set_disk(const std::shared_ptr<Storage::Disk::Disk> &disk, int drive);
|
void set_disk(const std::shared_ptr<Storage::Disk::Disk> &disk, int drive);
|
||||||
|
Storage::Disk::Drive &get_drive(int drive);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void set_component_prefers_clocking(ClockingHint::Source *component, ClockingHint::Preference clocking) override;
|
void set_component_prefers_clocking(ClockingHint::Source *component, ClockingHint::Preference clocking) override;
|
||||||
|
@ -77,6 +77,18 @@ void Drive::step(HeadPosition offset) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::shared_ptr<Track> Drive::step_to(HeadPosition offset) {
|
||||||
|
HeadPosition old_head_position = head_position_;
|
||||||
|
head_position_ = std::max(offset, HeadPosition(0));
|
||||||
|
|
||||||
|
if(head_position_ != old_head_position) {
|
||||||
|
track_ = nullptr;
|
||||||
|
setup_track();
|
||||||
|
}
|
||||||
|
|
||||||
|
return track_;
|
||||||
|
}
|
||||||
|
|
||||||
void Drive::set_head(int head) {
|
void Drive::set_head(int head) {
|
||||||
head = std::min(head, available_heads_ - 1);
|
head = std::min(head, available_heads_ - 1);
|
||||||
if(head != head_) {
|
if(head != head_) {
|
||||||
|
@ -127,6 +127,17 @@ class Drive: public ClockingHint::Source, public TimedEventLoop {
|
|||||||
/// The caller can specify whether to add an LED based on disk motor.
|
/// The caller can specify whether to add an LED based on disk motor.
|
||||||
void set_activity_observer(Activity::Observer *observer, const std::string &name, bool add_motor_led);
|
void set_activity_observer(Activity::Observer *observer, const std::string &name, bool add_motor_led);
|
||||||
|
|
||||||
|
/*!
|
||||||
|
Attempts to step to the specified offset and returns the track there if one exists; an uninitialised
|
||||||
|
track otherwise.
|
||||||
|
|
||||||
|
This is unambiguously **NOT A REALISTIC DRIVE FUNCTION**; real drives cannot step to a given offset.
|
||||||
|
So it is **NOT FOR HARDWARE EMULATION USAGE**.
|
||||||
|
|
||||||
|
It's for the benefit of user-optional fast-loading mechanisms **ONLY**.
|
||||||
|
*/
|
||||||
|
std::shared_ptr<Track> step_to(HeadPosition offset);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Drives contain an entire disk; from that a certain track
|
// Drives contain an entire disk; from that a certain track
|
||||||
// will be currently under the head.
|
// will be currently under the head.
|
||||||
|
@ -39,22 +39,22 @@ class HeadPosition {
|
|||||||
position_ += rhs.position_;
|
position_ += rhs.position_;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
bool operator ==(const HeadPosition &rhs) {
|
bool operator ==(const HeadPosition &rhs) const {
|
||||||
return position_ == rhs.position_;
|
return position_ == rhs.position_;
|
||||||
}
|
}
|
||||||
bool operator !=(const HeadPosition &rhs) {
|
bool operator !=(const HeadPosition &rhs) const {
|
||||||
return position_ != rhs.position_;
|
return position_ != rhs.position_;
|
||||||
}
|
}
|
||||||
bool operator <(const HeadPosition &rhs) {
|
bool operator <(const HeadPosition &rhs) const {
|
||||||
return position_ < rhs.position_;
|
return position_ < rhs.position_;
|
||||||
}
|
}
|
||||||
bool operator <=(const HeadPosition &rhs) {
|
bool operator <=(const HeadPosition &rhs) const {
|
||||||
return position_ <= rhs.position_;
|
return position_ <= rhs.position_;
|
||||||
}
|
}
|
||||||
bool operator >(const HeadPosition &rhs) {
|
bool operator >(const HeadPosition &rhs) const {
|
||||||
return position_ > rhs.position_;
|
return position_ > rhs.position_;
|
||||||
}
|
}
|
||||||
bool operator >=(const HeadPosition &rhs) {
|
bool operator >=(const HeadPosition &rhs) const {
|
||||||
return position_ >= rhs.position_;
|
return position_ >= rhs.position_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user