Compare Instruction
One of several instructions that compares the value in a processor register with a byte value in memory.
The Comparison instructions in the 65xx family of processors are: CMP, CPX, and CPY. The purpose of these instructions is to set certain processor flags, specifically the Negative flag, the Zero flag, and the Carry flag.
The processor carries out these instructions in the same way the SBC instruction is carried out, with three significant differences. First, and most important, the result value is not stored. Second, these instructions operate on the X index register, the Y index register or the Accumulator, whereas SBC only operates on the Accumulator. And finally, the Compare instructions do not alter the Overflow flag.
CMP Compare Memory and Accumulator