Texas Instruments MSP430x1xx User Manual page 98

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

Advertisement

Instruction Set
* SBC[.W]
Subtract source and borrow/.NOT. carry from destination
* SBC.B
Subtract source and borrow/.NOT. carry from destination
Syntax
SBC
SBC.B
Operation
dst + 0FFFFh + C −> dst
dst + 0FFh + C −> dst
Emulation
SUBC
SUBC.B
Description
The carry bit (C) is added to the destination operand minus one. The previous
contents of the destination are lost.
Status Bits
N: Set if result is negative, reset if positive
Z: Set if result is zero, reset otherwise
C: Set if there is a carry from the MSB of the result, reset otherwise.
V: Set if an arithmetic overflow occurs, reset otherwise.
Mode Bits
OSCOFF, CPUOFF, and GIE are not affected.
Example
The 16-bit counter pointed to by R13 is subtracted from a 32-bit counter
pointed to by R12.
SUB
SBC
Example
The 8-bit counter pointed to by R13 is subtracted from a 16-bit counter pointed
to by R12.
SUB.B
SBC.B
Note: Borrow Implementation.
The borrow is treated as a .NOT. carry :
RISC 16−Bit CPU
3-62
dst
or
dst
#0,dst
#0,dst
Set to 1 if no borrow, reset if borrow.
@R13,0(R12)
2(R12)
@R13,0(R12)
1(R12)
SBC.W
dst
; Subtract LSDs
; Subtract carry from MSD
; Subtract LSDs
; Subtract carry from MSD
Borrow
Carry bit
Yes
0
No
1

Advertisement

Table of Contents
loading

Table of Contents