www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/10/17/15:55:48.1

From: REMOVEunreinME AT feist DOT com (Diabelek)
Newsgroups: comp.os.msdos.djgpp
Subject: mouse mickeys wont go negative
Organization: Student
Message-ID: <362838f6.33923440@news.feist.com>
X-Newsreader: Forte Agent 1.5/32.452
MIME-Version: 1.0
Lines: 32
Date: Sat, 17 Oct 1998 19:01:58 GMT
NNTP-Posting-Host: 198.247.6.172
X-Trace: newsfeed.slurp.net 908651019 198.247.6.172 (Sat, 17 Oct 1998 14:03:39 CDT)
NNTP-Posting-Date: Sat, 17 Oct 1998 14:03:39 CDT
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

i'm using a the int 33 func Bh to read the mouse mickeys.  it gets the
data just fine except when it should be negative it is a large
positive number. ie

moving up and left will get the results 
x = 5FFF3, y = FFFB
x = 5FFDC, y = FFDF

not moiving the mouse gets 
x = 50000, y = 0

and moving down and left gets
x = 5001E, y = 3
x = 50004, y = 16

i know ANDing it with 0xFFFF (or subtracing 0x50000) will reduce the
number but i still get a number that is 0xFFFF - x ( = x ) for any
negative.  the same is true for y.
ie
x = FFFC y = FFFE (should be x=-3 and y=-1 , i think )



does anyone know why i'm getting these numbers and/or a way to fix it?


btw.  x,y, and the registers are declared like  this
signed int x,y;     (i also have tried float, double, int, long, etc )
union REGS regs;


later

- Raw text -


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