+ added method TRelRelocation.EncodeFlags that encodes the flags to string that can be included in the .rel file

git-svn-id: trunk@45263 -
This commit is contained in:
nickysn 2020-05-05 03:23:51 +00:00
parent 03acadaf1e
commit 0d11b5bf29

View File

@ -61,6 +61,7 @@ interface
constructor CreateSymbol(ADataOffset:TObjSectionOfs;s:TObjSymbol;Atyp:TObjRelocationType);
constructor CreateSection(ADataOffset:TObjSectionOfs;aobjsec:TObjSection;Atyp:TObjRelocationType);
function EncodeFlags: string;
end;
{ TRelObjData }
@ -125,6 +126,42 @@ implementation
RelFlags:=[];
end;
function TRelRelocation.EncodeFlags: string;
var
FlagsWord: Word;
begin
FlagsWord:=0;
if rrfByte in RelFlags then
Inc(FlagsWord,1);
if rrfSymbol in RelFlags then
Inc(FlagsWord,2);
if rrfPcRelative in RelFlags then
Inc(FlagsWord,4);
if rrfTwoByteObjectFormatForByteData in RelFlags then
Inc(FlagsWord,8);
if rrfUnsignedByteData in RelFlags then
Inc(FlagsWord,16);
if rrfPage0Reference in RelFlags then
Inc(FlagsWord,32);
if rrfPageNNNReference in RelFlags then
Inc(FlagsWord,64);
if rrfMSBWith2ByteMode in RelFlags then
Inc(FlagsWord,128);
if rrfThreeByteObjectFormatForByteData in RelFlags then
Inc(FlagsWord,256);
if rrfRealMSBForThreeByteMode in RelFlags then
Inc(FlagsWord,512);
if rrfReserved10 in RelFlags then
Inc(FlagsWord,1024);
if rrfReserved11 in RelFlags then
Inc(FlagsWord,2048);
if (FlagsWord<=255) and ((FlagsWord and $F0)<>$F0) then
Result:=HexStr(FlagsWord,2)
else
Result:=HexStr($F0 or Byte(FlagsWord shr 8),2)+' '+HexStr(Byte(FlagsWord),2);
end;
{*****************************************************************************
TRelObjData
*****************************************************************************}