From: billynomates AT my-dejanews DOT com Newsgroups: comp.os.msdos.djgpp Subject: I give up. My mouse function has committed suicide. Date: Thu, 22 Oct 1998 20:34:41 GMT Organization: Deja News - The Leader in Internet Discussion Lines: 179 Message-ID: <70o4t0$l02$1@nnrp1.dejanews.com> NNTP-Posting-Host: 194.73.88.150 X-Article-Creation-Date: Thu Oct 22 20:34:41 1998 GMT X-Http-User-Agent: Mozilla/2.0 (compatible; MSIE 3.0; Windows 95) X-Http-Proxy: 1.0 x8.dejanews.com:80 (Squid/1.1.22) for client 194.73.88.150 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Well, I've tried everyone's suggestions and it still doesn't work - I simply don't know what to do any more. If anyone can take this code (below) and change those one or two lines that are causing faults, I will be sooooo happy. I've reached a point whereby I simply can't go any further - I've been working on one bleeding mouse driver for 4 days now and it still doesn't do one simple (but important) function. I'm sure some people must have made mouse drivers - PLEASE PLEASE PLEAAAASE can somebody comile this and tell me why it doesn't work. I've been happy to get some responses but they don't solve the problem at all. Thanks, Chris jsc AT lds DOT co DOT uk ////////////////////////////////// #include #include #include #include #include #define far #define MOUSE_LB 0x01 /* mouse left button */ #define MOUSE_RB 0x02 /* mouse right button */ #define MOUSE_CB 0x04 /* mouse center button */ void InitGraphics(void) { union REGS regs; regs.x.ax = 0x13; int86(0x10, ®s,®s); return; } void ExitGraphics(void) { union REGS regs; regs.x.ax = 0x3; int86(0x10, ®s,®s); } void Plot_Pixel(int x, int y, int colour) { _farpokeb(_dos_ds, 0xa0000 + ((y<<8) + (y<<6))+ x, colour); } int mouse_detect(void) { union REGS regs; regs.x.ax = 0x0; int86(0x33, ®s, ®s); return regs.x.ax; } void mouse_show(void) { union REGS regs; regs.x.ax = 0x01; int86(0x33, ®s, ®s); } void mouse_hide(void) { union REGS regs; regs.x.ax = 0x02; int86(0x33, ®s, ®s); } unsigned char mouse_button(unsigned char button) { union REGS regs; regs.x.ax = 0x3; int86(0x33, ®s, ®s); return (regs.x.bx & button); } void mouse_abs_pos(short *x, short *y) { union REGS regs; regs.x.ax = 0x03; int86(0x33, ®s, ®s); *x = regs.x.cx; *y = regs.x.dx; return; } int mouse_rel_pos(short *x, short *y) { union REGS regs; regs.x.ax = 0xb; int86(0x33, ®s, ®s); *x = regs.x.cx; *y = regs.x.dx; return (*x|*y); } int main(void) { int buttons,num_buttons; int colour=1; short x; short y; // put the computer into graphics mode InitGraphics(); // initialize mouse mouse_detect(); // show the mouse mouse_show(); while(!kbhit()) { mouse_abs_pos(&x,&y); //mouse_rel_pos(&x,&y); if(mouse_button(MOUSE_LB)) { Plot_Pixel(x, y, colour); } if(mouse_button(MOUSE_RB)) { if (++colour>15) colour=0; } } ExitGraphics(); return(0); } // end main -----------== Posted via Deja News, The Discussion Network ==---------- http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own