diff --git a/Machines/Oric/BD500.cpp b/Machines/Oric/BD500.cpp index 7ed562f35..fc5d6d210 100644 --- a/Machines/Oric/BD500.cpp +++ b/Machines/Oric/BD500.cpp @@ -44,8 +44,20 @@ uint8_t BD500::read(int address) { void BD500::set_head_load_request(bool head_load) { // Turn all motors on or off, and load the head instantly. + is_loading_head_ |= head_load; for(auto &drive : drives_) { 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); } diff --git a/Machines/Oric/BD500.hpp b/Machines/Oric/BD500.hpp index 6e664e212..52c501258 100644 --- a/Machines/Oric/BD500.hpp +++ b/Machines/Oric/BD500.hpp @@ -25,8 +25,11 @@ class BD500: public DiskController { void write(int address, uint8_t value); uint8_t read(int address); + void run_for(const Cycles cycles); + private: void set_head_load_request(bool head_load) final; + bool is_loading_head_ = false; }; };