Вот KEO дал функцию под Delphi (за что ему огромное спасибо). Не могли бы вы перевести её в Pascal (желательно под MIDLetPascal).
function hex2dec(hex : string) : integer;
type
dectype = array [1..4] of integer;
var
count : integer;
dec : dectype;
begin
if length(hex)<4 then
for count:=1 to (4-length(hex)) do hex:='0'+hex;
for count:=1 to 4 do
case hex[count] of
'0': dec[count]:=0;
'1': dec[count]:=1;
'2': dec[count]:=2;
'3': dec[count]:=3;
'4': dec[count]:=4;
'5': dec[count]:=5;
'6': dec[count]:=6;
'7': dec[count]:=7;
'8': dec[count]:=8;
'9': dec[count]:=9;
'A': dec[count]:=10;
'a': dec[count]:=10;
'B': dec[count]:=11;
'b': dec[count]:=11;
'C': dec[count]:=12;
'c': dec[count]:=12;
'D': dec[count]:=13;
'd': dec[count]:=13;
'E': dec[count]:=14;
'e': dec[count]:=14;
'F': dec[count]:=15;
'f': dec[count]:=15;
end;
hex2dec:=dec[1]*4096+dec[2]*256+dec[3]*16+dec[4];
end; {hex2dec}
Код
function hex2dec(hex : string) : integer;
type
dectype = array [1..4] of integer;
var
count : integer;
dec : dectype;
begin
if length(hex)<4 then
for count:=1 to (4-length(hex)) do hex:='0'+hex;
for count:=1 to 4 do
case hex[count] of
'0': dec[count]:=0;
'1': dec[count]:=1;
'2': dec[count]:=2;
'3': dec[count]:=3;
'4': dec[count]:=4;
'5': dec[count]:=5;
'6': dec[count]:=6;
'7': dec[count]:=7;
'8': dec[count]:=8;
'9': dec[count]:=9;
'A': dec[count]:=10;
'a': dec[count]:=10;
'B': dec[count]:=11;
'b': dec[count]:=11;
'C': dec[count]:=12;
'c': dec[count]:=12;
'D': dec[count]:=13;
'd': dec[count]:=13;
'E': dec[count]:=14;
'e': dec[count]:=14;
'F': dec[count]:=15;
'f': dec[count]:=15;
end;
hex2dec:=dec[1]*4096+dec[2]*256+dec[3]*16+dec[4];
end; {hex2dec}