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

See also: CMP
See also: AND
See also: NOT
See also: OR
See also: XOR
See also: EA
See also: Flags
Next:     WAIT Wait