Programming Forums

Programming Forums (http://www.programmingforums.org/forumindex.php)
-   Assembly (http://www.programmingforums.org/forum20.html)
-   -   Substraction... (http://www.programmingforums.org/showthread.php?t=10538)

Edgar. Jun 27th, 2006 11:52 AM

Substraction...
 
Hi how can i substract value1 from EAX.
value1 = 0FFFFh.

Edgar. Jun 27th, 2006 11:57 AM

MOV eax,value1
sub eax,value1

Is that correct?

Wizard1988 Jun 27th, 2006 11:57 AM

It appears to be correct

DaWei Jun 27th, 2006 2:02 PM

I would suggest that you could just set EAX to zero. However, if you want to subtract value1 from another value, then put the other value in EAX and subtract value1.

Edgar. Jun 27th, 2006 2:58 PM

So is right:
mov eax,value1
sub eax,value1

I know what you are saying:
mov eax,0. but this is what the Mr. want me to do. thanks DaWei.

DaWei Jun 27th, 2006 3:26 PM

If you subtract a value from itself, you will get zero. At least, it used to be that way. I won't address possible glitches arising from twos-complement usage.


All times are GMT -5. The time now is 8:00 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC