Mail Archives: djgpp/1998/10/25/01:25:29
jsc AT lds DOT co DOT uk wrote:
>
> Hello all,
> I'm new here (mainly because my news program recently committed suicide).
> I'm having a few probs with using a mouse in djgpp. I have a function
>
> void mouse_abs_pos(int *x, int *y)
> {
> union REGS regs;
> regs.x.ax = 0x03;
> int86(0x33, ®s, ®s);
> *x = regs.x.cx;
> *y = regs.x.dx;
> return 0;
> }
>
Like someone else posted... call yer function like this...
mouse_abs_pos(&MouseX, &MouseY);
BUT!!! Inside of that function you should use the .w members instead of
the .x ones.
EXAMPLE:
*x = regs.w.cx;
instead of
*x = regs.x.cx;
Using the .w members makes SURE the cx is treated as 16bit. The .x can
be either 16 or 32bit which will give you screwy x and y values if it
happens to be 32 bit.
I ran into that problem when I was trying to get my mouse stuff working.
Hope it helps...
- Raw text -