www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/11/12/21:20:55

From: mohamedelhelw AT my-dejanews DOT com
Newsgroups: comp.os.msdos.djgpp
Subject: Need Help - Interesting Problem
Date: Fri, 13 Nov 1998 02:13:10 GMT
Organization: Deja News - The Leader in Internet Discussion
Lines: 36
Message-ID: <72g4jm$24s$1@nnrp1.dejanews.com>
NNTP-Posting-Host: 137.186.227.51
X-Article-Creation-Date: Fri Nov 13 02:13:10 1998 GMT
X-Http-User-Agent: Mozilla/3.0Gold (Win95; I; 16bit)
X-Http-Proxy: 1.0 x9.dejanews.com:80 (Squid/1.1.22) for client 137.186.227.51
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com



Hi, I have an interesting problem in which I need help to solve. I am trying
to pass back the value of mouse position read within my mouse interrupt
handler back to the calling program through registers(so the handler can be
used with any game). The problem is the register values are not preserved
when the control goes back from the mouse handle to the calling program. I
tried using the stack but it didn't work(pushing ax onto the stack in the my
handler).

to make the problem clear consider this small piece of C code:

void far interrupt my_mouse_handler()
{
 if(_AX == 0x00)     // if the calling program is checking for the
 {                   // existance of the mouse
      _AX = 0xFFFF;  // acknowledge mouse existance
      _BX = 0x02;    // number of buttons(vary)
 }
}

void main()
{
 old_mouse_handler = getvect(0x33);
 setvect(0x33, my_mouse_handler);

 _AX = 0;
 genintr(0x33);
 if(_AX == 0xFFFF) printf("Mouse OK \n");
 else printf("Mouse Initialization Error \n");  // always get this message
}


-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    

- Raw text -


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