Instruction Set
4-243
TEST
Logical Compare
TEST
What It Does
TEST determines whether particular bits of a component are set to 1 by comparing the
component to a mask.
Syntax
Description
TEST computes the bitwise logical AND of its two operands. Each bit of the result is 1 if
both of the corresponding bits of the operands are 1; otherwise, each bit is 0. The result of
the operation is discarded and only the flags are modified.
Operation It Performs
Flag Settings After Instruction
Form
Opcode
Description
Clocks
Am186 Am188
TEST AL,
imm8
A8
ib
AND immediate byte with AL
3
3
TEST AX,
imm16
A9
iw
AND immediate word with AX
4
4
TEST
r/m8,imm8
F6
/0 ib
AND immediate byte with r/m byte
4/10
4/10
TEST
r/m16,imm16
F7
/0 iw
AND immediate word with r/m word
4/10
4/14
TEST
r/m8,r8
84
/r
AND byte register with r/m byte
3/10
3/10
TEST
r/m16,r16
85
/r
AND word register with r/m word
3/10
3/14
TEST
component,mask
/* compare component to mask */
temp =
component & mask;
/* clear overflow and carry flags */
OF = CF = 0;
15
14
13
12
11
10
9
8
7
6
5
4
3
2
1
0
Processor Status
Flags Register
reserved
OF DF
IF TF SF ZF
AF
PF
CF
? = undefined; – = unchanged
SF=1 if result is 0 or positive
SF=0 if result is negative
ZF=1 if result equal to 0
ZF=0 if result not equal to 0
PF=1 if low byte of result has even number of set bits
PF=0 otherwise
0
–
–
–
res ? res
res 0
Summary of Contents for Am186 Series
Page 1: ...Am186 and Am188 Family Instruction Set Manual February 1997...
Page 10: ...Table of Contents x...
Page 18: ...Programming 1 8...
Page 40: ...Instruction Set Listing 3 14...