Why Nostr? What is Njump?
2023-10-13 22:24:34

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.
Author Public Key
npub1kfka8atu26kkeld7d7d7we4n7cndvmh99da6y9d3eq9lvkqapges3rrt7k