You are here : assembly8086CMP

CMP - 8086

Compare two values and sets flags accordingly.

Algorithm:
operand1 - operand2
result is not stored anywhere, flags are set (OF, SF, ZF, AF, PF, CF) according to result.


Syntax

CMP REG,MEM
CMP REG,REG
CMP MEM,REG
CMP MEM,IMMIDIATE


Example

MOV AL, 5
MOV BL, 5
CMP AL, BL  ; AL = 5, ZF = 1 (so equal!)


Output / Return Value


Limitations


Alternatives / See Also


Reference