32 bit division in assembly language -
i'm learning assembly language programming in college course (80386 programming). currently, i'm learning ins , outs of 32 bit division using edx , eax registers store remainder , quotient respectively. want know, why not correct output when don't include
mov edx, 00000000h in program. program either doesn't run or gives wrong output.
relevant source code:
mov edx, 00000000h mov eax, 1234567ah div 11111111h ; edx=remainder, eax=quotient i post full code if needed.
when using div 32-bit operand, divide 64-bit value in edx:eax (high dword in edx, low dword in eax) operand , put quotient in eax , remainder in edx.
therefore should clear edx prior division if value want divide 32 bits (fits in eax alone). failure result in incorrect results, or division overflow if quotient doesn't fit in eax.
Comments
Post a Comment