tst
Test
Sets the condition codes from the operand, as if comparing it with zero.
Sizes .b .w .l, .w by default
Used in
- The condition code registerM68K assembly
- Compare and branchM68K assembly
- Loops and dbraM68K assembly
- Arithmetic, logic and bitsM68K assembly
- Arrays, strings and (a0)+M68K assembly
- Exceptions and the vector tableM68K assembly
- Length of a stringM68K assembly
- Reverse a string in placeM68K assembly
- A subroutine with its arguments in registersM68K assembly
- Move a square with the keyboardM68K assembly
XNZVC –●●00
- ● set from the result
- 0 always 0
- – not changed
Forms
Operands
<ea>- An operand using one of the instruction’s supported addressing modes, such as
d0,(a0)+or4(a1). It may name a register, memory or an immediate value. More
* --- Testing different values ---
move.l #$80, d0
tst.b d0 ; N flag set (bit 7 = 1)
move.l #$00, d1
tst.b d1 ; Z flag set
move.l #$7F, d2
tst.b d2 ; no flags (positive, nonzero)