Texas Instruments MSP430x1xx User Manual page 106

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

Advertisement

Instruction Set
* TST[.W]
Test destination
* TST.B
Test destination
Syntax
TST
TST.B
Operation
dst + 0FFFFh + 1
dst + 0FFh + 1
Emulation
CMP
CMP.B
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.
R7POS
R7NEG
R7ZERO
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.
R7POS
R7NEG
R7ZERO
RISC 16−Bit CPU
3-70
dst
or TST.W dst
dst
#0,dst
#0,dst
TST
R7
; Test R7
JN
R7NEG
; R7 is negative
JZ
R7ZERO
; R7 is zero
......
; R7 is positive but not zero
......
; R7 is negative
......
; R7 is zero
TST.B
R7
; Test low byte of R7
JN
R7NEG
; Low byte of R7 is negative
JZ
R7ZERO
; Low byte of R7 is zero
......
; Low byte of R7 is positive but not zero
.....
; Low byte of R7 is negative
......
; Low byte of R7 is zero

Advertisement

Table of Contents
loading

Table of Contents