procedure KEY_NAME; var Its_There: integer; begin Key:= ' '; {Initialize as one character} if (A > 127) then A:= A - 128; {Open-Apple flagged elsewhere} if (A < 33) then begin Its_There:= pos ('Special', Mod_Key); if (Its_There > 0) then begin case (A) of 8: Key:= 'LeftArrow'; 9: Key:= 'Tab'; 10: Key:= 'DownArrow'; 11: Key:= 'UpArrow'; 13: Key:= 'Enter'; 21: Key:= 'RightArrow'; 27: Key:= 'Escape'; 32: Key:= 'Space' end; delete (Mod_Key, 1, 7); {Delete 'Special'} end else begin Key [1]:= chr (A + 64); {Convert to regular character} if (A = 13) then begin Its_There:= pos ('Control', Mod_Key); if (Its_There = 0) then Key:= 'Return' end end end else begin {Printing characters} Key [1]:= chr (A); if (A = 127) then Key:= 'Delete' end end; {Key_Name} begin write (chr (28)); {Clear viewport} KBD_MODE (128); {Request 2-byte keyboard operation} repeat write ('Enter key combination: '); READ_TWO; MODIFIER; {Interpret Byte_B} KEY_NAME; {Interpret Byte_A} writeln (Mod_Key, Key); until (Key = 'Escape'); KBD_MODE (0) {Restore 1-byte keyboard operation} end. {Two_Bytes}