Bit TeST
NAME
BTST -- Bit test
SYNOPSIS
BTST Dn,<ea>
BTST #<data>,<ea>
Size = (Byte, Long)
FUNCTION
Tests a bit in the destination operand and sets the Z
condition code appropriately. If the destination is a data register,
any of the 32 bits can be specified by the modulo 32 number. When
the distination is a memory location, the operation must be a byte
operation, and therefore the bit number is modulo 8. In all cases,
bit zero is the least significant bit. The bit number for this
operation may be specified in either of two ways:
1. Immediate -- The bit number is specified as immediate data.
2. Register -- The specified data register contains the bit number.
FORMAT
In the case of BTST Dn,<ea>:
~~~~~~~~~~~~~~~~~~~~~~~~~~~
-----------------------------------------------------------------
|15 |14 |13 |12 |11 |10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
|---|---|---|---|-----------|---|---|---|-----------|-----------|
| 0 | 0 | 0 | 0 | REGISTER | 1 | 0 | 0 | MODE | REGISTER |
----------------------------------------=========================
<ea>
In the case of BTST #<data,<ea>:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
<ea>
----------------------------------------=========================
|15 |14 |13 |12 |11 |10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
|---|---|---|---|---|---|---|---|---|---|-----------|-----------|
| 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | MODE | REGISTER |
|---|---|---|---|---|---|---|---|-------------------------------|
| 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | NUMBER OF THE BIT |
-----------------------------------------------------------------
REGISTER
In the case of BTST Dn,<ea>:
~~~~~~~~~~~~~~~~~~~~~~~~~~~
<ea> is always destination, addressing modes are the followings:
--------------------------------- -------------------------------
|Addressing Mode|Mode| Register | |Addressing Mode|Mode|Register|
|-------------------------------| |-----------------------------|
| Dn * |000 |N° reg. Dn| | Abs.W |111 | 000 |
|-------------------------------| |-----------------------------|
| An | - | - | | Abs.L |111 | 001 |
|-------------------------------| |-----------------------------|
| (An) |010 |N° reg. An| | (d16,PC) |111 | 010 |
|-------------------------------| |-----------------------------|
| (An)+ |011 |N° reg. An| | (d8,PC,Xi) |111 | 011 |
|-------------------------------| |-----------------------------|
| -(An) |100 |N° reg. An| | (bd,PC,Xi) |111 | 011 |
|-------------------------------| |-----------------------------|
| (d16,An) |101 |N° reg. An| |([bd,PC,Xi],od)|111 | 011 |
|-------------------------------| |-----------------------------|
| (d8,An,Xi) |110 |N° reg. An| |([bd,PC],Xi,od)|111 | 011 |
|-------------------------------| |-----------------------------|
| (bd,An,Xi) |110 |N° reg. An| | #data |111 | 100 |
|-------------------------------| -------------------------------
|([bd,An,Xi]od) |110 |N° reg. An|
|-------------------------------|
|([bd,An],Xi,od)|110 |N° reg. An|
---------------------------------
* Long only; for others modes: Byte only.
In the case of BTST #<data,<ea>:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
--------------------------------- -------------------------------
|Addressing Mode|Mode| Register | |Addressing Mode|Mode|Register|
|-------------------------------| |-----------------------------|
| Dn * |000 |N° reg. Dn| | Abs.W |111 | 000 |
|-------------------------------| |-----------------------------|
| An | - | - | | Abs.L |111 | 001 |
|-------------------------------| |-----------------------------|
| (An) |010 |N° reg. An| | (d16,PC) |111 | 010 |
|-------------------------------| |-----------------------------|
| (An)+ |011 |N° reg. An| | (d8,PC,Xi) |111 | 011 |
|-------------------------------| |-----------------------------|
| -(An) |100 |N° reg. An| | (bd,PC,Xi) |111 | 011 |
|-------------------------------| |-----------------------------|
| (d16,An) |101 |N° reg. An| |([bd,PC,Xi],od)|111 | 011 |
|-------------------------------| |-----------------------------|
| (d8,An,Xi) |110 |N° reg. An| |([bd,PC],Xi,od)|111 | 011 |
|-------------------------------| |-----------------------------|
| (bd,An,Xi) |110 |N° reg. An| | #data | - | - |
|-------------------------------| -------------------------------
|([bd,An,Xi]od) |110 |N° reg. An|
|-------------------------------|
|([bd,An],Xi,od)|110 |N° reg. An|
---------------------------------
RESULT
X - not affected
N - not affected
Z - Set if the bit tested is zero. Cleared otherwise.
V - not affected
C - not affected
SEE ALSO
BFTST BFFFO
HTML Conversion by AG2HTML.pl V2.941126c, perl $RCSfile: btst.HTML,v $$Revision: 1.1 $$Date: 1999/09/14 21:14:07 $
Patch level: 36
& witbrock@cs.cmu.edu