From cb22278c7facb95134d2e3e2288c34a723ee5082 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Thu, 15 Feb 2024 08:54:52 -0500 Subject: [PATCH] Switch meaning of bit 2. --- Components/AY38910/AY38910.cpp | 11 +++++++++++ Components/AY38910/AY38910.hpp | 5 +++++ Machines/Apple/AppleII/Mockingboard.hpp | 6 ++---- 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/Components/AY38910/AY38910.cpp b/Components/AY38910/AY38910.cpp index 0984b94ac..625ffb6d0 100644 --- a/Components/AY38910/AY38910.cpp +++ b/Components/AY38910/AY38910.cpp @@ -376,6 +376,17 @@ void AY38910SampleSource::set_control_lines(ControlLines control_line update_bus(); } +template +void AY38910SampleSource::set_reset(bool active) { + if(active == reset_) return; + reset_ = active; + + // Reset upon the leading edge; TODO: is this right? + if(reset_) { + reset(); + } +} + template void AY38910SampleSource::reset() { // TODO: the below is a guess. Look up real answers. diff --git a/Components/AY38910/AY38910.hpp b/Components/AY38910/AY38910.hpp index 755861dcf..afb412e01 100644 --- a/Components/AY38910/AY38910.hpp +++ b/Components/AY38910/AY38910.hpp @@ -84,6 +84,9 @@ template class AY38910SampleSource { /// Strobes the reset line. void reset(); + /// Sets the current value of the reset line. + void set_reset(bool reset); + /*! Gets the value that would appear on the requested interface port if it were in output mode. @parameter port_b @c true to get the value for Port B, @c false to get the value for Port A. @@ -118,6 +121,8 @@ template class AY38910SampleSource { private: Concurrency::AsyncTaskQueue &task_queue_; + bool reset_ = false; + int selected_register_ = 0; uint8_t registers_[16]{}; uint8_t output_registers_[16]{}; diff --git a/Machines/Apple/AppleII/Mockingboard.hpp b/Machines/Apple/AppleII/Mockingboard.hpp index afb7555ce..b068b136d 100644 --- a/Machines/Apple/AppleII/Mockingboard.hpp +++ b/Machines/Apple/AppleII/Mockingboard.hpp @@ -103,13 +103,11 @@ class Mockingboard: public Card { ControlLines( ((value & 1) ? ControlLines::BC1 : 0) | ((value & 2) ? ControlLines::BDIR : 0) | - ((value & 4) ? ControlLines::BC2 : 0) + ControlLines::BC2 ) ); - if(!value) { - ay.reset(); - } + ay.set_reset(!(value & 4)); } else { ay.set_data_input(value); }