1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-11-23 03:32:32 +00:00

Ties head load to ready.

BD-DOS no longer perpetually retries.
This commit is contained in:
Thomas Harte 2020-01-14 23:45:36 -05:00
parent 98f7662185
commit f5c194386c
2 changed files with 16 additions and 1 deletions

View File

@ -44,8 +44,20 @@ uint8_t BD500::read(int address) {
void BD500::set_head_load_request(bool head_load) { void BD500::set_head_load_request(bool head_load) {
// Turn all motors on or off, and load the head instantly. // Turn all motors on or off, and load the head instantly.
is_loading_head_ |= head_load;
for(auto &drive : drives_) { for(auto &drive : drives_) {
if(drive) drive->set_motor_on(head_load); if(drive) drive->set_motor_on(head_load);
} }
set_head_loaded(head_load); if(!head_load) set_head_loaded(false);
}
void BD500::run_for(const Cycles cycles) {
// If a head load is in progress and the selected drive is now ready,
// declare head loaded.
if(is_loading_head_ && drives_[selected_drive_] && drives_[selected_drive_]->get_is_ready()) {
set_head_loaded(true);
is_loading_head_ = false;
}
WD::WD1770::run_for(cycles);
} }

View File

@ -25,8 +25,11 @@ class BD500: public DiskController {
void write(int address, uint8_t value); void write(int address, uint8_t value);
uint8_t read(int address); uint8_t read(int address);
void run_for(const Cycles cycles);
private: private:
void set_head_load_request(bool head_load) final; void set_head_load_request(bool head_load) final;
bool is_loading_head_ = false;
}; };
}; };