Skip to content

Commit 8ce781b

Browse files
committed
add a check key command
`VDU 23,0,&99,virtualkey` prompts a new keycode data packet to be sent to MOS with latest state of `virtualkey`
1 parent a8d821c commit 8ce781b

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

video/agon.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@
6464
#define VDP_FONT 0x95 // Font management commands
6565
#define VDP_AFFINE_TRANSFORM 0x96 // Set affine transform
6666
#define VDP_CONTROLKEYS 0x98 // Control keys on/off
67+
#define VDP_CHECKKEY 0x99 // Request updated keyboard data for a key
6768
#define VDP_BUFFER_PRINT 0x9B // Print a buffer of characters literally with no command interpretation
6869
#define VDP_TEXT_VIEWPORT 0x9C // Set text viewport using current graphics coordinates
6970
#define VDP_GRAPHICS_VIEWPORT 0x9D // Set graphics viewport using current graphics coordinates

video/agon_ps2.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ bool getKeyboardKey(uint8_t *keycode, uint8_t *modifiers, uint8_t *vk, uint8_t *
110110
return true;
111111
}
112112
}
113-
113+
114114
if (kb->getNextVirtualKey(&item, 0)) {
115115
if (item.down) {
116116
switch (item.vk) {
@@ -133,7 +133,7 @@ bool getKeyboardKey(uint8_t *keycode, uint8_t *modifiers, uint8_t *vk, uint8_t *
133133
_keycode = 0x7F;
134134
break;
135135
default:
136-
_keycode = item.ASCII;
136+
_keycode = item.ASCII;
137137
break;
138138
}
139139
// Pack the modifiers into a byte

video/vdu_sys.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,14 @@ void VDUStreamProcessor::vdu_sys_video() {
255255
controlKeys = (bool) b;
256256
}
257257
} break;
258+
case VDP_CHECKKEY: {
259+
auto key = readByte_t(); // VDU 23, 0, &99, virtualkey
260+
if (key == -1) return;
261+
// Inject an updated virtual key event for a key, forcing a new keycode packet to be sent
262+
// NB must use a virtual key here, as we can't convert a keycode to a virtual key
263+
auto keyboard = getKeyboard();
264+
keyboard->injectVirtualKey((VirtualKey) key, keyboard->isVKDown((VirtualKey) key), true);
265+
} break;
258266
case VDP_BUFFER_PRINT: { // VDU 23, 0, &9B
259267
auto bufferId = readWord_t();
260268
if (bufferId == -1) return;

0 commit comments

Comments
 (0)