Search code examples
assemblyfasm

Why after the Div the quotient in EAX and the remainder in EDX is not modified


I am beginner in ASM, currently i am using FASM and with my code :

 include 'win32ax.inc'

.code

start:

    XOR     EDX,EDX      ; set to 0
    MOV     EBX,22
;@DivLoop:
    MOV     EAX,7
    DIV     EBX

For Debug i am using Ollydbg and like you can see the register is not modified.

Ollydbg screenShot

I would like to understand why is not modified. Thanks You very much


Solution

  • That screenshot is showing that 7/16 = 0 with a remainder of 7; which is exactly what you'd expect.

    Both registers (EAX and EDX) did change (EAX changed from 7 to 0, and EDX changed from 0 to 7).