CMP CMP Compare memory and accumulator CMP
Operation: A - M N V - B D I Z C
/ . . . . . / /
+----------------+-----------------------+---------+---------+----------+
| Addressing Mode| Assembly Language Form| OP CODE |No. Bytes|No. Cycles|
+----------------+-----------------------+---------+---------+----------+
| Immediate | CMP #$FF | $C9 | 2 | 2 |
| ZeroPage | CMP $FF | $C5 | 2 | 3 |
| ZeroPage,X | CMP $FF,X | $D5 | 2 | 4 |
| Absolute | CMP $FFFF | $CD | 3 | 4 |
| Absolute,X | CMP $FFFF,X | $DD | 3 | 4* |
| Absolute,Y | CMP $FFFF,Y | $D9 | 3 | 4* |
| (Indirect,X) | CMP ($FF,X) | $C1 | 2 | 6 |
| (Indirect),Y | CMP ($FF),Y | $D1 | 2 | 5* |
+----------------+-----------------------+---------+---------+----------+
* Add 1 if page boundary is crossed.
For penalty cycles on the 65816, check the desired addressing mode.
65816 Extensions:
+----------------+-----------------------+---------+---------+----------+
| Addressing Mode| Assembly Language Form| OP CODE |No. Bytes|No. Cycles|
+----------------+-----------------------+---------+---------+----------+
| AbsoluteLong | CMP $FFFFFF | $CF | 4 | 5 |
| AbsoluteLong,X | CMP $FFFFFF,X | $DF | 4 | 5 |
| (Indirect) | CMP ($FF) | $D2 | 2 | 5 |
| [Indirect Long]| CMP [$FF] | $C7 | 2 | 6 |
| [Ind.Long],Y | CMP [$FF],Y | $D7 | 2 | 6 |
| Relative,S | CMP $FF,S | $C3 | 2 | 4 |
| (Indirect,S),Y | CMP ($FF,S),Y | $D3 | 2 | 7 |
+----------------+-----------------------+---------+---------+----------+
|