1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-07-05 10:28:58 +00:00

Okay, it's becoming more apparent where the (very mild) complexity will be here. But started moving towards retaining rotation between tracks.

This commit is contained in:
Thomas Harte 2016-08-03 07:33:26 -04:00
parent 21f1fa37a4
commit a3a3486f54
2 changed files with 25 additions and 0 deletions

View File

@ -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();

View File

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