Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Jun 27th, 2006, 10:52 AM   #1
Edgar.
Newbie
 
Edgar.'s Avatar
 
Join Date: Jun 2006
Location: Bath Room
Posts: 11
Rep Power: 0 Edgar. is on a distinguished road
Substraction...

Hi how can i substract value1 from EAX.
value1 = 0FFFFh.
Edgar. is offline   Reply With Quote
Old Jun 27th, 2006, 10:57 AM   #2
Edgar.
Newbie
 
Edgar.'s Avatar
 
Join Date: Jun 2006
Location: Bath Room
Posts: 11
Rep Power: 0 Edgar. is on a distinguished road
MOV eax,value1
sub eax,value1

Is that correct?
Edgar. is offline   Reply With Quote
Old Jun 27th, 2006, 10:57 AM   #3
Wizard1988
Professional Programmer
 
Wizard1988's Avatar
 
Join Date: Oct 2005
Location: Chitown
Posts: 417
Rep Power: 4 Wizard1988 is on a distinguished road
Send a message via AIM to Wizard1988
It appears to be correct
Wizard1988 is offline   Reply With Quote
Old Jun 27th, 2006, 1:02 PM   #4
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
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.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code.
Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers
DaWei is offline   Reply With Quote
Old Jun 27th, 2006, 1:58 PM   #5
Edgar.
Newbie
 
Edgar.'s Avatar
 
Join Date: Jun 2006
Location: Bath Room
Posts: 11
Rep Power: 0 Edgar. is on a distinguished road
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.
Edgar. is offline   Reply With Quote
Old Jun 27th, 2006, 2:26 PM   #6
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
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.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code.
Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers
DaWei is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 11:32 AM.

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