TEST Test Flags: O D I T S Z A P C
0 * * ? * 0
TEST destination,source
Logic: (destination AND source) ; Set flags only
CF 0
OF 0
TEST performs a logical AND on its two operands and updates the flags.
Neither the destination nor source is changed.
--------------------------------------------------------------------------
Operands Clocks Transfers Bytes Example
byte(word)
register, register 3 - 2 TEST SI,DX
register, memory 9(13) + EA 1 2-4 TEST SI,MASK
accumulator, immediate 4 - 2-3 TEST AL,00000100b
register, immediate 5 - 3-4 TEST CX,1234
memory, immediate 11 + EA - 3-6 TEST PARAM,1F1Fh
--------------------------------------------------------------------------
TEST is useful for examining the status of individual bits. For
example, the following section of code will transfer control to
ONE_FIVE_OFF if both bits one and five of register AL are cleared. The
status of all other bits will be ignored.
TEST AL,00100010b ;Mask out all bits except 1 and 5
JZ ONE_FIVE_OFF ;If either was set, result was not 0
NOT_BOTH: . ;One or both bits was set
ONE_FIVE_OFF: ; Bits 1 and 5 were off
.
.
Seealso:
This page last updated on Fri Nov 30 10:49:50 MSK 2001
Copyright © 1992-2001, Vitaly Filatov, Moscow, Russia
Webmaster