Using DPMI Services

 DOS Extenders such as PharLap's (used in Lotus 1-2-3) and many popular
 compilers support DPMI-aware libraries and toolkits.  You are advised to
 use such library calls rather than access DPMI services directly.

 Write or call... Intel Literature JP26  (Phone: 800-548-4725)
                  3065 Bowers Ave.
                  P.O. Box 58065
                  Santa Clara CA 95051-8065

 ...for a printed version of the DPMI spec (with required background and
 some semi-tutorial information).

 ■ DPMI INT 31H Services are only available while in protected mode.
   Use INT 2fH 1687H to obtain the address you must call to switch to
   protected mode.
 ■ Set up the registers and call that address (see example, below).
 ■ When in protected mode, use INT 31H DPMI Services.
 ■ To exit back to real mode, use DOS Fn 4cH (terminate).

 The following code fragment illustrates switching into protected mode:

  ;--------------------- get the DPMI entry-address for mode switch
  dd   pfpDpmiSwitch    ;we'll put the mode-switch entry address here
   .
   .
   .
  mov  AX, 1687h        ;see INT 2fH 1687H (get switch fn addr)
  int  2fH
  cmp  AX,0
  jne  no_DPMI          ;bail out -- no DPMI host present

  mov  pfpDpmiFns,di    ;save the addr of API entry point
  mov  pfpDpmiFns+2,es
  ;--------------------- allocate the memory needed by the host
  mov  BX,SI            ;required memory, in paragraphs
  mov  AH,48H           ;DOS fn 48H allocates memory
  int  21H
  jc   err_exit         ;bail out, no mem available

  mov  ES,AX            ;AX is the segment of the allocation
  mov  AX,0             ;specify that caller is a 16-bit client
  call pfpDpmiSwitch    ;call the switch address (see INT 2fH 1687H)
  jc   cantSwitch       ;bail out on error

  ;--------------------- try a fn call
  mov  AX,0400H         ;see INT 31H 0400H (get DPMI version)
  int  31H
  jc   errHandler
   .
   .
   .
  mov AX,4c00H          ;DOS fn 4cH terminates prog & switches to real mode
  int 21H

See Also: DPMI Services
          INT 2fH 16xxH (Enh386 Windows Services & Notifications)
          INT 2fH: Multiplex Interrupt
          DOS Functions
                                    -♦-