Author Topic: Little Assembly Question  (Read 2016 times)

Offline Brazilian Fan

  • Sr. Member
  • ****
  • Posts: 302
Little Assembly Question
« 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)
« Last Edit: May 01, 2007, 07:37:53 PM by Brazilian Fan »

Offline zanco

  • Full Member
  • ***
  • Posts: 241
Little Assembly Question
« Reply #1 on: May 01, 2007, 08:06:18 PM »
Take it to the Homework Forum :P Just kidding.
if anyone finds and communicate to us that which thus far has eluded our efforts, great will be our gratitude.
          Jakob Bernouilli

"Zanco`, n00b o' The Flares"

Offline BlackBox

  • Administrator
  • Hero Member
  • *****
  • Posts: 3093
Little Assembly Question
« Reply #2 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)
« Last Edit: May 01, 2007, 08:33:36 PM by op2hacker »

Offline Brazilian Fan

  • Sr. Member
  • ****
  • Posts: 302
Little Assembly Question
« Reply #3 on: May 02, 2007, 08:56:37 AM »
Thanks OP2Hacker  B)