1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-12-23 20:29:42 +00:00

Attempted to use the new get_cycles_until_next_event method to take some repetition outside of the PLL and drive event loops.

This commit is contained in:
Thomas Harte 2016-09-17 22:02:38 -04:00
parent bfed9585b8
commit 79ef38b123

View File

@ -85,11 +85,14 @@ void Drive::run_for_cycles(int number_of_cycles)
if(has_disk())
{
number_of_cycles *= _clock_rate_multiplier;
while(number_of_cycles--)
while(number_of_cycles)
{
_cycles_since_index_hole ++;
_pll->run_for_cycles(1);
TimedEventLoop::run_for_cycles(1);
int cycles_until_next_event = (int)get_cycles_until_next_event();
int cycles_to_run_for = std::min(cycles_until_next_event, number_of_cycles);
_cycles_since_index_hole += (unsigned int)cycles_to_run_for;
number_of_cycles -= cycles_to_run_for;
_pll->run_for_cycles(cycles_to_run_for);
TimedEventLoop::run_for_cycles(cycles_to_run_for);
}
}
}