Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Absolute and Interrupts

Status
Not open for further replies.

dbrown83

Programmer
Jun 28, 2000
3
CA
Hey guys!&nbsp;&nbsp;K.... heres the problem:<br><br>I'm using interrupts to get a high screen resolution (works fine), but I'm using absolute for the mouse.&nbsp;&nbsp;I've tested both and they work fine individually, but when I combine them it seems that the '$include 'qb.bi' frigs up the absolute... but if I remove the absolute it frigs up the interrupts.....<br><br>Is there a way to do mouse using interrupts or is there a way to do the screen using absolute OR is there a way to allow both to work in the same program by adding or removing some code????<br><br><br>Thanks<br><br>Daniel Brown
 
Here's how to use the mouse:<br><FONT FACE=monospace><b><br>DEFINT A-Z<br>TYPE RegTypeX<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;AX&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;AS INTEGER<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;BX&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;AS INTEGER<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;CX&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;AS INTEGER<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;dx&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;AS INTEGER<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;bp&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;AS INTEGER<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;si&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;AS INTEGER<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;di&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;AS INTEGER<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;FLAGS&nbsp;&nbsp;&nbsp;AS INTEGER<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DS&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;AS INTEGER<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ES&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;AS INTEGER<br>END TYPE<br><br>DECLARE FUNCTION MouseInit ()<br>DECLARE SUB Mousemove (mRow, mCol)<br>DECLARE SUB MouseShow ()<br>DECLARE SUB MouseHide ()<br>DECLARE SUB GetMouse (Click, MouseRow, MouseCol)<br><br>SUB GetMouse (Click, MouseRow, MouseCol) STATIC<br>DIM InRegs AS RegTypeX, OutRegs AS RegTypeX<br>InRegs.AX = 3<br>CALL INTERRUPTX(&H33, InRegs, OutRegs)<br>Click = 0<br>C = OutRegs.BX<br>IF C &lt;&gt; 0 THEN<br>&nbsp;&nbsp;&nbsp;&nbsp;MouseDown = C<br>ELSE<br>&nbsp;&nbsp;&nbsp;&nbsp;IF MouseDown &lt;&gt; 0 THEN<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Click = MouseDown<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;MouseDown = 0<br>&nbsp;&nbsp;&nbsp;&nbsp;END IF<br>END IF<br>MouseRow = OutRegs.dx \ 16 + 1<br>MouseCol = OutRegs.CX \ 8 + 1<br>END SUB<br><br>SUB MouseShow<br>&nbsp;&nbsp;&nbsp;DIM InRegs AS RegTypeX, OutRegs AS RegTypeX<br>&nbsp;&nbsp;&nbsp;InRegs.AX = 1<br>&nbsp;&nbsp;&nbsp;CALL INTERRUPTX(&H33, InRegs, OutRegs)<br>END SUB<br><br>SUB MouseHide<br>&nbsp;&nbsp;&nbsp;DIM InRegs AS RegTypeX, OutRegs AS RegTypeX<br>&nbsp;&nbsp;&nbsp;InRegs.AX = 2<br>&nbsp;&nbsp;&nbsp;CALL INTERRUPTX(&H33, InRegs, OutRegs)<br>END SUB<br><br>FUNCTION MouseInit<br>&nbsp;&nbsp;&nbsp;DIM InRegs AS RegTypeX, OutRegs AS RegTypeX<br>&nbsp;&nbsp;&nbsp;InRegs.AX = 0<br>&nbsp;&nbsp;&nbsp;CALL INTERRUPTX(&H33, InRegs, OutRegs)<br>&nbsp;&nbsp;&nbsp;MouseInit = OutRegs.AX<br>END FUNCTION<br><br>SUB Mousemove (mRow, mCol)<br>DIM InRegs AS RegTypeX, OutRegs AS RegTypeX<br>&nbsp;&nbsp;&nbsp;InRegs.dx = 16 * (mRow - 1)&nbsp;&nbsp;&nbsp;'8 * (mRow - 1)<br>&nbsp;&nbsp;&nbsp;InRegs.CX = 8 * (mCol - 1)<br>&nbsp;&nbsp;&nbsp;InRegs.AX = 4<br>&nbsp;&nbsp;&nbsp;CALL interrupt(&H33, InRegs, OutRegs)<br>END SUB<br></font></b><br><br>Use MouseInit to initialize the mouse driver.<br>Use MouseHide before you make changes to the screen and then use MouseShow immediately after.<br>Use MouseMove if you want to move the mouse cursor to a certain screen location.<br>Use the GetMouse sub to return the location of the mouse cursor and whether or not it was clicked. This sub should be in any loop that waits for user input.<br><br>Have fun. I hoped this solved your problem.<br><br>BTW, you might want to eliminate the QB.BI &quot;include&quot; and place everything in your modules. (I've had fewer problems that way.)<br><br><br><br> <p> <br><a href=mailto: > </a><br><a href= plain black box</a><br>
 
Oops, the integer division by 16 and 8 in the MouseMove and GetMouse subs are set to return the relative &quot;text&quot; coordinates. If you are using a graphic screen larger than 640x480 you will have to play with those values to return the correct cursor coordinates.<br><br>Sorry about that. I don't have any conversion tables on hand to post.<br> <p> <br><a href=mailto: > </a><br><a href= plain black box</a><br>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top