
Instruction Set
4-223
SCAS
SCAS
Tips
Before using SCAS, always be sure to: set up DI with the offset of the string, set up CX
with the length of the string, and use CLD (forward) or STD (backward) to establish the
direction for string processing.
To scan a string for a value that is different from a given value, use the REPE (or REPZ)
prefix to execute SCAS repeatedly. If all the components match the given value, ZF is set
to 1.
To scan a string for a value that is the same as a given value, use the REPNE (or REPNZ)
prefix to execute SCAS repeatedly. If no components match the given value, ZF is cleared
to 0.
The string instructions always advance SI and/or DI, regardless of the use of the REP prefix.
Be sure to set or clear DF before any string instruction.
Related Instructions
If you want to
See
Process string components from lower to higher addresses
CLD
Compare a component in one string with a component in another string
CMPS
Repeat one string comparison instruction while the components are the same
REPE
Repeat one string comparison instruction while the components are not the same REPNE
Process string components from higher to lower addresses
STD
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...