The ADD instruction

The ADD (Add) instruction adds the contents of the specified source operand to the contents of accumulator A. The sum is then stored in the accumulator, overwriting its previous value.

The ADD instruction format

InstructionDescription
ADD reg8 This format is used to add reg8 to the 8-bit value in register A. Here reg8 can be any general-purpose register, for example A, B, C, D, E, H or L.
ADD 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.

Usage example

; Author: Evgeny Sergeevich Dovgopolov

num1: db 10h
num2: db 20h

main:
    mvi     a, 10h   ; Load the hexadecimal value 10h into register A
    mvi     b, 20h   ; Load the hexadecimal value 20h into register B
    add     b        ; Add the value in register B to the value in register A
    lda     num1     ; Load the value at the address of the variable num1 into register A
    lxi     h, num2  ; Load the address of the variable num2 into the HL register pair
    add     m        ; Add the value in the memory location to the value in register A

    hlt              ; Stop program execution

Example taken from the textbook "HANDYFAR - MASM (Evgeny Sergeevich Dovgopolov)".

Processor status flags

S
Yes
Z
Yes
AC
Yes
P
Yes
CY
Yes