#if! define(_DOS_DEF_)
#include<dos.h>
#endif
#define BYTE unsigned char
#define WORD unsigned int
#define DWORD unsigned long
#define BOOL BYTE
#define TRUE 1
#define FALSE !TRUE
WORD FONT_SEG ;
WORD FONT_OFF;
void setmode();
void waitkey();
void closemode();
void GetFontAdd();
void locate(int Line,int col);
void pset(int x,int y,BYTE color);
void setpal(int COLOR,BYTE r,BYTE g,BYTE b);
BYTE ScanKey(void);
BYTE point(int x,int y);
void GetFontAdd()
{
struct REGPACK regs;
regs.r_bx=0x0300;
regs.r_ax=0x1130;
intr(0x10,®s);
FONT_SEG=regs.r_es;
FORT_OFF=regs.r_bp;
}
void waitkey()
{
_AX=0;
geninterrupt(0x16);
}
void setmode()
{
_AX=0x13;
geninterrupt(0x10);
GetFontAdd();
}
void closemode()
{
_AX=0x3;
geninterrupt(0x10);
}
void setpal(int Color,BYTE r,BYTE g,BYTE b)
{
outportb(0x3c8,Color);
outportb(0x3c9,r);
outportb(0x3c9,g);
outportb(0x3c9,b);
}
void locate (int Line,int Col)
{
_DH=Line;
_DL=Col;
_AH=2;
_BX=0;
geninterrupt(0x10);
}
BYTE ScanKey(void)
{
int start,end;
WORD key=0;
start=peek(0,0x41a);
end=peek(0,0x41c);
if(start==end) return(0);
else
{
key=peek(0x40,start);
start+=2;
}
}
void pset(int x,int y,BYTE color)
{
pokeb(0xa000,y*320+x,color);
BYTE point(int x,int y)
{
return peek(0xa000,y*320+x);
}
}