1
0
mirror of https://github.com/TomHarte/CLK.git synced 2026-04-21 17:16:44 +00:00

Expands size of storage in Cycles/HalfCycles; adjusts widely to compensate.

This commit is contained in:
Thomas Harte
2019-10-29 22:36:29 -04:00
parent fd02b6fc18
commit 1c154131f9
55 changed files with 191 additions and 183 deletions
+8 -8
View File
@@ -173,7 +173,7 @@ void Drive::set_event_delegate(Storage::Disk::Drive::EventDelegate *delegate) {
}
void Drive::advance(const Cycles cycles) {
cycles_since_index_hole_ += cycles.as_int();
cycles_since_index_hole_ += cycles.as_integral();
if(event_delegate_) event_delegate_->advance(cycles);
}
@@ -182,20 +182,20 @@ void Drive::run_for(const Cycles cycles) {
if(has_disk_) {
Time zero(0);
int number_of_cycles = cycles.as_int();
auto number_of_cycles = cycles.as_integral();
while(number_of_cycles) {
int cycles_until_next_event = static_cast<int>(get_cycles_until_next_event());
int cycles_to_run_for = std::min(cycles_until_next_event, number_of_cycles);
auto cycles_until_next_event = get_cycles_until_next_event();
auto cycles_to_run_for = std::min(cycles_until_next_event, number_of_cycles);
if(!is_reading_ && cycles_until_bits_written_ > zero) {
int write_cycles_target = cycles_until_bits_written_.get<int>();
if(cycles_until_bits_written_.length % cycles_until_bits_written_.clock_rate) write_cycles_target++;
auto write_cycles_target = cycles_until_bits_written_.get<Cycles::IntType>();
if(cycles_until_bits_written_.length % cycles_until_bits_written_.clock_rate) ++write_cycles_target;
cycles_to_run_for = std::min(cycles_to_run_for, write_cycles_target);
}
number_of_cycles -= cycles_to_run_for;
if(!is_reading_) {
if(cycles_until_bits_written_ > zero) {
Storage::Time cycles_to_run_for_time(cycles_to_run_for);
Storage::Time cycles_to_run_for_time(static_cast<int>(cycles_to_run_for));
if(cycles_until_bits_written_ <= cycles_to_run_for_time) {
if(event_delegate_) event_delegate_->process_write_completed();
if(cycles_until_bits_written_ <= cycles_to_run_for_time)
@@ -345,7 +345,7 @@ void Drive::begin_writing(Time bit_length, bool clamp_to_index_hole) {
is_reading_ = false;
clamp_writing_to_index_hole_ = clamp_to_index_hole;
cycles_per_bit_ = Storage::Time(get_input_clock_rate()) * bit_length;
cycles_per_bit_ = Storage::Time(int(get_input_clock_rate())) * bit_length;
cycles_per_bit_.simplify();
write_segment_.length_of_a_bit = bit_length / Time(rotational_multiplier_);