N
Nobby Golder
Hello friends
I am trying to run this simple test program to on my WinXP, but
every time I try to run it just crashes. I have also tested couple of
programs from Net on my machine but they also seem to fail. I reckon
that WinXP does not allow me to set up a mouse handler.
#include <stdio.h>
#include <dos.h>
#include <conio.h>
const int MOUSE_INT_MASK = 0x15;
union REGS i, o;
union SREGS sr;
void far interrupt mouse_handler()
{
printf("You did something with mouse\n");
}
int init_mouse()
{
int i;
asm {
mov ax, 0;
int 0x33;
mov i, ax
}
return i;
}
void show_mouse() {
asm {
mov ax, 0x1;
int 0x33;
}
}
void mouse_init( )
{
unsigned short seg = FP_SEG(mouse_handler);
unsigned short off = FP_OFF(mouse_handler);
/* convert the below to assembly */
i.x.ax = 0x0C;
i.x.cx = MOUSE_INT_MASK;
i.x.dx = off;
sr.es = seg;
int86x(0x33, &i, &o, &sr);
}
void main()
{
clrscr();
init_mouse();
show_mouse();
mouse_init();
while(!kbhit())
continue;
}
I am trying to run this simple test program to on my WinXP, but
every time I try to run it just crashes. I have also tested couple of
programs from Net on my machine but they also seem to fail. I reckon
that WinXP does not allow me to set up a mouse handler.
#include <stdio.h>
#include <dos.h>
#include <conio.h>
const int MOUSE_INT_MASK = 0x15;
union REGS i, o;
union SREGS sr;
void far interrupt mouse_handler()
{
printf("You did something with mouse\n");
}
int init_mouse()
{
int i;
asm {
mov ax, 0;
int 0x33;
mov i, ax
}
return i;
}
void show_mouse() {
asm {
mov ax, 0x1;
int 0x33;
}
}
void mouse_init( )
{
unsigned short seg = FP_SEG(mouse_handler);
unsigned short off = FP_OFF(mouse_handler);
/* convert the below to assembly */
i.x.ax = 0x0C;
i.x.cx = MOUSE_INT_MASK;
i.x.dx = off;
sr.es = seg;
int86x(0x33, &i, &o, &sr);
}
void main()
{
clrscr();
init_mouse();
show_mouse();
mouse_init();
while(!kbhit())
continue;
}