oscarv wrote:
It seems to work well, although I have not yet figured out how the ANSI function keys work. Part of my project for next week, when I should finish my project's VT-100 driver code. Apparently, ANSI function keys != VT-100 function keys.
ANSI/VT extended key sequences are a bit of a convoluted mess - made all the much harder to find when almost all searches for "ANSI character codes" points to lists of *output* sequences - but they are regular enough to make a generalised parser. The main stumbling block is that your key-input routine needs to be able to return "nothing pressed", such as something like kbdkit() or a CONSTAT call, as there are sequences that are terminated by the *absence* of any further characters. The caused me lots of grief with Bell PDP11 Unix as the only API call available is "wait for character".
From research and testing I've compiled the following. The confusion over what to call them extends to the ambiguity of what I've called them
https://mdfs.net/Docs/Comp/Comms/ANSIKeys - description of key sequences
https://mdfs.net/Docs/Comp/Comms/VTKeys - summary table of key sequences
My Console library implements a keypress parser, and returns regular key sequences of 0x180+nn for function keys and 0x1C0+xx for editing keys:
https://mdfs.net/System/C/The Console library is used in my
cZ80Tube emulator.
I wrote the similar keypress parser for
Brandy Basic and
PDP11 BASIC.