1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-10-04 01:57:54 +00:00

Attempted to reduce track invalidations.

This commit is contained in:
Thomas Harte 2016-12-25 20:38:25 -05:00
parent c0a1264ab0
commit acc35885cd
2 changed files with 7 additions and 2 deletions

View File

@ -535,10 +535,12 @@ void WD1770::posit_event(Event new_event_type)
}
if(distance_into_section_ == 7)
{
printf("Considering %d/%d\n", header_[0], header_[2]);
is_reading_data_ = false;
if(header_[0] == track_ && header_[2] == sector_ &&
(has_motor_on_line() || !(command_&0x02) || ((command_&0x08) >> 3) == header_[1]))
{
printf("Found %d/%d\n", header_[0], header_[2]);
// TODO: test CRC
goto type2_read_or_write_data;
}

View File

@ -235,8 +235,11 @@ bool Controller::get_motor_on()
void Controller::set_drive(std::shared_ptr<Drive> drive)
{
invalidate_track();
drive_ = drive;
if(drive_ != drive)
{
invalidate_track();
drive_ = drive;
}
}
void Controller::invalidate_track()