Mail Archives: djgpp/1999/09/01/22:32:42

From: "David Dean - [DS]Deaner666" <david AT deanhouse61 DOT freeserve DOT co DOT uk>
Newsgroups: comp.os.msdos.djgpp
Subject: mouse probs
Date: Tue, 31 Aug 1999 19:35:59 +0100
Organization: Customer of Planet Online
Lines: 33
Message-ID: <7qk7j9$klb$>
X-Trace: 936223145 21163 (1 Sep 1999 21:59:05 GMT)
NNTP-Posting-Date: 1 Sep 1999 21:59:05 GMT
X-Complaints-To: abuse AT theplanet DOT net
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.00.2014.211
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2014.211
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

I'm using the mouse interrupts with DJGPP and am experiencing problems
getting the absolute address of the mouse. Here's the function I use:

void mouse_abs_pos(int *x, int *y)
 union REGS regs; = 0x03;
 int86(0x33, &regs, &regs);
 *x =;
 *y = regs.x.dx;


I call it like this:

mouse_abs_pos(&mouse_x, &mouse_y);

This works fine, except it doesn't give values in the range 0 - 319 for the
x axis and 0 - 199 for the y axis (I'm using mode 13h). I got round the
problem by deducting the values I was getting for when the cursor was at
(0,0) from the values I read into mouse_x and mouse_y (and for some reason I
also had to divide the mouse_x value by 2). This put the values in the
correct range and I was perfectly happy. However, I came back to my program
after rebooting my computer and the values were different, the scaling
factor had changed. Can somebody explain why this happens and how to prevent
it (if possible).

TIA - David Dean

- Raw text -

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