From Cheat Engine
Jump to navigation Jump to search

command cmp operand1, operand2

Compares the first operand with the second operand and sets the status flags in the (E)FLAGS register according to the results.

The CF, OF, SF, ZF, AF, and PF flags are set according to the result.

Compares the first source operand with the second source operand and sets the status flags in the EFLAGS register according to the results. The comparison is performed by subtracting the second operand from the first operand and then setting the status flags in the same manner as the SUB instruction. When an immediate value is used as an operand, it is sign-extended to the length of the first operand.

The CMP instruction is typically used in conjunction with a conditional jump (Jcc), condition move (CMOVcc), or SETcc instruction. The condition codes used by the Jcc, CMOVcc, and SETcc instructions are based on the results of a CMP instruction. Appendix B, EFLAGS Condition Codes, in the IA-32 Intel Architecture Software Developer's Manual, Volume 1, shows the relationship of the status flags and the condition codes.

Command Parameters[edit]

Parameter Description
operand1 The first operand to compare
operand2 The second operand to compare


cmp eax,0
cmp eax,ebx
cmp rax,rbx
cmp eax,[00123ABC]
cmp eax,SomeSymbol
cmp eax,[SomeSymbol]
cmp eax,0
jne @f
cmp eax,0
pop eax
jne @f

See also[edit]

External links[edit]