Texas Instruments MSP430x4xx Family User Manual page 238

Hide thumbs Also See for MSP430x4xx Family:
Table of Contents

Advertisement

Extended Instructions
DADDX.A
DADDX[.W]
DADDX.B
Syntax
Operation
Description
Status Bits
Mode Bits
Example
Example
Example
4-124
16-Bit MSP430X CPU
Add source address-word and carry decimally to destination address-word
Add source word and carry decimally to destination word
Add source byte and carry decimally to destination byte
DADDX.A src,dst
DADDX
src,dst or DADDX.W src,dst
DADDX.B src,dst
src + dst + C → dst (decimally)
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.
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.
OSCOFF, CPUOFF, and GIE are not affected.
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
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
DADDX.W
BCD,R4
DADDX.W
BCD+2,R5
JC
OVERFLOW
...
The two-digit BCD number contained in 20-bit address BCD is added
decimally to a two-digit BCD number contained in R4.
CLRC
DADDX.B
BCD,R4
; Clear carry
; Add LSDs
; Add MSDs with carry
; Result >99999999: go to error routine
;
Result ok
; Clear carry
; Add BCD to R4 decimally.
; R4: 000ddh

Advertisement

Table of Contents
loading

Table of Contents