Interrupt 31h   Simulate Real Mode                            

Notes:  The CALL 5 entry point does a FAR jump to here
/*-------------------------------------------------------------------
  SimulateRM_Int()
 
  Allows protected-mode software to execute real-mode interrupts
  such as calls to MS-DOS, MS-DOS TSRs, MS-DOS device drivers.
 
  This function implements the "Simulate Real Mode Interrupt"
  function of the DPMI specification v0.9 and later.
 
  Parameters:
 
     bIntNum
        Number of the interrupt to simulate.
 
     lpCallStruct
        Call structure that contains params (register values)
        for bIntNum.
 
  Return Value
     SimulateRM_Int returns TRUE if it succeeded or FALSE if
     it failed.
 
  Comments
     lpCallStruct is a protected-mode selector:offset address, not
     a real-mode segment:offset address.
-------------------------------------------------------------------*/
 
BOOL FAR PASCAL SimulateRM_Int (BYTE bIntNum, LPRMCS lpCallStruct)
{
   BOOL fRetVal = FALSE;        // Assume failure
 
   _asm {
         push di
         mov  ax, 0300h         ; DPMI Simulate Real Mode Interrupt
         mov  bl, bIntNum       ; Number of the interrupt to simulate
         mov  bh, 01h           ; Bit 0 = 1; all other bits must be 0
         xor  cx, cx            ; No words to copy from PM to RM stack
         les  di, lpCallStruct  ; Real mode call structure
         int  31h               ; Call DPMI
         jc   END1              ; CF set if error occurred
 
         mov  fRetVal, TRUE
     END1:
         pop di
        }
   return (fRetVal);
}

struct strRMCS
{
DWORD edi, esi, ebp, RESERVED, ebx, edx, ecx, eax;
WORD wFlags, es, ds, fs, gs, ip, cs, sp, ss;
};


Copyright © 1985 to 2022 Beta Systems                            Last modified: Wednesday, January 05, 2022 .