function InByte: byte;
begin
  if BytePtr>127 then
    begin BlockRead (RelFile, Buffer,1); 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;

