The DAA instruction

The DAA (Decimal Adjust Accumulator) instruction is specially designed for binary-coded decimal (BCD) arithmetic. BCD is a way of representing decimal numbers in which each decimal digit is encoded as a 4-bit binary number.

The DAA instruction format

InstructionDescription
DAA Decimal adjustment of register A after addition.

Usage example

; Author: Evgeny Sergeevich Dovgopolov

main:
    mvi     a, 25h  ; Load the hexadecimal value 25h into register A
    adi     37h     ; Add 37h to the value in register A
    daa             ; Adjust the contents of 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