1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-07-02 05:29:32 +00:00

Hit and hope appears to have fixed mouse input.

This commit is contained in:
Thomas Harte 2023-08-20 15:02:25 -04:00
parent ae56da2b0d
commit 17f1f05064
2 changed files with 9 additions and 5 deletions

View File

@ -76,11 +76,15 @@ uint8_t GLU::get_mouse_data() {
// b5b0: 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) {

View File

@ -752,7 +752,7 @@ class ConcreteMachine:
is_1Mhz = true;
break;
case Read(0xc045):
// MMDELTAX byte.
// MMDELTAY byte.
*value = 0;
is_1Mhz = true;
break;