Category : C Source Code
Archive   : EMS_C.ZIP
Filename : EMSTEST.C

 
Output of file : EMSTEST.C contained in archive : EMS_C.ZIP
#include
#include
#include
#include
#include "ems.h"

#define PAGESIZE 16384
#define NELEM PAGESIZE / sizeof(int)


void main()
{
unsigned a1,a2,status,frameSeg,handle;
int n,y[NELEM], z[NELEM], far *frame;

clrscr();

cputs("Checking EMS Board:");
if(!isEMS())
cputs("\r\n EMS not detected");
else
{
cputs("\r\n EMS is active");
status = EMSstatus();
cprintf("\r\n Initial Status is %d", status);

if(status)
EMSerror(status);
else
cputs(" (No Error) ");

if((status = EMSversion ( &a1, &a2)) == 0)
cprintf("\r\n Version number is %d.%02d", a1, a2);
else EMSerror(status);

if((status = EMSframe (&frameSeg)) == 0)
cprintf("\r\n Frame is at segment %4X", frameSeg);
else EMSerror(status);

if((status = EMSpages (&a1,&a2)) == 0)
{
cprintf("\r\n Pages: total = %u", a1);
cprintf("\r\n free = %u", a2);
}
else
EMSerror(status);

cputs("\r\nEMS write/read Test:");

cputs("\r\n Opening a handle");

if((status = EMSopen (&handle,1)) != 0)
{
EMSerror(status);
exit(1);
}

cprintf("\r\nMapping handle %X to frame page 0",handle);
if((status= EMSmap(handle,0,PP0)) != 0)
{
EMSerror(status);
exit(1);
}
EMSpages ( &a1,&a2 );
cprintf("\r\n Free pages now = %d", a2);

for(n=0;n < NELEM; n++)
y[n] = n;

frame = MK_FP(frameSeg,PP0);
for(n=0; n frame[n] = y[n];

cprintf("\r\n Remapping handle %X to frame page 2",handle);

if((status = EMSmap (handle,0,PP2)) != 0)
{
EMSerror(status);
exit(1);
}

frame = MK_FP(frameSeg,PP2);
for(n=0; n z[n] = frame[n];

if(strncmp((char*) y, (char*) z, PAGESIZE) ==0)
cputs("\r\n\n ** Test Passed **");
else
cputs("\r\n\n ** Test Failed **");

cprintf("\r\n\nClosing handle %X", handle);

if((status = EMSclose(handle)) != 0)
EMSerror(status);

EMSpages(&a1,&a2);
cprintf("\r\nFree pages now = %d", a2);
cputs("\r\n\nTest Completed");
}
}


  3 Responses to “Category : C Source Code
Archive   : EMS_C.ZIP
Filename : EMSTEST.C

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/