home *** CD-ROM | disk | FTP | other *** search
- {
- Demonstration of EnhKbd unit. See the comments within that unit
- for more information.
- }
-
- {$R-,S-}
-
- program Kbd;
- uses
- EnhKbd,
- Dos;
-
- const
- Digits : array[0..$F] of Char = '0123456789ABCDEF';
- var
- KW : Word;
-
- function HexW(W : Word) : string;
- {-Return hex string for word}
- begin
- HexW[0] := #4;
- HexW[1] := Digits[hi(W) shr 4];
- HexW[2] := Digits[hi(W) and $F];
- HexW[3] := Digits[lo(W) shr 4];
- HexW[4] := Digits[lo(W) and $F];
- end;
-
- function ReadKeyWord : Word;
- {-Return ASCII code in low byte, scan code in high byte}
- var
- Regs : registers;
- begin
- with Regs do begin
- ah := $0;
- intr($16, Regs);
- ReadKeyWord := ax;
- end;
- end;
-
- begin
- WriteLn('Enhanced keyboard? ', HasEnhancedKbd);
- WriteLn('Press keys to see scan words.');
- WriteLn('Press Enter to quit, Ctrl-Enter to toggle enhanced keys');
- repeat
- KW := ReadKeyWord;
- WriteLn(HexW(KW));
- if KW = $1C0A then
- EnableEnhanced := not EnableEnhanced;
- until lo(KW) = 13;
- end.