daa

Decimal adjust A

Adjusts A after a BCD addition or subtraction so that each nibble holds a decimal digit.

1 byte4 cycles

SZHP/VNC ●●●●–●
  • ● depends on the result
  • – not changed

Forms

  • daa

    Adjusts A for BCD addition and subtraction operations. Sets the carry flag if A was greater than 99h, and otherwise leaves it unchanged. Sets the half-carry flag if the adjustment carries or borrows between the low and high digits, and resets it otherwise.

        .org 0x8000
        ld a, 5
        daa
        halt