From eeafdf2c0375e626883ad88a22facd1d7f1ab4ce Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Sun, 3 Nov 2019 21:58:15 -0500 Subject: [PATCH] Slightly expands list of recognised Intelligent Keyboard commands. --- Machines/AtariST/IntelligentKeyboard.cpp | 22 +++++++++++++++++++++- Machines/AtariST/IntelligentKeyboard.hpp | 7 +++++++ 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/Machines/AtariST/IntelligentKeyboard.cpp b/Machines/AtariST/IntelligentKeyboard.cpp index d62af66a2..b4cb0d621 100644 --- a/Machines/AtariST/IntelligentKeyboard.cpp +++ b/Machines/AtariST/IntelligentKeyboard.cpp @@ -151,7 +151,11 @@ void IntelligentKeyboard::dispatch_command(uint8_t command) { case 0x11: resume(); break; case 0x12: disable_mouse(); break; case 0x13: pause(); break; - case 0x1a: disable_joysticks(); break; + + case 0x14: set_joystick_event_mode(); break; + case 0x15: set_joystick_interrogation_mode(); break; + case 0x16: interrogate_joysticks(); break; + case 0x1a: disable_joysticks(); break; } // There was no premature exit, so a complete command sequence must have been satisfied. @@ -330,5 +334,21 @@ void IntelligentKeyboard::reset_all_buttons() { // MARK: - Joystick Output void IntelligentKeyboard::disable_joysticks() { + joystick_mode_ = JoystickMode::Disabled; } +void IntelligentKeyboard::set_joystick_event_mode() { + joystick_mode_ = JoystickMode::Event; +} + +void IntelligentKeyboard::set_joystick_interrogation_mode() { + joystick_mode_ = JoystickMode::Interrogation; +} + +void IntelligentKeyboard::interrogate_joysticks() { + output_bytes({ + 0xfd, + 0x00, + 0x00 + }); +} diff --git a/Machines/AtariST/IntelligentKeyboard.hpp b/Machines/AtariST/IntelligentKeyboard.hpp index 95ceca6c6..af84e819e 100644 --- a/Machines/AtariST/IntelligentKeyboard.hpp +++ b/Machines/AtariST/IntelligentKeyboard.hpp @@ -121,6 +121,13 @@ class IntelligentKeyboard: // MARK: - Joystick. void disable_joysticks(); + void set_joystick_event_mode(); + void set_joystick_interrogation_mode(); + void interrogate_joysticks(); + + enum class JoystickMode { + Disabled, Event, Interrogation + } joystick_mode_ = JoystickMode::Event; }; }