Here is a tutorial on how to use EMS.
And here is the code for testing to see if EMM386.EXE is present or not:
Code:
#include <dos.h>
#define WINDOWS 0x845A
#define DOS 0x84A5
int CheckForEMS(void)
{
//In pure C
//union REGS regs;
//regs.x.ax=0xFFA5;
//int86(0x67, & regs, & regs);
//return regs.x.ax;
//In inline asm
asm
{
mov ax,0FFA5h
int 67h
}
return _AX; //Sort of redundant, but....
}
int main(void)
{
switch (CheckForEMS())
{
case DOS:break; //We are in pure DOS with EMM386 installed
case WINDOWS:break; //We are in Windows with EMM386 installed
default: //EMM386.EXE not installed
}
...
return 0;
}