[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
absolute                 Fixes at Absolute Address                       [TP]

 var
   vname : vtype absolute segment:offset;
   vname : vtype absolute pname;

    Allows you to declare vname to be at a specific address, which can be
    specified directly in SEG:OFF form, or which can be the same address
    as a given variable or parameter.

           vname    the name of the variable being declared.

           vtype    the data type of the variable being declared.

         segment    either the segment name CSeg or DSeg or a segment
                    address (a 4-digit hex value; format is $xxxx).

          offset    a 4-digit hexadecimal value ($xxxx).

           pname    the name of a previously declared variable or
                    parameter.

  -------------------------------- Example ---------------------------------

           var
             Name : string[16];
             NLen : Byte absolute Name;     { same address as Name }
             Cmds : string[255] absolute CSeg:$0080;

    Combined with typeless parameters, Absolute allows you to pass
    variable-length data structures (including arrays and records) to a
    procedure. The following function looks for a given byte value in a
    data structure and returns the offset (in bytes) from the start of the
    structure.

           {$R-}                    { disable range checking }
           function Scan(var Source; Size : Integer; Data : Byte) : Integer;

           var
             List  : array[0..MaxInt] of Byte absolute Source;
             Indx  : Integer;
             Found : Boolean;

           begin
             Indx := 0; Found := False;
             while (Indx <= Size) and not Found do
               if List[Indx] = Data
                 then Found := True
                 else Indx := Indx + 1;
             if Found
               then Scan := Indx
               else Scan := -1
           end;
           {$R+}                    { enable range checking again }

See Also: CSeg
This page created by ng2html v1.05, the Norton guide to HTML conversion utility. Written by Dave Pearson