User's Manual

THE
80286
INSTRUCTION SET
SCAS/SCASB/SCASW-Compare
String
Data
Opcode
AE
AF
AE
AF
FLAGS MODIFIED
Instruction
SCAS mb
SCAS
mw
SCASB
SCASW
Clocks
7
7
7
7
Overflow,
sigri,
zero, auxiliary carry, parity, carry
FLAGS UNDEFINED
None
OPERATION
Description
Compare bytes AL - ES:[Olj, advance
01
Compare words AX - ES:[Olj, advance
01
Compare bytes AL - ES:[Olj, advance
01
Compare words
AX
- ES:[Olj, advance
01
SCAS subtracts the memory byte
or
word at ES:OI from the AL or AX register. The result
is
discarded;
only the flags are set. The operand must be addressable from the
ES register;
no
segment override
is
possible.
After the comparison
is
made,
01
is
automatically advanced.
If
the direction flag
is
0 (CLO
was
executed),
01
increments; if the direction flag
is
I (STO
was
executed),
01
decrements. DI increments
or
decrements
by
1 if bytes were compared;
by
2 if words were compared.
SCAS can
be
preceded by the REPE or
REPNE
prefix for a block search of CX bytes or words. Refer
to the REP instruction for details of this operation.
PROTECTED MODE EXCEPTIONS
#GP(O) for an illegal memory operand effective address
in
the CS, OS, or ES segments;
#SS(O)
for an
illegal address
in
the SS segment.
REAL ADDRESS MODE EXCEPTIONS
Interrupt
13
for a word operand at offset OFFFFH.
B-100