وو

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

وو

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

CMP

CMP

Usage:  CMP     dest,src                            Modifies flags: AF CF OF PF SF ZF

Subtracts 'src' from 'dest' and updates flags but does not save result.  Flags can then be checked for conditions.

Compare Integers


CMP r/m8,reg8                 ; 38 /r                [8086]

CMP r/m16,reg16               ; o16 39 /r            [8086]

CMP r/m32,reg32               ; o32 39 /r            [386]


CMP reg8,r/m8                 ; 3A /r                [8086]

CMP reg16,r/m16               ; o16 3B /r            [8086]

CMP reg32,r/m32               ; o32 3B /r            [386]


CMP r/m8,imm8                 ; 80 /0 ib             [8086]

CMP r/m16,imm16               ; o16 81 /0 iw         [8086]

CMP r/m32,imm32               ; o32 81 /0 id         [386]


CMP r/m16,imm8                ; o16 83 /0 ib         [8086]

CMP r/m32,imm8                ; o32 83 /0 ib         [386]


CMP AL,imm8                   ; 3C ib                [8086]

CMP AX,imm16                  ; o16 3D iw            [8086]

CMP EAX,imm32                 ; o32 3D id            [386]


CMP performs a 'mental' subtraction of its second operand from its first operand, and affects the flags as if the subtraction had taken place, but does not store the result of the subtraction anywhere.


The destination operand can be a register or a memory location. The source can be a register, memory location or an immediate value of the same size as the destination.


EXAMPLE:

    If B$WriteCheckerWanted = &TRUE

        cmp eax 32 | je L1>

        cmp eax CR | je L1>

        cmp eax ',' | je L1>

        cmp eax 8 | je L1>

        cmp eax Tab | jne L0>

L1:     call Label


CMP