#ifndef _TDPMI16_
#define _TDPMI16_ 1

#define INITTINYDPMI INITTINYDPMI16
:void CARRYFLAG INITTINYDPMI16(){
   #code32 FALSE
   AX=1687h;
   $Int 2fh
   AX-=BX;
   $Push ES,DI
   AX=DS;
   AX+=SI;		//paras for DPMI host area
   ES=AX;
   AX><BX;
   $call SSDWORD[ESP];	//call DPMI mode switch entry point
}

:void EXITTINYDPMI(){
  AH=04ch;
  $int 21h;
}

:void MAKEFLATBASE0((E)BX){
  @MAKEBASE(0,0);	      //set base to 0
  (E)AX++; (E)CX--; (E)DX--; $int 31h  //set limit to 4G
}

:void CARRYFLAG MAKEBASE((E)CX,(E)DX){
  AX=7; $int 31h	     //set segment base address
}

:void CARRYFLAG MAKEFLAT(BX){
  AH=8; CX=0ffffh; (E)DX=(E)CX; $int 31h  //set limit to 4G
}

:void CARRYFLAG GETFREEMEM((E)DI){
  AX=500h;
  $int 31h
}

:void CARRYFLAG ALLOCMEM(BX,CX){
  AX=501h;
  $int 31h
}

:void CARRYFLAG FREEMEM(SI,DI){
 AX=502h;
 $int 31h
}
#endif