View Full Version : ASM help
stealthFIGHTER
March 31st, 2001, 18:32
Hi, I have problems with this piece of code:
-----------------------------------------
:
:
MOV ECX, 3 ; EAX=E
CDQ ; ECX=3
IDIV ECX ; EDX=0
IMUL ... ; EAX=4, EDX=2
:
:
-----------------------------------------
I don't know what does the 2nd function (CDQ) do.
Regards
sF
Bratsher
March 31st, 2001, 23:41
Quote:
stealthFIGHTER (03-31-2001 15:32):
Hi, I have problems with this piece of code:
-----------------------------------------
:
:
MOV ECX, 3 ; EAX=E
CDQ ; ECX=3
IDIV ECX ; EDX=0
IMUL ... ; EAX=4, EDX=2
:
:
-----------------------------------------
I don't know what does the 2nd function (CDQ) do.
Regards
sF |
CDQ Convert doubleword (in EAX) to quadword (contained in EDX:EAX) always acts on the EDX:EAX registers, so it does not take an operand. The Quad mantains the sign of the integer contained in EAX.
Fpc
April 1st, 2001, 00:29
About CDQ:
If EAX>0x7FFFFFFF, then EDX=0XFFFFFFFF;
If EAX<=0X7FFFFFFF,then EDX=0X0.
That's all.
Powered by vBulletin® Version 4.2.2 Copyright © 2018 vBulletin Solutions, Inc. All rights reserved.