Instruction Set Description
223
SLAU367P – October 2012 – Revised April 2020
Copyright © 2012–2020, Texas Instruments Incorporated
CPUX
4.6.3.11 DADDX
DADDX.A
Add source address-word and carry decimally to destination address-word
DADDX.[W]
Add source word and carry decimally to destination word
DADDX.B
Add source byte and carry decimally to destination byte
Syntax
DADDX.A src,dst
DADDX src,dst
or
DADDX.W src,dst
DADDX.B src,dst
Operation
src + dst + C
→
dst (decimally)
Description
The source operand and the destination operand are treated as 2 (.B), 4 (.W), or 5 (.A)
binary coded decimals (BCD) with positive signs. The source operand and the carry bit C
are added decimally to the destination operand. The source operand is not affected. The
previous contents of the destination are lost. The result is not defined for non-BCD
numbers. Both operands may be located in the full address space.
Status Bits
N:
Set if MSB of result is 1 (address-word > 79999h, word > 7999h, byte > 79h), reset
if MSB is 0.
Z:
Set if result is zero, reset otherwise
C:
Set if the BCD result is too large (address-word > 99999h, word > 9999h, byte >
99h), reset otherwise
V:
Undefined
Mode Bits
OSCOFF, CPUOFF, and GIE are not affected.
Example
Decimal 10 is added to the 20-bit BCD counter DECCNTR located in 2 words.
DADDX.A
#10h,&DECCNTR
; Add 10 to 20-bit BCD counter
Example
The 8-digit BCD number contained in 20-bit addresses BCD and BCD+2 is added
decimally to an 8-digit BCD number contained in R4 and R5 (BCD+2 and R5 contain the
MSDs).
CLRC
; Clear carry
DADDX.W
BCD,R4
; Add LSDs
DADDX.W
BCD+2,R5
; Add MSDs with carry
JC
OVERFLOW
; Result >99999999: go to error routine
...
; Result ok
Example
The 2-digit BCD number contained in 20-bit address BCD is added decimally to a 2-digit
BCD number contained in R4.
CLRC
; Clear carry
DADDX.B
BCD,R4
; Add BCD to R4 decimally.
; R4: 000ddh