btst

Sizes

byte, long

Affected Flags

X
N
Z
V
C
-
-
✱
-
-

Operands

Op 1
Dn/Im
Op 2
Dn/(An)/d(An)/d(An,Xn)/Ea/<label>/d(PC)/d(PC,Xn)/Im

Tests the bit of the second operand at the position of the value of the first operand, it changes the Z (zero) flag, the destination operand is not modified

* --- Z flag reflects the ORIGINAL bit value ---
move.l #%0101, d0
btst #0, d0 ; bit 0 = 1, Z flag clear
move.l #%0101, d1
btst #1, d1 ; bit 1 = 0, Z flag set

* --- Test higher bits ---
move.l #$80000000, d2
btst #31, d2 ; bit 31 = 1, Z flag clear