Aaron Giles on Nostr: Funny bug in Day of the Tentacle. They install a keyboard filter off of INT 15h that ...
Funny bug in Day of the Tentacle.
They install a keyboard filter off of INT 15h that I wasn't previously calling. Now I am.
The semantics are that the scancode is in AL and the carry flag is set. When the filter returns, it's supposed to clear the carry to ignore the keypress, or set it to allow it to process. It can also modify the scancode in AL. The path where they want to ignore the keypress, however, has a critical bug:
MOV AL, 0
CLC
IRET
Seems logical except that the IRET restores the flags from when the INT 15h was called, so the CLC doesn't actually do anything, and the carry is always set before calling the filter.
It's the fact that they clear the scancode to 0 that saves them. For some reason my keyboard logic is generating keypresses in response to the 0 scancode, which it shouldn't be doing, but once I fix that hopefully things will work as intended.
Published at
2023-10-13 22:24:34Event JSON
{
"id": "9ac42aae6ea17a29672f8f8e8b483c306a946eb2b20766dc47c034d597b65122",
"pubkey": "b26dd3f57c56ad6cfdbe6f9be766b3f626d66ee52b7ba215b1c80bf6581d0a33",
"created_at": 1697235874,
"kind": 1,
"tags": [
[
"proxy",
"https://corteximplant.com/users/aaronsgiles/statuses/111230050282125618",
"activitypub"
]
],
"content": "Funny bug in Day of the Tentacle. \n\nThey install a keyboard filter off of INT 15h that I wasn't previously calling. Now I am.\n\nThe semantics are that the scancode is in AL and the carry flag is set. When the filter returns, it's supposed to clear the carry to ignore the keypress, or set it to allow it to process. It can also modify the scancode in AL. The path where they want to ignore the keypress, however, has a critical bug:\n\nMOV AL, 0\n CLC\n IRET\n\nSeems logical except that the IRET restores the flags from when the INT 15h was called, so the CLC doesn't actually do anything, and the carry is always set before calling the filter.\n\nIt's the fact that they clear the scancode to 0 that saves them. For some reason my keyboard logic is generating keypresses in response to the 0 scancode, which it shouldn't be doing, but once I fix that hopefully things will work as intended.",
"sig": "657d7f8db3cfde8f6421ba4c5ffb7b14c70ca64ed363e73cfa90ecc355d5cb9280a783b9faa7cf4b23fe2111c1a12bb4f96c1fb065e2db2154d63b8866a002c6"
}