delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/12/29/12:15:27

From: "David Harms" <coder AT flash DOT net>
Newsgroups: comp.os.msdos.djgpp
Subject: interupt calls
Date: 29 Dec 1997 16:50:40 GMT
Organization: Flashnet Communications, http://www.flash.net
Lines: 155
Message-ID: <01bd1470$9ae910a0$73451ed1@default>
NNTP-Posting-Host: houasc23-115.flash.net
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

i have the following code in C to use the mouse:

//source code for mouse function

int Mouse(int REQUEST, int *X, int *Y, int *BUTTONS)
{

	union REGS inregs, outregs;

	switch(REQUEST)
	{
		case M_RESET:
		{
                        //resets the mouse driver

                        inregs.x.ax = 0x00;
                        int86(M_INT, &inregs, &outregs);

                        *BUTTONS = outregs.x.bx; //returns the #of buttons
                                                 //on the current mouse
                        return(1);
                  
		} break;

                case M_SHOW:
                {
                        //shows the mouse pointer on screen

                        inregs.x.ax = 0x01;
                        int86(M_INT, &inregs, &outregs);

                        return(1);
                        
		} break;

                case M_HIDE:
                {
                        //hides the mouse pointer from the screen

                        inregs.x.ax = 0x02;
                        int86(M_INT, &inregs, &outregs);

                        return(1);
                  
		} break;

                case M_BUTT_POSS:
                {
                       //returns the button presses and
                       //the relative mouse position to
                       //the screen

                       inregs.x.ax=0x03;
                       int86(M_INT, &inregs, &outregs);

                       *BUTTONS = outregs.x.bx;  //button pressed
                       *Y       = outregs.x.cx;  //y possition of mouse
		       *X       = outregs.x.dx;  //x possition of mouse

                       return(1);
                  

		} break;

                case M_SET_SENSITIVITY:
                {
                        //this sets the ratio between physical and relative
                        //motion to the mouse

                        inregs.x.ax = 0x1A;

                        inregs.x.cx = *Y;       //sensitivity of the
vertical
                        inregs.x.bx = *X;       //sensitivity of the
horizontal
                        inregs.x.dx = *BUTTONS; //sensititvity of souble
clicks

                        int86(M_INT, &inregs, &outregs);

			return(1);

		} break;
                
               case M_MOTION_REL:
               {
                       //returns the relative mouse positions

                       inregs.x.ax = 0x03;
                       int86(M_INT, &inregs, &outregs);

                       *X = outregs.x.cx;
                       *Y = outregs.x.dx;

                       return(1);
	       } break;

               default:break;

	}// end of switch

}//end of mouse function


when i compile i get the following errors:

pcx.c: In function `main':
pcx.c:389: warning: passing arg 2 of `Mouse' makes pointer from integer
without
a cast
pcx.c:389: warning: passing arg 3 of `Mouse' makes pointer from integer
without
a cast
pcx.c:389: warning: passing arg 4 of `Mouse' makes pointer from integer
without
a cast
pcx.c:390: warning: passing arg 2 of `Mouse' makes pointer from integer
without
a cast
pcx.c:390: warning: passing arg 3 of `Mouse' makes pointer from integer
without
a cast
pcx.c:390: warning: passing arg 4 of `Mouse' makes pointer from integer
without
a cast

so i when to djgpp web page found out a few things about calling iterupts
but i stil dont get it.

the prob is when i run the prog i crashes and gives the following screen:

Page fault at eip=00001983, error=0006
eax=00c0c0c0 ebx=00052020 ecx=00000054 edx=00000002 esi=00000054
edi=0000f8d4
ebp=0004f4ec esp=0004f4a4 program=C:\PCX5.EXE
cs: sel=00af  base=82fde000  limit=0007ffff
ds: sel=00b7  base=82fde000  limit=ffffffff
es: sel=00b7  base=82fde000  limit=ffffffff
fs: sel=008f  base=0001d040  limit=0000ffff
gs: sel=00c7  base=00000000  limit=ffffffff
ss: sel=00b7  base=82fde000  limit=ffffffff

Call frame traceback EIPs:
  0x00001983
  0x00001b19
  0x000020ba

i know that this is a long post but i just started using djgpp about 2 days
ago and i am in desprate need of some help1!

-thanx
-david



- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019