![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Newbie
Join Date: Jun 2006
Location: Bath Room
Posts: 11
Rep Power: 0
![]() |
Substraction...
Hi how can i substract value1 from EAX.
value1 = 0FFFFh. |
|
|
|
|
|
#2 |
|
Newbie
Join Date: Jun 2006
Location: Bath Room
Posts: 11
Rep Power: 0
![]() |
MOV eax,value1
sub eax,value1 Is that correct? |
|
|
|
|
|
#3 |
|
Professional Programmer
Join Date: Oct 2005
Location: Chitown
Posts: 423
Rep Power: 4
![]() |
It appears to be correct
|
|
|
|
|
|
#4 |
|
Resident Grouch
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jun 2005
Posts: 6,453
Rep Power: 10
![]() |
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 |
|
|
|
|
|
#5 |
|
Newbie
Join Date: Jun 2006
Location: Bath Room
Posts: 11
Rep Power: 0
![]() |
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. |
|
|
|
|
|
#6 |
|
Resident Grouch
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jun 2005
Posts: 6,453
Rep Power: 10
![]() |
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 |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|