Texas Instruments MSP430x1xx User Manual page 72

Texas instruments modules and peripherals user's guide
Table of Contents

Advertisement

Instruction Set
DADD[.W]
Source and carry added decimally to destination
DADD.B
Source and carry added decimally to destination
Syntax
DADD
DADD.B
Operation
src + dst + C −> dst (decimally)
Description
The source operand and the destination operand are treated as four 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.
Status Bits
N: Set if the MSB is 1, reset otherwise
Z: Set if result is zero, reset otherwise
C: Set if the result is greater than 9999
V: Undefined
Mode Bits
OSCOFF, CPUOFF, and GIE are not affected.
Example
The eight-digit BCD number contained in R5 and R6 is added decimally to an
eight-digit BCD number contained in R3 and R4 (R6 and R4 contain the
MSDs).
CLRC
DADD
DADD
JC
Example
The two-digit decimal counter in the RAM byte CNT is incremented by one.
CLRC
DADD.B
or
SETC
DADD.B
RISC 16−Bit CPU
3-36
src,dst
or DADD.W
src,dst
Set if the result is greater than 99
; clear carry
R5,R3
; add LSDs
R6,R4
; add MSDs with carry
OVERFLOW ; If carry occurs go to error handling routine
; clear carry
#1,CNT
; increment decimal counter
; ≡ DADC.B
#0,CNT
src,dst
CNT

Advertisement

Table of Contents
loading

Table of Contents