Ex6502.CPU.Executor.ADC (ex6502 v0.1.0) View Source

Add the value of memory and carry to accumulator storing result in accumulator

Operation

A + M + C -> A, C

Table

ADC | Add Memory to Accumulator with Carry
================================================

A + M + C -> A, C                N V - B D I Z C
                                 + + - - - - + +

addressing       assembler    opc  bytes  cycles
------------------------------------------------
immediate        ADC #$nn      69    2     2 d
absolute         ADC $nnnn     6D    3     4 d
absolute,X       ADC $nnnn,X   7D    3     4 dp
absolute,Y       ADC $nnnn,Y   79    3     4 dp
zeropage         ADC $nn       65    2     3 d
zeropage,X       ADC $nn,X     75    2     4 d
(zp indirect)    ADC ($nn)     72    2     5 d
(zp indirect,X)  ADC ($nn,X)   61    2     6 d
(zp indirect),Y  ADC ($nn),Y   71    2     5 dp

p: +1 if page is crossed
d: +1 if in decimal mode

Flags

  • Negative: 1 if bit 7 of result is 1; 0 otherwise
  • oVerflow: 1 when the sign of bit 7 is changed due to exceeding +127 or -128; else 0
  • Carry: 1 if sum of binary exceeds 255 or decimal add exceeds 99; else 0
  • Zero: 1 if result is zero; 0 otherwise

Link to this section Summary

Link to this section Functions