delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/02/19/00:01:11

From: "M. Schulter" <mschulter AT value DOT net>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: !!NEGATIVE NUMBERS IN ASM!! Pleez answer.
Date: 19 Feb 1998 04:44:02 GMT
Organization: Value Net Internetwork Services Inc.
Lines: 21
Message-ID: <6cgdai$iq6$1@vnetnews.value.net>
References: <34EB3694 DOT 714183B6 AT mail DOT htk DOT fi> <34EB6330 DOT 2388 AT wpi DOT edu>
NNTP-Posting-Host: value.net
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

chris doty <orz AT wpi DOT edu> wrote:
: > I just want to know, how I can change a number, which is negative, to
: > positive,
: > and in asm. I bet it can be done, but how?
: >  I've got an almost ready cool demo-effect, but when I add two numbers
: > together,
: > the other one is negative, and I can't do anything about it.

: x86s have hardware support for flipping the sign.  I believe mnemonic is
: NEG.  This is equivelent to a NOT followed by an INC.

Just a note that in one GAS (GNU assembler) program, I used fabs to obtain
the absolute value of a floating-point number. However, I'm not sure if
this program uses floating-point values, and I guess that integer math, if
adequate, might be faster <grin>.

Most respectfully,

Margo Schulter
mschulter AT value DOT net

- Raw text -


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