< -->

Program ScanCode;
Uses CRT;
var Sc:Byte;
Function HexB(b : Byte) : String;
const
  HD: array[0..15] of Char = ('0','1','2','3','4','5','6','7',
  '8','9','A','B','C','D','E','F');
begin
  HexB := HD[b shr 4] + HD[b and $F];
end;
Function KeyBoardScan:Byte;Assembler;
asm
 @1:
    in al, $64
    test al, $01
    jnz @1
    in al, $60
    ret
end;
begin
  Sc := KeyBoardScan;
  While Sc <> $01 do
   begin
     WriteLn(Sc,'   ', HexB(Sc));
     Sc := KeyBoardScan;
     if KeyPressed then ReadKey;
   end;
  WriteLn(Sc,'   ', HexB(Sc));
end.

Назад