From 8cd1575891b4a221433fe814af2ac67ea8feceb5 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Wed, 28 Dec 2016 18:52:36 -0500 Subject: [PATCH] Similar fix to that over in Oric land: ensure a known, effective initial value for the Plus 3's control register. --- Machines/Electron/Plus3.cpp | 9 ++++++++- Machines/Electron/Plus3.hpp | 1 + 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/Machines/Electron/Plus3.cpp b/Machines/Electron/Plus3.cpp index 9100a860c..d026f6bf9 100644 --- a/Machines/Electron/Plus3.cpp +++ b/Machines/Electron/Plus3.cpp @@ -10,7 +10,10 @@ using namespace Electron; -Plus3::Plus3() : WD1770(P1770) {} +Plus3::Plus3() : WD1770(P1770), last_control_(0) +{ + set_control_register(last_control_, 0xff); +} void Plus3::set_disk(std::shared_ptr disk, int drive) { @@ -31,7 +34,11 @@ void Plus3::set_control_register(uint8_t control) uint8_t changes = control ^ last_control_; last_control_ = control; + set_control_register(control, changes); +} +void Plus3::set_control_register(uint8_t control, uint8_t changes) +{ if(changes&3) { switch(control&3) diff --git a/Machines/Electron/Plus3.hpp b/Machines/Electron/Plus3.hpp index 8e6b7c0e4..37cf5b324 100644 --- a/Machines/Electron/Plus3.hpp +++ b/Machines/Electron/Plus3.hpp @@ -21,6 +21,7 @@ class Plus3 : public WD::WD1770 { void set_control_register(uint8_t control); private: + void set_control_register(uint8_t control, uint8_t changes); std::shared_ptr drives_[2]; int selected_drive_; uint8_t last_control_;