< -->

Program KlavBuffer;
Uses CRT;
type
 tC = record
   cl, ch : Char;
 end;
var
  KB : array [0..15] of Word absolute $0000:$041E;
  KBc : array [0..15] of tC absolute $0000:$041E;
  i : 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 HexW(X: Word): String;
  {Возвращает 16-ричное написание Х}
const
  HS: array [0..15] of Char = '0123456789ABCDEF';
var
  S: String;
  k: Byte;
begin
  S := '';
  for k := 3 downto 0 do
    S := S+HS[(X shr (k*4)) and 15];
  HexW := S
end;  {HexW}
begin
  ClrScr;
  GotoXY(1, 1);
  for i := 0 to 7 do Write(KB[i], ' ');
  GotoXY(1, 2);
  for i := 8 to 15 do Write(KB[i], ' ');
  GotoXY(1, 3);
  for i := 0 to 15 do Write(HexW(KB[i]), ' ');
  GotoXY(1, 4);
  for i := 0 to 15 do Write(KBc[i].ch, ' ');
  GotoXY(1, 5);
  for i := 0 to 15 do Write(KBc[i].cl, ' ');
  While ReadKey <> #27 do
  begin
   GotoXY(1, 1);
   for i := 0 to 7 do Write(KB[i], ' ');
   GotoXY(1, 2);
   for i := 8 to 15 do Write(KB[i], ' ');
   GotoXY(1, 3);
   for i := 0 to 15 do Write(HexW(KB[i]), ' ');
   GotoXY(1, 4);
   for i := 0 to 15 do Write(KBc[i].ch, ' ');
   GotoXY(1, 5);
   for i := 0 to 15 do Write(KBc[i].cl, ' ');
  end;
  GotoXY(1, 1);
  for i := 0 to 7 do Write(KB[i], ' ');
  GotoXY(1, 2);
  for i := 8 to 15 do Write(KB[i], ' ');
  GotoXY(1, 3);
  for i := 0 to 15 do Write(HexW(KB[i]), ' ');
  GotoXY(1, 4);
  for i := 0 to 15 do Write(KBc[i].ch, ' ');
  GotoXY(1, 5);
  for i := 0 to 15 do Write(KBc[i].cl, ' ');
end.

Назад