#include <process.h>
#include <stdio.h>
#include <dos.h>
#include <io.h>
#include <mem.h>
#include <conio.h>
#include <string.h>
#include <dir.h>
#include <math.h>
char EMS=0;
unsigned PHYMEMADDR;
unsigned handle;
unsigned char sbyt0(int n)
{switch(n)
{ case 0:return 0x00;
case 1:return 0x80;
case 2:return 0xc0;
case 3:return 0xe0;
case 4:return 0xf0;
case 5:return 0xf8;
case 6:return 0xfc;
case 7:return 0xfe;
}
}
unsigned char cbyt0(int n)
{switch(n)
{ case 0:return 0xff;
case 1:return 0x7f;
case 2:return 0x3f;
case 3:return 0x1f;
case 4:return 0x0f;
case 5:return 0x07;
case 6:return 0x03;
case 7:return 0x01;
}
}
unsigned char sbyt1(int n)
{switch(n)
{ case 0:return 0x00;
case 1:return 0x01;
case 2:return 0x03;
case 3:return 0x07;
case 4:return 0x0f;
case 5:return 0x1f;
case 6:return 0x3f;
case 7:return 0x7f;
}
}
unsigned char cbyt1(int n)
{switch(n)
{ case 0:return 0xff;
case 1:return 0xfe;
case 2:return 0xfc;
case 3:return 0xf8;
case 4:return 0xf0;
case 5:return 0xe0;
case 6:return 0xc0;
case 7:return 0x80;
}
}
char test_ems()
{ int i;
union REGS inregs,outregs;
struct SREGS segs;
struct DeviceHeader {
struct DeviceHeader far *link;
unsigned attributes;
unsigned strategy_offset;
unsigned interrupt_offset;
char name_of_number_of_units[8];
} far *dev;
unsigned char major,minor,c[13];
inregs.x.ax=0x3001;
intdos(&inregs,&outregs);
major=outregs.h.al;
minor=outregs.h.ah;
if (major<2) return(0);
else
{
inregs.h.ah=0x52;
intdosx(&inregs,&outregs,&segs);
if (major==2)
dev=(struct DeviceHeader far *)MK_FP(segs.es+1,outregs.x.bx+7);
else
if ((major==3) && (minor==0))
dev=(struct DeviceHeader far *)MK_FP(segs.es+2,outregs.x.bx+8);
else
dev=(struct DeviceHeader far *)MK_FP(segs.es+2,outregs.x.bx+2);
c[8]=NULL;
while (FP_OFF(dev)!=0xffff)
{
if (dev->attributes & 0x8000)
{
for (i=0;i<8;i++)
c[i]=dev->name_of_number_of_units[i];
}
if (!strcmp(c,"EMMXXXX0"))
{
EMS=1;
return(1);
}
dev=dev->link;
}
}
return(0);
}
char get_EMS_status()
{ union REGS regs;
char tmp=0xff;
if (EMS)
{ regs.h.ah=0x40;
int86(0x67,®s,®s);
[1] [2] [3] [4] 下一页
如果您有什么疑问,可以至论坛提出或者解答他人的疑问 返回页面顶部