主题:李氏鼠标接口程序 v1.0
/* 李氏鼠标接口程序 v1.0 */
/* void initmouse(void) 检测并初始化鼠标 */
/* void setmousexy(int x1, int y1, int x2, int y2) 设置鼠标活动范围 */
/* void lightmouse(int flag) 打开flag=1 或 关闭flag=2 鼠标 */
/* void mxz_hand(void) 鼠标的形状 手指 */
/* void mxz_qizi(void) 鼠标的形状 棋子 */
/* 一、 检测并初始化鼠标 */
void initmouse(void)
{
auto union REGS r;
int ret;
r.x.ax=0;
int86(0x33,&r,&r);
ret=r.x.ax;
if(ret==0)
{
restorecrtmode();
printf("Mouse dirve not installed!");
exit(1);
};
}
/* 二、 鼠标的活动范围 */
void setmousexy(int x1,int y1,int x2,int y2)
{
auto union REGS r;
r.x.ax=8;
r.x.cx=y1;
r.x.dx=y2;
int86(0x33,&r,&r);
r.x.ax=7;
r.x.cx=x1;
r.x.dx=x2;
int86(0x33,&r,&r);
}
/* 三、 打开或关闭鼠标 flag=1 打开 flag=2 关闭 */
void lightmouse(int flag)
{
auto union REGS r;
if(flag==1)r.x.ax=1;
if(flag==2)r.x.ax=2;
int86(0x33,&r,&r);
}
/* 四、 鼠标的形状 手指 */
void mxz_hand(void)
{
auto union REGS r;
auto struct SREGS reg;
auto unsigned int str[32]={
0xffff,0xffff,0xffff,0xffff,
0xffff,0xffff,0xffff,0xffff,
0xffff,0xffff,0xffff,0xffff,
0xffff,0xffff,0xffff,0xffff,
0x0800,0x0c00,0x1200,0x1200,
0x1200,0x1200,0x1200,0x3280,
0x3350,0x526c,0x524a,0x5002,
0x4002,0x2004,0x1004,0x1ffc,
};
r.x.ax=9;
r.x.bx=4;
r.x.cx=1;
r.x.dx=FP_OFF(str);
reg.es=FP_SEG(str);
int86x(0x33,&r,&r,®);
}
/* 五、 鼠标的形状 棋子 */
void mxz_qizi(void)
{
auto union REGS r;
auto struct SREGS reg;
auto unsigned int str[32]={
0xff3f,0xff3f,0xfe1f,0xfc0f,
0xf807,0xf807,0xf807,0xf807,
0xf807,0xf807,0xff9f,0xff3f,
0xf07f,0xf7ff,0xf7ff,0xf807,
0x00c0,0x00c0,0x01ed,0x03f0,
0x07f8,0x07f8,0x07f8,0x07f8,
0x07f8,0x07f8,0x0060,0x00c0,
0x0f80,0x0800,0x0800,0x07f8,
};
r.x.ax=9;
r.x.bx=4;
r.x.cx=1;
r.x.dx=FP_OFF(str);
reg.es=FP_SEG(str);
int86x(0x33,&r,&r,®);
}
/* void initmouse(void) 检测并初始化鼠标 */
/* void setmousexy(int x1, int y1, int x2, int y2) 设置鼠标活动范围 */
/* void lightmouse(int flag) 打开flag=1 或 关闭flag=2 鼠标 */
/* void mxz_hand(void) 鼠标的形状 手指 */
/* void mxz_qizi(void) 鼠标的形状 棋子 */
/* 一、 检测并初始化鼠标 */
void initmouse(void)
{
auto union REGS r;
int ret;
r.x.ax=0;
int86(0x33,&r,&r);
ret=r.x.ax;
if(ret==0)
{
restorecrtmode();
printf("Mouse dirve not installed!");
exit(1);
};
}
/* 二、 鼠标的活动范围 */
void setmousexy(int x1,int y1,int x2,int y2)
{
auto union REGS r;
r.x.ax=8;
r.x.cx=y1;
r.x.dx=y2;
int86(0x33,&r,&r);
r.x.ax=7;
r.x.cx=x1;
r.x.dx=x2;
int86(0x33,&r,&r);
}
/* 三、 打开或关闭鼠标 flag=1 打开 flag=2 关闭 */
void lightmouse(int flag)
{
auto union REGS r;
if(flag==1)r.x.ax=1;
if(flag==2)r.x.ax=2;
int86(0x33,&r,&r);
}
/* 四、 鼠标的形状 手指 */
void mxz_hand(void)
{
auto union REGS r;
auto struct SREGS reg;
auto unsigned int str[32]={
0xffff,0xffff,0xffff,0xffff,
0xffff,0xffff,0xffff,0xffff,
0xffff,0xffff,0xffff,0xffff,
0xffff,0xffff,0xffff,0xffff,
0x0800,0x0c00,0x1200,0x1200,
0x1200,0x1200,0x1200,0x3280,
0x3350,0x526c,0x524a,0x5002,
0x4002,0x2004,0x1004,0x1ffc,
};
r.x.ax=9;
r.x.bx=4;
r.x.cx=1;
r.x.dx=FP_OFF(str);
reg.es=FP_SEG(str);
int86x(0x33,&r,&r,®);
}
/* 五、 鼠标的形状 棋子 */
void mxz_qizi(void)
{
auto union REGS r;
auto struct SREGS reg;
auto unsigned int str[32]={
0xff3f,0xff3f,0xfe1f,0xfc0f,
0xf807,0xf807,0xf807,0xf807,
0xf807,0xf807,0xff9f,0xff3f,
0xf07f,0xf7ff,0xf7ff,0xf807,
0x00c0,0x00c0,0x01ed,0x03f0,
0x07f8,0x07f8,0x07f8,0x07f8,
0x07f8,0x07f8,0x0060,0x00c0,
0x0f80,0x0800,0x0800,0x07f8,
};
r.x.ax=9;
r.x.bx=4;
r.x.cx=1;
r.x.dx=FP_OFF(str);
reg.es=FP_SEG(str);
int86x(0x33,&r,&r,®);
}