EASy68K
http://www.easy68k.com/EASy68Kforum/

Subtracting and getting a negative answer
http://www.easy68k.com/EASy68Kforum/viewtopic.php?f=6&t=1535
Page 1 of 1

Author:  Shawn565 [ Thu Feb 18, 2016 7:57 pm ]
Post subject:  Subtracting and getting a negative answer

Hello,

I'm subtracting two number that our read from the keyboard and when I do that, I get a negative result.

I tried putting a NEG infront of the sub like this:

Code:
NEG sub.l d2,d1


But I still get a negative answer.

Any help?

Author:  profkelly [ Thu Feb 18, 2016 9:29 pm ]
Post subject:  Re: Subtracting and getting a negative answer

NEG is an instruction. Placing it in the front of a line creates a label named NEG.
Try this:
Code:
    sub.l d2,d1
    neg.l d1

Author:  Shawn565 [ Thu Feb 18, 2016 9:36 pm ]
Post subject:  Re: Subtracting and getting a negative answer

Worked, thanks a lot

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/