SBC SBC Subtract memory from accumulator with borrow SBC
Operation: A - M - ~C -> A N V - B D I Z C
- / / . . . . / /
Note:C = Borrow
+----------------+-----------------------+---------+---------+----------+
| Addressing Mode| Assembly Language Form| OP CODE |No. Bytes|No. Cycles|
+----------------+-----------------------+---------+---------+----------+
| Immediate | SBC #$FF | $E9 | 2 | 2 |
| ZeroPage | SBC $FF | $E5 | 2 | 3 |
| ZeroPage,X | SBC $FF,X | $F5 | 2 | 4 |
| Absolute | SBC $FFFF | $ED | 3 | 4 |
| Absolute,X | SBC $FFFF,X | $FD | 3 | 4* |
| Absolute,Y | SBC $FFFF,Y | $F9 | 3 | 4* |
| (Indirect,X) | SBC ($FF,X) | $E1 | 2 | 6 |
| (Indirect),Y | SBC ($FF),Y | $F1 | 2 | 5* |
+----------------+-----------------------+---------+---------+----------+
* Add 1 when page boundary is crossed.
For penalty cycles on the 65816, check the desired addressing mode.
Note: See CPU-Bugs for a description how flags are affected.
Illegal Version:
+----------------+-----------------------+---------+---------+----------+
| Addressing Mode| Assembly Language Form| OP CODE |No. Bytes|No. Cycles|
+----------------+-----------------------+---------+---------+----------+
| Immediate | SBC #$FF | $EB | 2 | 2 |
+----------------+-----------------------+---------+---------+----------+
There doesn't seem to be a difference to the legal SBC.
65816 Extensions:
+----------------+-----------------------+---------+---------+----------+
| Addressing Mode| Assembly Language Form| OP CODE |No. Bytes|No. Cycles|
+----------------+-----------------------+---------+---------+----------+
| AbsoluteLong | SBC $FFFFFF | $EF | 4 | 5 |
| AbsoluteLong,X | SBC $FFFFFF,X | $FF | 4 | 5 |
| (Indirect) | SBC ($FF) | $F2 | 2 | 5 |
| [Indirect Long]| SBC [$FF] | $E7 | 2 | 6 |
| [Ind.Long],Y | SBC [$FF],Y | $F7 | 2 | 6 |
| Relative,S | SBC $FF,S | $E3 | 2 | 4 |
| (Indirect,S),Y | SBC ($FF,S),Y | $F3 | 2 | 7 |
+----------------+-----------------------+---------+---------+----------+
|