-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDISPLAY.PAS
More file actions
65 lines (60 loc) · 1.4 KB
/
Copy pathDISPLAY.PAS
File metadata and controls
65 lines (60 loc) · 1.4 KB
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
{ @author: Sylvain Maltais (support@gladir.com)
@created: 2022
@website(https://www.gladir.com/os9-0)
@abstract(Target: Turbo Pascal, Free Pascal)
}
Program DISPLAY;
Var
P:Byte;
W:Word;
Msg,CurrParam:String;
Function StrToUpper(S:String):String;
Var
I:Byte;
Begin
For I:=1 to Length(S)do Begin
If S[I] in['a'..'z']Then S[I]:=Chr(Ord(S[I])-32);
End;
StrToUpper:=S;
End;
Function GetHex(Source:String;Var H:Word):Boolean;
Var
I:Byte;
Digit:Word;
Begin
H:=0;
GetHex:=False;
Source:=StrToUpper(Source);
For I:=1 to Length(Source) do If(Source[I] in ['A'..'F', '0'..'9'])Then Begin
GetHex:=True;
If(Source[I]>='A')Then Digit:=Ord(Source[I])-Ord('A')+10
Else Digit:=Ord(Source[I])-Ord('0');
H:=(H Shl 4)+Digit;
End;
End;
BEGIN
P:=0;
Msg:='';
Repeat
Inc(P);
CurrParam:=ParamStr(P);
If Length(CurrParam)=0Then Break;
If CurrParam='/?'Then Begin
WriteLn('DISPLAY Cette commande permet d''afficher un message encodee en hexadecimal.');
WriteLn;
WriteLn('Syntaxe:');
WriteLn;
WriteLn('DISPLAY [/?] hex [...]');
WriteLn;
WriteLn(' /? Ce parametre permet d''afficher l''aide sur cette commande');
WriteLn(' hex Ce parametre permet d''indiquer des nombres hexadecimal de 2 chiffres');
Exit;
End
Else
Begin
If GetHex(ParamStr(P),W)Then Msg:=Msg+Chr(Lo(W));
End;
If P>255Then Break;
Until CurrParam='';
If Msg<>''Then WriteLn(Msg);
END.