tst

Test

Sets the condition codes from the operand, as if comparing it with zero.

Sizes .b .w .l, .w by default

XNZVC –●●00
  • ● depends on the result
  • 0 always 0
  • – not changed

Forms

68020 only

These forms require the 68020. Select opt p=68020 before any code or data.

Operands

<ea>
An operand using one of the addressing modes listed for this form. The list determines whether it can be a register, memory or an immediate value. With opt p=68020, an allowed d(An,Xn) or d(PC,Xn) mode also permits the corresponding 68020 indexed and memory indirect forms. See 68020 addressing. More
#imm
An immediate value written after #: a number, character or label, such as #10, #$FF or #'a'. It must fit the operation’s size: byte -128 to 255, word -32768 to 65535, or long -2147483648 to 4294967295; signed and unsigned spellings are accepted. More

The operand and X are unchanged.

On the 68020, tst also accepts an address register at word or long size, an immediate value, or PC-relative memory such as tst.w count(pc).

* --- 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)