47 lines
628 B
ObjectPascal
47 lines
628 B
ObjectPascal
unit jtag.vme.tools;
|
|
|
|
interface
|
|
|
|
function FlipByte( Data: byte): byte;
|
|
function FlipWord( Data: word): word;
|
|
|
|
implementation
|
|
|
|
function FlipByte( Data: byte): byte;
|
|
var
|
|
i: integer;
|
|
|
|
begin
|
|
result := 0;
|
|
|
|
for i:=0 to 7 do
|
|
begin
|
|
result := result shl 1;
|
|
|
|
if Data and $01 = $01 then
|
|
result := result or $1;
|
|
|
|
Data := Data shr 1;
|
|
end;
|
|
end;
|
|
|
|
function FlipWord( Data: word): word;
|
|
var
|
|
i: integer;
|
|
|
|
begin
|
|
result := 0;
|
|
|
|
for i:=0 to 15 do
|
|
begin
|
|
result := result shl 1;
|
|
|
|
if Data and $01 = $01 then
|
|
result := result or $1;
|
|
|
|
Data := Data shr 1;
|
|
end;
|
|
end;
|
|
|
|
end.
|