P-Code Instructions (pcode.hlp) (Table of Contents; Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
Ldg<t><n>
                                              Up Contents Index Back
──P-Code Instructions───────────────────────────────────────────────────────
 
  Syntax
 
  Ldg<t><n>
 
  /* Push global variable on stack */
 
  Possible Instructions
 
  LdgW0...LdgW15, LdgWb, LdgLb
 
  See: P-Code Data Types
       P-Code Operands
 
  Description
 
  Loads the value of the specified global variable onto the stack. The
  address of the global is found relative to an internal p-code table of
  function references (for Ldg<t>#) or segment references (for Ldg<t>b).
  Using any global variable will generate this instruction:
 
  wT = wGlobal
 
  Pseudocode equivalent:
 
  //  pfh = pointer-to-function: an internal p-code table
  //  of references
  Push(**(pfh + <n>));
 
  OR
 
  //  pspi = pointer-to-segment: an internal p-code table
  //  of references
  Push(**(pspi + n));
 
  If the index <n> is specified as an immediate operand, then the global
  variable address can be either near or far.
 
  The decision is made by the compiler, and implemented at run time using
  a range check on the index.
 
 
                                     -♦-