MSP430 Instructions
4-111
16-Bit MSP430X CPU
* TST[.W]
Test destination
* TST.B
Test destination
Syntax
TST
dst or TST.W dst
TST.B
dst
Operation
dst + 1
dst + 0FFh + 1
Emulation
CMP
#0,dst
CMP.B
#0,dst
Description
The destination operand is compared with zero. The status bits are set accord-
ing to the result. The destination is not affected.
Status Bits
N: Set if destination is negative, reset if positive
Z: Set if destination contains zero, reset otherwise
C: Set
V: Reset
Mode Bits
OSCOFF, CPUOFF, and GIE are not affected.
Example
R7 is tested. If it is negative, continue at R7NEG; if it is positive but not zero,
continue at R7POS.
TST
R7
; Test R7
JN
R7NEG
; R7 is negative
JZ
R7ZERO
; R7 is zero
R7POS
......
; R7 is positive but not zero
R7NEG
......
; R7 is negative
R7ZERO
......
; R7 is zero
Example
The low byte of R7 is tested. If it is negative, continue at R7NEG; if it is positive
but not zero, continue at R7POS.
TST.B
R7
; Test low byte of R7
JN
R7NEG
; Low byte of R7 is negative
JZ
R7ZERO
; Low byte of R7 is zero
R7POS
......
; Low byte of R7 is positive but not zero
R7NEG
.....
; Low byte of R7 is negative
R7ZERO
......
; Low byte of R7 is zero
Summary of Contents for MSP430x4xx Family
Page 1: ...MSP430x4xx Family 2007 Mixed Signal Products User s Guide SLAU056G ...
Page 2: ......
Page 6: ...vi ...
Page 114: ...3 76 RISC 16 Bit CPU ...
Page 304: ...5 20 FLL Clock Module ...
Page 340: ...7 8 Supply Voltage Supervisor ...
Page 348: ...8 8 16 Bit Hardware Multiplier ...
Page 372: ...9 24 32 Bit Hardware Multiplier ...
Page 400: ...10 28 DMA Controller ...
Page 428: ...13 10 Basic Timer1 ...
Page 466: ...15 24 Timer_A ...
Page 522: ...17 30 USART Peripheral Interface UART Mode ...
Page 544: ...18 22 USART Peripheral Interface SPI Mode ...
Page 672: ...23 12 Comparator_A ...
Page 692: ...24 20 LCD Controller ...
Page 746: ...26 28 ADC12 ...