diff --git a/Machines/Atari/ST/IntelligentKeyboard.cpp b/Machines/Atari/ST/IntelligentKeyboard.cpp index fe21b9866..17975563e 100644 --- a/Machines/Atari/ST/IntelligentKeyboard.cpp +++ b/Machines/Atari/ST/IntelligentKeyboard.cpp @@ -167,10 +167,30 @@ void IntelligentKeyboard::dispatch_command(uint8_t command) { case 0x12: disable_mouse(); break; case 0x13: pause(); 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; + /* Joystick commands. */ + case 0x14: set_joystick_event_mode(); break; + case 0x15: set_joystick_interrogation_mode(); break; + case 0x16: interrogate_joysticks(); break; + case 0x17: + if(command_sequence_.size() != 2) return; + set_joystick_monitoring_mode(command_sequence_[1]); + break; + case 0x18: set_joystick_fire_button_monitoring_mode(); break; + case 0x19: { + if(command_sequence_.size() != 7) return; + + VelocityThreshold horizontal, vertical; + horizontal.threshold = command_sequence_[1]; + horizontal.prior_rate = command_sequence_[3]; + horizontal.post_rate = command_sequence_[5]; + + vertical.threshold = command_sequence_[2]; + vertical.prior_rate = command_sequence_[4]; + vertical.post_rate = command_sequence_[6]; + + set_joystick_keycode_mode(horizontal, vertical); + } break; + case 0x1a: disable_joysticks(); break; } // There was no premature exit, so a complete command sequence must have been satisfied. @@ -370,3 +390,12 @@ void IntelligentKeyboard::interrogate_joysticks() { joystick2->get_state() }); } + +void IntelligentKeyboard::set_joystick_monitoring_mode(uint8_t rate) { +} + +void IntelligentKeyboard::set_joystick_fire_button_monitoring_mode() { +} + +void IntelligentKeyboard::set_joystick_keycode_mode(VelocityThreshold horizontal, VelocityThreshold vertical) { +} diff --git a/Machines/Atari/ST/IntelligentKeyboard.hpp b/Machines/Atari/ST/IntelligentKeyboard.hpp index f7f62a537..488bc5aef 100644 --- a/Machines/Atari/ST/IntelligentKeyboard.hpp +++ b/Machines/Atari/ST/IntelligentKeyboard.hpp @@ -130,6 +130,14 @@ class IntelligentKeyboard: void disable_joysticks(); void set_joystick_event_mode(); void set_joystick_interrogation_mode(); + void set_joystick_monitoring_mode(uint8_t rate); + void set_joystick_fire_button_monitoring_mode(); + struct VelocityThreshold { + uint8_t threshold; + uint8_t prior_rate; + uint8_t post_rate; + }; + void set_joystick_keycode_mode(VelocityThreshold horizontal, VelocityThreshold vertical); void interrogate_joysticks(); enum class JoystickMode { @@ -158,7 +166,7 @@ class IntelligentKeyboard: case Input::Fire: mask = 0x80; break; } - if(is_active) state_ &= ~mask; else state_ |= mask; + if(is_active) state_ |= mask; else state_ &= ~mask; } uint8_t get_state() { @@ -171,8 +179,8 @@ class IntelligentKeyboard: } private: - uint8_t state_ = 0x8f; - uint8_t returned_state_ = 0x8f; + uint8_t state_ = 0x00; + uint8_t returned_state_ = 0x00; }; std::vector> joysticks_; };