From 2f13517f38151e6eab6f204dbd34149a637d5929 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Mon, 11 Sep 2017 22:10:56 -0400 Subject: [PATCH] Adjusts the 1770 not to talk directly to the drive about motor status. --- Components/1770/1770.cpp | 5 +++-- Components/1770/1770.hpp | 1 + Machines/Electron/Plus3.cpp | 6 ++++++ Machines/Electron/Plus3.hpp | 2 ++ 4 files changed, 12 insertions(+), 2 deletions(-) diff --git a/Components/1770/1770.cpp b/Components/1770/1770.cpp index 991f5efdc..f235068b4 100644 --- a/Components/1770/1770.cpp +++ b/Components/1770/1770.cpp @@ -145,7 +145,7 @@ void WD1770::run_for(const Cycles cycles) { #define LINE_LABEL INDIRECT_CONCATENATE(label, __LINE__) #define SPIN_UP() \ - get_drive().set_motor_on(true); \ + set_motor_on(true); \ index_hole_count_ = 0; \ index_hole_count_target_ = 6; \ WAIT_FOR_EVENT(Event1770::IndexHoleTarget); \ @@ -178,7 +178,7 @@ void WD1770::posit_event(int new_event_type) { // motor power-down if(index_hole_count_ == 9 && !status_.busy && has_motor_on_line()) { - get_drive().set_motor_on(false); + set_motor_on(false); } // head unload @@ -781,6 +781,7 @@ void WD1770::update_status(std::function updater) { } void WD1770::set_head_load_request(bool head_load) {} +void WD1770::set_motor_on(bool motor_on) {} void WD1770::set_head_loaded(bool head_loaded) { head_is_loaded_ = head_loaded; diff --git a/Components/1770/1770.hpp b/Components/1770/1770.hpp index 9d3f46617..f68054f02 100644 --- a/Components/1770/1770.hpp +++ b/Components/1770/1770.hpp @@ -76,6 +76,7 @@ class WD1770: public Storage::Disk::MFMController { protected: virtual void set_head_load_request(bool head_load); + virtual void set_motor_on(bool motor_on); void set_head_loaded(bool head_loaded); private: diff --git a/Machines/Electron/Plus3.cpp b/Machines/Electron/Plus3.cpp index d79057839..c6b4fa9a6 100644 --- a/Machines/Electron/Plus3.cpp +++ b/Machines/Electron/Plus3.cpp @@ -47,3 +47,9 @@ void Plus3::set_control_register(uint8_t control, uint8_t changes) { } if(changes & 0x08) set_is_double_density(!(control & 0x08)); } + +void Plus3::set_motor_on(bool on) { + // TODO: this status should transfer if the selected drive changes. But the same goes for + // writing state, so plenty of work to do in general here. + get_drive().set_motor_on(on); +} diff --git a/Machines/Electron/Plus3.hpp b/Machines/Electron/Plus3.hpp index 054056211..71b8b1c4b 100644 --- a/Machines/Electron/Plus3.hpp +++ b/Machines/Electron/Plus3.hpp @@ -25,6 +25,8 @@ class Plus3 : public WD::WD1770 { std::shared_ptr drives_[2]; int selected_drive_ = 0; uint8_t last_control_ = 0; + + void set_motor_on(bool on); }; }