The ADC instruction
The ADC (Add with Carry) instruction adds the contents of the specified source operand and the current value of the carry flag (CY) to the contents of accumulator A. The result of this addition is then stored in the accumulator, replacing its previous value.
The ADC instruction format
| Instruction | Description |
|---|---|
| ADC reg8 | This format is used to add reg8 to the 8-bit value in register A with carry. Here reg8 can be any general-purpose register, for example A, B, C, D, E, H or L. |
| ADC mem8 | This format is used to add the value in the memory location pointed to by the contents of the HL register pair to the 8-bit value in register A with carry. |
Usage example
; Author: Evgeny Sergeevich Dovgopolov main: mvi a, 80h ; Load the hexadecimal value 80h into register A mvi b, 20h ; Load the hexadecimal value 20h into register B stc ; Set the carry flag CY adc b ; Add the value in register B + the CY flag to the value in register A hlt ; Stop program execution
Example taken from the textbook "HANDYFAR - MASM (Evgeny Sergeevich Dovgopolov)".
Processor status flags
S
YesZ
YesAC
YesP
YesCY
Yes