1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-12-25 03:32:01 +00:00

Creates the through-path that will be necessary for RWTS acceleration.

This commit is contained in:
Thomas Harte 2018-06-09 12:51:53 -04:00
parent fb4bb21bf6
commit dde9b73a22
7 changed files with 42 additions and 6 deletions

View File

@ -260,3 +260,7 @@ void DiskII::set_activity_observer(Activity::Observer *observer) {
drives_[0].set_activity_observer(observer, "Drive 1", true);
drives_[1].set_activity_observer(observer, "Drive 2", true);
}
Storage::Disk::Drive &DiskII::get_drive(int index) {
return drives_[index];
}

View File

@ -81,6 +81,10 @@ class DiskII:
// The Disk II functions as a potential target for @c Activity::Sources.
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:
enum class Control {
P0, P1, P2, P3,

View File

@ -57,3 +57,7 @@ void DiskIICard::set_component_prefers_clocking(ClockingHint::Source *component,
diskii_clocking_preference_ = preference;
set_select_constraints((preference != ClockingHint::Preference::RealTime) ? (IO | Device) : 0);
}
Storage::Disk::Drive &DiskIICard::get_drive(int drive) {
return diskii_.get_drive(drive);
}

View File

@ -32,6 +32,7 @@ class DiskIICard: public Card, public ClockingHint::Observer {
void set_activity_observer(Activity::Observer *observer) override;
void set_disk(const std::shared_ptr<Storage::Disk::Disk> &disk, int drive);
Storage::Disk::Drive &get_drive(int drive);
private:
void set_component_prefers_clocking(ClockingHint::Source *component, ClockingHint::Preference clocking) override;

View File

@ -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_) {

View File

@ -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.

View File

@ -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_;
}