1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-11-26 08:49:37 +00:00

Shuffled a little to reduce risk of overflow, ensured writing is a loop, still seem to be writing too quickly for some reason.

This commit is contained in:
Thomas Harte 2016-12-25 16:13:05 -05:00
parent d2ad2c756e
commit 98be6ede45
2 changed files with 5 additions and 2 deletions

View File

@ -626,7 +626,6 @@ void WD1770::posit_event(Event new_event_type)
for(int b = 0; b < 16; b++)
write_bit(!(b&1));
}
// printf("%d\n", counter);
WAIT_FOR_EVENT(Event::DataWritten);
distance_into_section_ = 0;
@ -637,7 +636,9 @@ void WD1770::posit_event(Event new_event_type)
update_status([] (Status &status) {
status.data_request = true;
});
printf("- %d\n", counter);
WAIT_FOR_EVENT(Event::DataWritten);
printf("+ %d\n", counter);
distance_into_section_++;
if(distance_into_section_ == 128 << header_[3])
{
@ -652,6 +653,8 @@ void WD1770::posit_event(Event new_event_type)
goto wait_for_command;
}
goto type2_write_loop;
type2_write_crc:
// TODO: write CRC and FF
for(int b = 0; b < 48; b++)

View File

@ -189,7 +189,7 @@ void Controller::set_expected_bit_length(Time bit_length)
bit_length_ = bit_length;
bit_length_.simplify();
cycles_per_bit_ = Storage::Time(8000000) * (bit_length * rotational_multiplier_);
cycles_per_bit_ = Storage::Time(8000000) * (bit_length * rotational_multiplier_) * Storage::Time(clock_rate_multiplier_);
cycles_per_bit_.simplify();
// this conversion doesn't need to be exact because there's a lot of variation to be taken