Mail Archives: djgpp/1999/03/11/15:08:42
JCS
If you are using a mouse without Allegro then use Interrupt 33
Function 0001h which will show the mouse, Interrupt 33 Function 0002h to
hide mouse and Interrupt
33 Function 0003h Return Position and Button Status
Function 0003h can be set up to return the position of the
mouse(both x & Y) and also button status(which button or combination of
buttons pushed). By assigning
the CX and DX registers the result (position of mouse)can be printed on
the screen.
You will need dos.h to run the interrupt 33.
To Show Mouse:
{union REGS r;
r.x.ax =1; /* (show mouse function) */
int86(0x33, &r, &r);}
To Hide mouse:
{union REGS r;
r.x.ax=2 ; /* hide mouse*/
int86(0x33, &r, &r); }
NOTE: show mouse at this point.
To find mouse coordinates:
unsigned short WhichButton, HorizPos, VertPos;
/* ResetInterrupt < 5 can be set to any value for checkout */
for (ResetInterrupt=0; ResetInterrupt < 5; ResetInterupt ++) {
{union REGS r;
r.x.ax = 3 /* mouse coordinates & button Function */
WhichButton = r.x.bx;
HorizPos = r.x.cx ; /* horizontal position */
VertPos = r.x.dx ; /* vertical position */
int86(0x33, &r, &r);}
HorizPos = HorizPos/8
VertPos = VertPos /8
if you don't divide your positions by 8 then you
will get
HorizPos = 639, and VertPos = 479
/* print coordinates to screen */
printf ("%d", HorizPos);
printf (" = Horizontal Position\n");
printf("%d", VertPos);
printf(" = Vertical Position)\n);
if (WhichButton = =1 {
printf("exiting mouse pgm \n);
/* use whatever exiting procedure you want. */
}
} /* end of for loop */
I hope this helps you with the mouse program. A good
reference is PC
Interrupts by Ralf Brown & Jim Kyle, Addison-Wesley Publishing Co.
Vince McCarthy
On Tue, 09 Mar 1999 22:41:01 GMT jsc AT lds DOT co DOT uk writes:
>Sorry, this must be quite annoying, but all the literature I've read
>on how
>to write a workaround to make the mouse work under a vesa mode is
>either
>written in gobbledigook (ie nonsensensical!) or just plain doesn't
>make
>sense. If anyone can explain this in some variety of English, I would
>be
>really grateful. I don't want to display the mouse - I just want it to
>return
>a number between 0 and 640 in the horizontal, and 0-480 vertically.
>Why do
>all the most common things have to be the most obscure to program???
>Thanks,
>Christopher Anthony jsc AT lds DOT co DOT uk
>
>-----------== Posted via Deja News, The Discussion Network
>==----------
>http://www.dejanews.com/ Search, Read, Discuss, or Start Your
>Own
>
___________________________________________________________________
You don't need to buy Internet access to use free Internet e-mail.
Get completely free e-mail from Juno at http://www.juno.com/getjuno.html
or call Juno at (800) 654-JUNO [654-5866]
- Raw text -