وو

وحید آنلاین . آرشیو وبلاگ وحیدمی دات آی آر . شرکت بیان. vahidmy.blog.ir

وو

وحید آنلاین . آرشیو وبلاگ وحیدمی دات آی آر . شرکت بیان. vahidmy.blog.ir

DIV

DIV

Usage:  DIV     src                                   Modifies flags: (AF,CF,OF,PF,SF,ZF undefined)

Unsigned binary division of accumulator by source.  

Unsigned Integer Divide


DIV r/m8                      ; F6 /6                [8086]

DIV r/m16                     ; o16 F7 /6            [8086]

DIV r/m32                     ; o32 F7 /6            [386]


DIV performs unsigned integer division. The explicit operand provided is the divisor; the dividend and destination operands are implicit, in the following way:

For DIV r/m8, AX is divided by the given operand; the quotient is stored in AL and the remainder in AH.

For DIV r/m16, DX:AX is divided by the given operand; the quotient is stored in AX and the remainder in DX.

For DIV r/m32, EDX:EAX is divided by the given operand; the quotient is stored in EAX and the remainder in EDX.


Signed integer division is performed by the IDIV instruction..

EXAMPLE:

AlToDecimal:

    push ecx, eax

        mov ecx 10

        push 0-1

L1:    mov ah 0 | div cl | add ah '0' | push eax | cmp al 0 | ja L1<


L2:     pop eax

        If eax <> 0-1

            mov B$edi ah | inc edi | jmp L2<

        End_If

    pop eax, ecx

ret 


DIV