1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69
|
Uses Crt;
Var
Ch : Char;
Ext : Boolean;
PortX : Word;
Base : Byte;
S: string;
Procedure WriteIt(Value: Byte);
const
Hex: array[0..15] of Char = '0123456789ABCDEF';
Begin
If Not Ext Then TextColor(8)
Else TextColor(4);
if Value and $F0 = 0 then Write('0');
If Not Ext Then TextColor(7)
Else TextColor(12);
if Value and $F0 <> 0 then Write(Hex[(Value shr 4) and 15]);
Write(Hex[Value and 15]);
If Not Ext Then TextColor(8)
Else TextColor(4);
Write('h');
TextColor(7);
Ext := False;
End;
Procedure OutChar(X, Y : Byte; Value : Char);
Var
Scr : Array[0..24, 0..79] Of Record
Ch : Char;
Color : Byte;
End Absolute $B800:$0000;
Begin
Scr[Y - 1, X - 1].Color := 9;
Scr[Y - 1, X - 1].Ch := Value;
End;
{$B+}
Begin
ClrScr;
TextColor(7);
Repeat
Base := Port[$60];
Repeat
PortX := Port[$60];
Until (KeyPressed) Or (PortX <> Base);
Ch := ReadKey;
If Ch = #0 Then
Begin
Ext := True;
Ch := ReadKey;
End
Else Ext := false;
Write('Caractère : ');
OutChar(13, WhereY, Ch);
WriteLn;
Write('Ascii : ');
WriteIt(Ord(Ch));
Str(Ord(Ch), S);
Write('(' + S + ')':9);
Write(' Keyboard : ');
WriteIt(Port[$60] and $FF);
WriteLn;
WriteLn;
Until Ch = #27;
End. |
Partager