CALLHMA - 2


extern long XMM_RequestUMB(unsigned);

extern long XMM_ReleaseUMB(unsigned);

void error(char *msg, long rc);

int main(void)

{

long ver, rc, handle;

static char testmsg[] = " ";

char buf[80];

char far *ptr;

int i;

struct XMM_Move move_d;

// , HIMEM.SYS,

// ,

if (XMM_Installed())

{

printf("\nHIMEM.SYSinstalled");

ver = XMM_Version();

printf("\nver XMM: %4X,%4x",

(short)ver, (short)(ver >> 16));

}

else

{

printf("\nHIMEM.SYSnot found");

exit(-1);

}

// HMA

rc = XMM_RequestHMA(0xffff);

if(rc)

error("Request HMA error",rc);

else

{

// A20

rc = XMM_GlobalEnableA20();

if(rc)

error("Open A20 error",rc);

//

// HMA,

//

FP_SEG(ptr) = 0xffff;

FP_OFF(ptr) = 0x0010;

for(i=0; testmsg[i] != 0; i++)

ptr[i] = testmsg[i];

for(i=0; ptr[i] != 0; i++)

buf[i] = ptr[i];

buf[i] = 0;

//

printf("\n%s",buf);

// A20 HMA

rc = XMM_GlobalDisableA20();

if(rc)

error("Close A20 eror",rc);

rc = XMM_ReleaseHMA();

if(rc)

error("Free HMA error",rc);

}

// EMB 1

handle = XMM_AllocateExtended(1);

if(handle < 0)

error("Request XMB error",handle);

//

// EMB,

//

move_d.Length = strlen(testmsg) + 1;

move_d.SourceHandle = 0;