XA User Guide 6-88 4/17/98
DA Decimal Adjust
Syntax: DA Rd
Operation: if (Rd.3-0) > 9 or (AC) = 1
then (Rd.3-0) <-- (Rd.3-0) + 6
if (Rd.7-4) > 9 or (C) = 1
then (Rd.7-4) <-- (Rd.7-4) + 6
Description: Adjusts the destination register to BCD format (binary-coded decimal) following an
ADD or ADDC operation on BCD values. This operation may only be done on a byte register.
If the lower 4 bits of the destination value are greater than 9, or if the AC flag is set, 6 is added to
the value. This may cause the carry flag to be set if this addition caused a carry out of the upper 4
bits of the value.
If the upper 4 bits of the destination value are greater than 9, or if the carry flag was set by the add
to the lower bits, 60 hex is added to the value. This may cause the carry flag to be set if this addition
caused a carry out of the upper 4 bits of the value. Carry will never be cleared by the DA instruction
if it was already set.
Size: Byte
Flags Updated: C, N, Z
The carry flag may be set but not cleared. See the description of the carry flag update above.
Bytes:2
Clocks:4
Encoding:
Note: Please refer to the table on the next page.
1 0 0 1 0 0 0 0
d d d d 1 0 0 0