1
0
mirror of https://github.com/TomHarte/CLK.git synced 2026-04-19 19:16:34 +00:00

Switches disk seeking logic fully to floating point.

This commit is contained in:
Thomas Harte
2020-07-17 22:08:58 -04:00
parent cbb0594e6b
commit 4ee29b3266
8 changed files with 26 additions and 22 deletions
+7 -3
View File
@@ -80,6 +80,10 @@ bool Drive::get_is_track_zero() const {
}
void Drive::step(HeadPosition offset) {
if(offset == HeadPosition(0)) {
return;
}
if(ready_type_ == ReadyType::IBMRDY) {
is_ready_ = true;
}
@@ -94,7 +98,7 @@ void Drive::step(HeadPosition offset) {
}
// If the head moved, flush the old track.
if(head_position_ != old_head_position) {
if(disk_ && disk_->tracks_differ(Track::Address(head_, head_position_), Track::Address(head_, old_head_position))) {
track_ = nullptr;
}
@@ -355,8 +359,8 @@ void Drive::setup_track() {
}
float offset = 0.0f;
const auto track_time_now = get_time_into_track();
const auto time_found = track_->seek_to(Time(track_time_now)).get<float>();
const float track_time_now = get_time_into_track();
const float time_found = track_->seek_to(track_time_now);
// `time_found` can be greater than `track_time_now` if limited precision caused rounding.
if(time_found <= track_time_now) {