From a841994aa17754efb1cd702bca8dc09df0cdba3c Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Wed, 13 May 2026 17:16:30 -0400 Subject: [PATCH] Catch row selection correctly; simplify mutation. --- Machines/Tandy/CoCo/CoCo.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Machines/Tandy/CoCo/CoCo.cpp b/Machines/Tandy/CoCo/CoCo.cpp index 94b065ffe..06003fefe 100644 --- a/Machines/Tandy/CoCo/CoCo.cpp +++ b/Machines/Tandy/CoCo/CoCo.cpp @@ -426,7 +426,7 @@ private: template void output(const uint8_t value) { - if constexpr (port == Motorola::MC6821::Port::B) { + if constexpr (port == Motorola::MC6821::Port::A) { keyboard_row_ = value; } if constexpr (port == Motorola::MC6821::Port::B) { @@ -458,14 +458,14 @@ private: } void set_key_pressed(const int column, const int row, bool is_pressed) { - const auto column_mask = uint8_t(0xff ^ (1 << column)); - const auto row_mask = uint8_t(0xff ^ (1 << row)); + const auto column_mask = uint8_t(1 << column); + const auto row_mask = uint8_t(1 << row); - key_columns_[row] &= column_mask; - key_rows_[column] &= row_mask; + key_columns_[row] &= ~column_mask; + key_rows_[column] &= ~row_mask; if(!is_pressed) { - key_columns_[row] |= ~column_mask; - key_rows_[column] |= ~row_mask; + key_columns_[row] |= column_mask; + key_rows_[column] |= row_mask; } }