diff --git a/Storage/Disk/DiskDrive.cpp b/Storage/Disk/DiskDrive.cpp index 9c255b988..14f1ae681 100644 --- a/Storage/Disk/DiskDrive.cpp +++ b/Storage/Disk/DiskDrive.cpp @@ -49,11 +49,28 @@ bool DiskDrive::get_is_track_zero() void DiskDrive::step(int direction) { _head_position = std::max(_head_position + direction, 0); + + // TODO: add fractional part to _time_into_track + + // TODO: probably a better implementation of the empty track? +// Time offset; +// if(_track) +// { +// Time time_found = _track->seek_to(_time_into_track); +// offset = _time_into_track - time_found; +// } +// else +// { +// offset = _time_into_track; +// } + + // TODO: apply offset set_track(); } void DiskDrive::set_track() { + // TODO: accept and apply offset _track = _disk->get_track_at_position((unsigned int)_head_position); reset_timer(); get_next_event(); diff --git a/Storage/Storage.hpp b/Storage/Storage.hpp index 34f952f8e..7ef85b3a0 100644 --- a/Storage/Storage.hpp +++ b/Storage/Storage.hpp @@ -53,6 +53,14 @@ struct Time { return result; } + inline Time operator-(Time &other) + { + Time result; + result.clock_rate = NumberTheory::least_common_multiple(clock_rate, other.clock_rate); + result.length = length * (result.clock_rate / clock_rate) - other.length * (result.clock_rate / other.clock_rate); + return result; + } + inline void set_zero() { length = 0;