From a58f643b4de8a1d17dd3be67018062440dd01f4a Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Sun, 31 Dec 2023 15:21:20 -0500 Subject: [PATCH] Improve repeat behaviour. --- Machines/Apple/AppleII/AppleII.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/Machines/Apple/AppleII/AppleII.cpp b/Machines/Apple/AppleII/AppleII.cpp index 3d7286963..aa0b767ab 100644 --- a/Machines/Apple/AppleII/AppleII.cpp +++ b/Machines/Apple/AppleII/AppleII.cpp @@ -341,9 +341,8 @@ template class ConcreteMachine: repeat_is_pressed = is_pressed; if constexpr (!is_iie()) { - if(is_pressed && !is_repeat) { - value = last_key; - break; + if(is_pressed && (!is_repeat || pressed_character)) { + keyboard_input = uint8_t(last_pressed_character | 0x80); } } return true; @@ -398,10 +397,13 @@ template class ConcreteMachine: } if(is_pressed) { - last_key = value; + last_pressed_character = pressed_character = value; keyboard_input = uint8_t(value | 0x80); key_is_down = true; } else { + if(value == pressed_character) { + pressed_character = 0; + } if((keyboard_input & 0x3f) == value) { key_is_down = false; } @@ -418,7 +420,8 @@ template class ConcreteMachine: } } - char last_key = 0; + char pressed_character = 0, last_pressed_character = 0; + bool repeat_is_pressed = false; bool shift_is_pressed = false; bool control_is_pressed = false;