
Click above to get retro games delivered to your door ever month!
X-Hacker.org- iAPx86 - <b>test test flags: o d i t s z a p c</b>
[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
TEST Test Flags: O D I T S Z A P C
0 - - - * * ? * 0
TEST destination,source
Logic (AND destination,source) ; Set flags only
TEST performs a logical AND operation on its two operands and
updates the flags. None of the operands are changed.
Example: test eax, eax
jz ahead ; Skip if eax = 0
Example:
test al, 00100100b ; Test for bits 2 and 5
jz two_five_off ; If result is zero, both were off
one_or_both_set:
jpe two_five_set ; Can use parity flag in a byte result
two_or_five_set: ; Bit 2 or bit 5 was set
; ...
two_five_set: ; Both bits were set
; ...
two_five_off: ; Both bits were clear
Opcode Format
84 /r TEST r/m8,r8
85 /r TEST r/m16,r16
85 /r TEST r/m32,r32
A8 ib TEST AL,imm8
A9 iw TEST AX,imm16
A9 id TEST EAX,imm32
F6 /0 ib TEST r/m8,imm8
F7 /0 iw TEST r/m16,imm16
F7 /0 id TEST r/m32,imm32
Length and timing
Operands Bytes 8088 186 286 386 486 Pentium
reg, reg 2 3 3 2 2 1 1 UV
mem, reg 2+d(0,2) 13+EA 10 6 5 2 2 UV
reg, mem 2+d(0,2) 13+EA 10 6 5 2 2 UV
reg, imm 2+i(1,2) 5 4 3 2 1 1 UV
mem, imm 2+d(0,2) 11+EA 10 6 5 2 2 UV*
+i(1,2)
acc, imm 1+i(1,2) 4 4 3 2 1 1 UV
* = not pairable if there is a displacement and immediate
See Also: AND NEG NOT OR XOR LAHF Jcc SETcc BT Flags
Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson