mirror of
https://github.com/TomHarte/CLK.git
synced 2024-11-26 23:52:26 +00:00
Attempted to give the PLL a litte extra leeway, and fixed PCMTrack
length test.
This commit is contained in:
parent
8f62211f5e
commit
fead524eb5
@ -11,11 +11,11 @@
|
||||
using namespace Storage;
|
||||
|
||||
DiskDrive::DiskDrive(unsigned int clock_rate, unsigned int revolutions_per_minute) :
|
||||
_clock_rate(clock_rate),
|
||||
_clock_rate(clock_rate * 16),
|
||||
_revolutions_per_minute(revolutions_per_minute),
|
||||
_head_position(0),
|
||||
|
||||
TimedEventLoop(clock_rate)
|
||||
TimedEventLoop(clock_rate * 16)
|
||||
{}
|
||||
|
||||
void DiskDrive::set_expected_bit_length(Time bit_length)
|
||||
@ -63,6 +63,8 @@ void DiskDrive::run_for_cycles(int number_of_cycles)
|
||||
if(has_disk())
|
||||
{
|
||||
_cycles_since_index_hole += (unsigned int)number_of_cycles;
|
||||
|
||||
number_of_cycles *= 16;
|
||||
_pll->run_for_cycles(number_of_cycles);
|
||||
TimedEventLoop::run_for_cycles(number_of_cycles);
|
||||
}
|
||||
@ -100,6 +102,7 @@ void DiskDrive::process_next_event()
|
||||
case Track::Event::IndexHole:
|
||||
_cycles_since_index_hole = 0;
|
||||
process_index_hole();
|
||||
printf("\n");
|
||||
break;
|
||||
}
|
||||
get_next_event();
|
||||
|
@ -33,7 +33,7 @@ PCMTrack::Event PCMTrack::get_next_event()
|
||||
{
|
||||
unsigned int clock_multiplier = _track_clock_rate / _segments[_segment_pointer].length_of_a_bit.clock_rate;
|
||||
const uint8_t *segment_data = _segments[_segment_pointer].data.get();
|
||||
while(_bit_pointer < _segments[_segment_pointer].length_of_a_bit.length)
|
||||
while(_bit_pointer < _segments[_segment_pointer].number_of_bits)
|
||||
{
|
||||
// for timing simplicity, bits are modelled as happening at the end of their window
|
||||
// TODO: should I account for the converse bit ordering? Or can I assume MSB first?
|
||||
@ -66,7 +66,7 @@ void PCMTrack::fix_length()
|
||||
_track_clock_rate = NumberTheory::least_common_multiple(_track_clock_rate, _segments[c].length_of_a_bit.clock_rate);
|
||||
}
|
||||
|
||||
// therby determine the total length, storing it to next_event as the track-total divisor
|
||||
// thereby determine the total length, storing it to next_event as the track-total divisor
|
||||
_next_event.length.clock_rate = 0;
|
||||
for(size_t c = 0; c < _segments.size(); c++)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user