View Full Version : Difference between Add and Adds

James Newman
01-04-2009, 04:26 AM
What's the difference? The manual says that the prop stores signed numbers as two's complements... so aren't all the arithmetic operations the same for unsigned or signed numbers? If I'm thinking right, the only difference should be in display and comparing. Someone fill me in.

Mike Green
01-04-2009, 04:34 AM
The difference between the signed and unsigned arithmetic operations is in the definition of the C flag.

The unsigned ADD puts the carry into the C flag while the signed ADDS puts a signed overflow into the C flag.
Similarly, SUB puts the borrow into the C flag while the SUBS puts a signed underflow into the C flag.

James Newman
01-04-2009, 04:43 AM
Ahh, thanks. Well now the question seems silly.... http://forums.parallax.com/images/smilies/tongue.gif

Thanks for the quick response, means I can get on with what I was doing.