Therefore this explanation is not applicable to the PC arena. The similarity that they do posess is that when a key is pressed, a unique code is generated. The state of the Shift, Control, Num Lock, Alt modifiers either alter the unique code generated or a seperate code is generated to identify to the next layer that the key pressed should be modified. This is a required layer if the user is connected to the host via some emulation software. When you press a key on the keyboard while in cat -v , the escape sequences that the terminal emulator has generated are displayed.
Some systems require the Enter key to be pressed before the escape sequence is displayed.
Following the escape is any number of other characters, which together form a unique sequence of characters. When using a terminal directly, firmware on the terminal does the generation of the escape sequences. Some terminals allow the user to specify what escape sequence will be generated when particular keys are pressed. The value of TERM is used to setup various settings for the terminal. This translation can also be changed by the user.