diff --git a/Machines/Apple/AppleIIgs/ADB.cpp b/Machines/Apple/AppleIIgs/ADB.cpp index 32afec75d..eb3b31f6d 100644 --- a/Machines/Apple/AppleIIgs/ADB.cpp +++ b/Machines/Apple/AppleIIgs/ADB.cpp @@ -76,11 +76,15 @@ uint8_t GLU::get_mouse_data() { // b5–b0: mouse delta. const uint8_t result = registers_[visible_mouse_register_]; - if(visible_mouse_register_ == 2) { - ++visible_mouse_register_; - } else { + if(visible_mouse_register_ == 3) { status_ &= ~uint8_t(CPUFlags::MouseDataFull); } + + // Spelt out at tedious length because Clang has trust issues. + static constexpr int first_register = 2; + static constexpr int second_register = 3; + static constexpr int flip_mask = first_register ^ second_register; + visible_mouse_register_ ^= flip_mask; return result; } @@ -116,7 +120,7 @@ uint8_t GLU::get_status() { // b2: 1 = keyboard data interrupt is enabled. // b1: 1 = mouse x-data is available; 0 = y. // b0: 1 = command register is full (set when command is written); 0 = empty (cleared when data is read). - return status_ | ((visible_mouse_register_ == 2) ? uint8_t(CPUFlags::MouseXIsAvailable) : 0); + return status_ | ((visible_mouse_register_ == 2) ? 0 : uint8_t(CPUFlags::MouseXIsAvailable)); } void GLU::set_status(uint8_t status) { diff --git a/Machines/Apple/AppleIIgs/AppleIIgs.cpp b/Machines/Apple/AppleIIgs/AppleIIgs.cpp index a61f69462..d440db65a 100644 --- a/Machines/Apple/AppleIIgs/AppleIIgs.cpp +++ b/Machines/Apple/AppleIIgs/AppleIIgs.cpp @@ -752,7 +752,7 @@ class ConcreteMachine: is_1Mhz = true; break; case Read(0xc045): - // MMDELTAX byte. + // MMDELTAY byte. *value = 0; is_1Mhz = true; break;