Datasheet

Instruction Set Description
www.ti.com
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
DADDX.A src,dst
Syntax
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 two (.B), four (.W), or
five (.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 two words.
DADDX.A #10h,&DECCNTR ; Add 10 to 20-bit BCD counter
Example The eight-digit BCD number contained in 20-bit addresses BCD and BCD+2 is added
decimally to an eight-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 two-digit BCD number contained in 20-bit address BCD is added decimally to a two-
digit BCD number contained in R4.
CLRC ; Clear carry
DADDX.B BCD,R4 ; Add BCD to R4 decimally.
; R4: 000ddh
226
CPUX SLAU144JDecember 2004Revised July 2013
Submit Documentation Feedback
Copyright © 2004–2013, Texas Instruments Incorporated