•CMP reg/mem, reg/imm
•CMP reg, reg/mem/imm
•
•Compares the first
operand with the second and sets flags (including ZF) according to the computed result (which is
discarded). Comparison is performed
by subtracting the second operand from the first (like SUB instruction, SUB EAX, 4 for
example)
•
•CMP EDI, 0
•CMP EAX, 16
•
•Suppose EDI contains 0
•0 – 0 == 0
(ZF is set)
•Suppose EAX contains 4hex
•4hex – 16hex = FFFFFFEEhex != 0 (ZF is cleared)
•4dec – 22dec = -18dec