{ =================================================== }
{       Das MKINL Programm -- INCLUDE Dateien         }
{                                                     }
{            TEIL 3 : INLINE Programme                }
{                                                     }
{ =================================================== }

function InByte: byte;
begin
  if BytePtr>127 then
                   begin
                     {$I-}BlockRead (RelFile,Buffer,1){$I+};
                     if IOResult>0 then IOErr('Ungueltiges Format der REL Datei');
                     BytePtr := 0
                   end;
  InByte := Buffer[BytePtr];
  BytePtr := succ(BytePtr)
end;

function GetBits (NBits: Bits): byte;
begin
  WB.High := 0;
  if BitCnt<NBits then
                    begin
                      WW := WW shl BitCnt;
                      NBits := NBits - BitCnt;
                      WB.Low := InByte;
                      BitCnt := 8
                    end;
  WW := WW shl NBits;
  BitCnt := BitCnt - NBits;
  GetBits := WB.High
end;

function GetByte: byte;
begin
  if BitCnt=0 then GetByte := InByte
              else GetByte := GetBits(8)
end;

function GetWord: integer;
var
  WB           : ByteRec;
  WW           : integer absolute WB;
begin
  with WB do
          begin
            Low  := GetByte;
            High := GetByte
          end;
 GetWord := WW
end;

function Hex (Number: integer): HexString;
const
  HexDigit:array[0..15]of char='0123456789abcdef';
var
  N            : integer;
  IntStr       : HexString;
begin
  IntStr := '0000';
  for N:= 4 downto 1 do
  begin
    IntStr[N] := HexDigit[Number and $0F];
    Number := Number shr 4;
  end;
  Hex := IntStr
end;

function Max (A,B: integer): integer;
begin
  if A>=B then
            Max := A
          else
            Max := B
end;

function RetrWd  (N: integer): integer;
var
  WB           : ByteRec;
  WW           : integer absolute WB;
begin
  with WB do
  begin
    Low := Prog[N].Cont;
    High:= Prog[Succ(N)].Cont
  end;
  RetrWd := WW
end;

