From 3618e2755393cc5a3e69fd0207f1912ab2b9a5fd Mon Sep 17 00:00:00 2001 From: folkert van heusden Date: Fri, 24 Mar 2023 15:36:07 +0100 Subject: [PATCH] byte access to PIR register --- bus.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/bus.cpp b/bus.cpp index 3e57e89..f8d53db 100644 --- a/bus.cpp +++ b/bus.cpp @@ -182,9 +182,13 @@ uint16_t bus::read(const uint16_t a, const bool word_mode, const bool use_prev, return 128; } - if (a == ADDR_PIR) { // PIR + if (a == ADDR_PIR || a == ADDR_PIR + 1) { // PIR if (!peek_only) DOLOG(debug, false, "read PIR"); - return PIR; + + if (word_mode == false) + return PIR; + + return a == ADDR_PIR ? PIR & 255 : PIR >> 8; } if (a == ADDR_SYSTEM_ID) {