7.3 Types, Variables and Constants

Constants

Constants returned by get__run__mode
Tells you under what memory environment (e.g. memory manager) the program currently runs.
 rm_unknown = 0; { unknown }
 rm_raw     = 1; { raw (without HIMEM) }
 rm_xms     = 2; { XMS (for example with HIMEM, without EMM386) }
 rm_vcpi    = 3; { VCPI (for example HIMEM and EMM386) }
 rm_dpmi    = 4; { DPMI (for example \dos box or 386Max) }
Note: GO32V2 always creates DPMI programs, so you need a suitable DPMI host like CWSDPMI.EXE or a Windows DOS box. So you don’t need to check it, these constants are only useful in GO32V1 mode.
Processor flags constants
They are provided for a simple check with the flags identifier in the trealregs type. To check a single flag, simply do an AND operation with the flag you want to check. It’s set if the result is the same as the flag value.
 const carryflag = $001;
 parityflag      = $004;
 auxcarryflag    = $010;
 zeroflag        = $040;
 signflag        = $080;
 trapflag        = $100;
 interruptflag   = $200;
 directionflag   = $400;
 overflowflag    = $800;

Predefined types

 type tmeminfo = record
             available_memory : Longint;
             available_pages : Longint;
             available_lockable_pages : Longint;
             linear_space : Longint;
             unlocked_pages : Longint;
             available_physical_pages : Longint;
             total_physical_pages : Longint;
             free_linear_space : Longint;
             max_pages_in_paging_file : Longint;
             reserved : array[0..2] of Longint;
    end;
Holds information about the memory allocation, etc.

Table 7.1: Record description
Record entry Description


available_memory Largest available free block in bytes.
available_pages Maximum unlocked page allocation in pages
available_lockable_pages Maximum locked page allocation in pages.
linear_space Linear address space size in pages.
unlocked_pages Total number of unlocked pages.
available_physical_pages Total number of free pages.
total_physical_pages Total number of physical pages.
free_linear_space Free linear address space in pages.
max_pages_in_paging_file Size of paging file/partition in pages.

NOTE: The value of a field is -1 (0ffffffffh) if the value is unknown, it’s only guaranteed, that available_memory contains a valid value. The size of the pages can be determined by the get__page__size() function.
 type
 trealregs = record
   case Integer of
     1: { 32-bit }
       (EDI, ESI, EBP, Res, EBX, EDX, ECX, EAX: Longint;
        Flags, ES, DS, FS, GS, IP, CS, SP, SS: Word);
     2: { 16-bit }
       (DI, DI2, SI, SI2, BP, BP2, R1, R2: Word;
        BX, BX2, DX, DX2, CX, CX2, AX, AX2: Word);
     3: { 8-bit }
       (stuff: array[1..4] of Longint;
        BL, BH, BL2, BH2, DL, DH, DL2, DH2, CL,
        CH, CL2, CH2, AL, AH, AL2, AH2: Byte);
     4: { Compat }
       (RealEDI, RealESI, RealEBP, RealRES, RealEBX,
        RealEDX, RealECX, RealEAX: Longint;
        RealFlags, RealES, RealDS, RealFS, RealGS,
        RealIP, RealCS, RealSP, RealSS: Word);
     end;
     registers = trealregs;
These two types contain the data structure to pass register values to a interrupt handler or real mode callback.
 type tseginfo = record
              offset : Pointer; segment : Word; end;
This record is used to store a full 48-bit pointer. This may be either a protected mode selector:offset address or in real mode a segment:offset address, depending on application. See also: Selectors and descriptors, DOS memory access, Interrupt redirection

Variables.

 var dosmemselector : Word;
Selector to the DOS memory. The whole DOS memory is automatically mapped to this single descriptor at startup. This selector is the recommened way to access DOS memory.
   var int31error : Word;
This variable holds the result of a DPMI interrupt call. Any nonzero value must be treated as a critical failure.