Hi,

The problem is: I have two 64bit values (Value1 and Value2) and I need to subtract them, like Value1 - Value2.

I'm completely out of space, how to subtract them, because they don't fit into any register.

Sami
Posted on 2001-09-11 07:08:06 by SamiP
Hi !

Try this to substract Val2 from Val1





mov eax, [Val1]
mov edx, 4 [Val1]

sub eax, [Val2]
sbb edx, 4 [Val2]



In edx/Eax you got the result !

Greetings, CALEB
Posted on 2001-09-11 07:26:48 by Caleb
This seems to work. Thanks!

BTW. what that sbb does/meens?

Sami
Posted on 2001-09-11 09:38:18 by SamiP
Subtract with borrow.

Its like 'adc' but for subtraction.
The official Intel docs state -
sbb:
DEST <- DEST - (SRC + CF)

(CF is the carry flag).

Mirno
Posted on 2001-09-11 09:52:58 by Mirno
No MMX:


mov eax, [low]
mov edx, [high]
sub eax, [low2]
sbb edx, [high2]

MMX:


movq MM0, [int]
movq MM1, [int2]
psub MM0, MM1
movq [int], MM0
Posted on 2001-09-11 09:59:40 by comrade
Thanks to all!

Sami
Posted on 2001-09-15 12:33:31 by SamiP