ADC               Add memory to accumulator with carry                ADC

  Operation:  A + M + C -> A, C                         N V - B D I Z C
                                                        / / . . . . / /

  +----------------+-----------------------+---------+---------+----------+
  | Addressing Mode| Assembly Language Form| OP CODE |No. Bytes|No. Cycles|
  +----------------+-----------------------+---------+---------+----------+
  |  Immediate     |   ADC #$FF            |   $69   |    2    |    2     |
  |  ZeroPage      |   ADC $FF             |   $65   |    2    |    3     |
  |  ZeroPage,X    |   ADC $FF,X           |   $75   |    2    |    4     |
  |  Absolute      |   ADC $FFFF           |   $6D   |    3    |    4     |
  |  Absolute,X    |   ADC $FFFF,X         |   $7D   |    3    |    4*    |
  |  Absolute,Y    |   ADC $FFFF,Y         |   $79   |    3    |    4*    |
  |  (Indirect,X)  |   ADC ($FF,X)         |   $61   |    2    |    6     |
  |  (Indirect),Y  |   ADC ($FF),Y         |   $71   |    2    |    5*    |
  +----------------+-----------------------+---------+---------+----------+
  * Add 1 if 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.

 65816 Extensions:

  +----------------+-----------------------+---------+---------+----------+
  | Addressing Mode| Assembly Language Form| OP CODE |No. Bytes|No. Cycles|
  +----------------+-----------------------+---------+---------+----------+
  | AbsoluteLong   |   ADC $FFFFFF         |   $6F   |    4    |     5    |
  | AbsoluteLong,X |   ADC $FFFFFF,X       |   $7F   |    4    |     5    |
  | (Indirect)     |   ADC ($FF)           |   $72   |    2    |     5    |
  | [Indirect Long]|   ADC [$FF]           |   $67   |    2    |     6    |
  | [Ind.Long],Y   |   ADC [$FF],Y         |   $77   |    2    |     6    |
  | Relative,S     |   ADC $FF,S           |   $63   |    2    |     4    |
  | (Indirect,S),Y |   ADC ($FF,S),Y       |   $73   |    2    |     7    |
  +----------------+-----------------------+---------+---------+----------+

What it does: Adds byte in memory to the byte in the Accumulator, plus the carry flag if set. Sets the carry flag if result exceeds 255. The result is left in the Accumulator.

Major uses: Adds two numbers together. If the carry flag is set prior to an ADC, the resulting number will be one greater than the total of the two numbers being added (the carry is added to the result). Thus, one always clears the carry (CLC) before beginning any addition operation. Following an ADC, a set (up) carry flag indicates that the result exceeded one byte's capacity (was greater than 255), so you can chainadd bytes by subsequent ADCs without any further CLCs (see "Multi-Byte Addition" in Appendix D).

Other flags affected by addition include the V (overflow) flag. This flag is rarely of any interest to the programmer. It merely indicates that a result became larger than could be held within bits 0-6. In other words, the result "overflowed" into bit 7, the highest bit in a byte. Of greater importance is the fact that the Z is set if the result of an addition is zero. Also the N flag is set if bit 7 is set. This N flag is called the "negative" flag because you can manipulate bytes thinking of the seventh bit as a sign (+ or -) to accomplish "signed arithmetic" if you want to. In this mode, each byte can hold a maximum value of 127 (since the seventh bit is used to reveal the number's sign). The B branching instruction's Relative addressing mode uses this kind of arithmetic.

ADC can be used following an SED which puts the 6502 into "decimal mode." Here's an example. Note that the number 75 is decimal after you SED:

SED
CLC
LDA #75
ADC #$05
(this will result in 80)
CLD
(always get rid of decimal mode as soon as you've finished)

Attractive as it sounds, the decimal mode isn't of much real value to the programmer.