Outpost Universe Forums

Off Topic => General Interest => Topic started by: Brazilian Fan on May 01, 2007, 07:37:10 PM

Title: Little Assembly Question
Post by: Brazilian Fan on May 01, 2007, 07:37:10 PM
I have a little question regarding x86 assembly:

On any 386 instruction set reference, the description about DIV (Unsigned Divide) are as follows:

"... DIV divides the EDX:EAX with r/m32 and stores the result on the EAX register, and the remainder on the EDX register..."

But I don't understand the 'EDX:EAX' part, what it means?

Thanks in advance  (thumbsup)
Title: Little Assembly Question
Post by: zanco on May 01, 2007, 08:06:18 PM
Take it to the Homework Forum :P Just kidding.
Title: Little Assembly Question
Post by: BlackBox on May 01, 2007, 08:33:24 PM
EDX:EAX makes up a 64bit pair (it is the dividend).

the EDX:EAX notation means that EDX is the high 32 bits and EAX is the low 32 bits. Besides that, you treat it as a 64bit number when put together. This is the case when the divisor (the argument to DIV) is 32 bits. (You can only do a 64/32 division like this on the 386 and later, if you happen to be coding for some older platform)

Do also keep in mind that DIV treats the numbers as unsigned. If you need signed division use IDIV. (it works the same way)
Title: Little Assembly Question
Post by: Brazilian Fan on May 02, 2007, 08:56:37 AM
Thanks OP2Hacker  B)