[comp.lang.modula2] CalcPos

BOTCHAIR@UOGUELPH.BITNET (Alex Bewley) (05/25/88)

  Has anyone seen a procedure that takes record size and length and calculates
the 'high' and 'low' variables required by pc-dos (or ms-dos).  It was in a
book with a blue cover, was written by two people and was published in
Waterloo, Canada.  I remember various parts of the procedure but not the
essential parts.  For those who don't know what I am talking about...  When
randomly jumping around in files, dos requires an absolute position in the
file in the form of two cardinals.  One of them, 'low', specifies where the
pointer is to go in a 64K block of the file.  The other, 'high', specifies
which 64K block of the file to point to.  The files that I am jumping
around in are just lists of records.  The procedure that I need takes the
record I want to access and the size of the record and calculates the
appropriate 'high' and 'low' value.  Here's the fragment that I remember.

PROCEDURE CalcPos(    RecNo : CARDINAL;     RecSize : CARDINAL;
                  VAR High  : CARDINAL; VAR Low     : CARDINAL);

CONST
  MAXCARD = 65535;

(* that's all *)

Any help would be really appreciated.  I am using Logitech's v3.0 compiler.

      Alex