mirror of
https://github.com/TomHarte/CLK.git
synced 2026-04-26 19:17:52 +00:00
Creates the through-path that will be necessary for RWTS acceleration.
This commit is contained in:
@@ -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) {
|
||||
head = std::min(head, available_heads_ - 1);
|
||||
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.
|
||||
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:
|
||||
// Drives contain an entire disk; from that a certain track
|
||||
// will be currently under the head.
|
||||
|
||||
@@ -39,22 +39,22 @@ class HeadPosition {
|
||||
position_ += rhs.position_;
|
||||
return *this;
|
||||
}
|
||||
bool operator ==(const HeadPosition &rhs) {
|
||||
bool operator ==(const HeadPosition &rhs) const {
|
||||
return position_ == rhs.position_;
|
||||
}
|
||||
bool operator !=(const HeadPosition &rhs) {
|
||||
bool operator !=(const HeadPosition &rhs) const {
|
||||
return position_ != rhs.position_;
|
||||
}
|
||||
bool operator <(const HeadPosition &rhs) {
|
||||
bool operator <(const HeadPosition &rhs) const {
|
||||
return position_ < rhs.position_;
|
||||
}
|
||||
bool operator <=(const HeadPosition &rhs) {
|
||||
bool operator <=(const HeadPosition &rhs) const {
|
||||
return position_ <= rhs.position_;
|
||||
}
|
||||
bool operator >(const HeadPosition &rhs) {
|
||||
bool operator >(const HeadPosition &rhs) const {
|
||||
return position_ > rhs.position_;
|
||||
}
|
||||
bool operator >=(const HeadPosition &rhs) {
|
||||
bool operator >=(const HeadPosition &rhs) const {
|
||||
return position_ >= rhs.position_;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user