
4:354
Volume 4: Base IA-32 Instruction Reference
SCAS/SCASB/SCASW/SCASD—Scan String Data
Description
Compares the byte, word, or double word specified with the source operand with the
value in the AL, AX, or EAX register, respectively, and sets the status flags in the
EFLAGS register according to the results. The source operand specifies the memory
location at the address ES:EDI. (When the operand-size attribute is 16, the DI register
is used as the source-index register.) The ES segment cannot be overridden with a
segment override prefix.
The SCASB, SCASW, and SCASD mnemonics are synonyms of the byte, word, and
doubleword versions of the SCAS instructions. They are simpler to use, but provide no
type or segment checking. (For the SCAS instruction, “ES:EDI” must be explicitly
specified in the instruction.)
After the comparison, the EDI register is incremented or decremented automatically
according to the setting of the DF flag in the EFLAGS register. (If the DF flag is 0, the
EDI register is incremented; if the DF flag is 1, the EDI register is decremented.) The
EDI register is incremented or decremented by 1 for byte operations, by 2 for word
operations, or by 4 for doubleword operations.
The SCAS, SCASB, SCASW, and SCASD instructions can be preceded by the REP prefix
for block comparisons of ECX bytes, words, or doublewords. More often, however, these
instructions will be used in a LOOP construct that takes some action based on the
setting of the status flags before the next comparison is made. See
“REP/REPE/REPZ/REPNE /REPNZ—Repeat String Operation Prefix” on page 4:337
for a
description of the REP prefix.
Operation
IF (byte cmparison)
THEN
temp
AL
SRC;
SetStatusFlags(temp);
THEN IF DF = 0
THEN (E)DI
1;
ELSE (E)DI
-1;
FI;
ELSE IF (word comparison)
THEN
temp
AX
SRC;
SetStatusFlags(temp)
THEN IF DF = 0
Opcode
Instruction
Description
AE
SCAS ES:(E)DI
Compare AL with byte at ES:(E)DI and set status flags
AF
SCAS ES:DI
Compare AX with word at ES:DI and set status flags
AF
SCAS ES:EDI
Compare EAX with doubleword at ES:EDI and set status flags
AE
SCASB
Compare AL with byte at ES:(E)DI and set status flags
AF
SCASW
Compare AX with word at ES:DI and set status flags
AF
SCASD
Compare EAX with doubleword at ES:EDI and set status flags
Содержание ITANIUM ARCHITECTURE
Страница 1: ......
Страница 7: ...402 Intel Itanium Architecture Software Developer s Manual Rev 2 3 ...
Страница 199: ...4 192 Volume 4 Base IA 32 Instruction Reference FWAIT Wait See entry for WAIT ...
Страница 269: ...4 262 Volume 4 Base IA 32 Instruction Reference LES Load Full Pointer See entry for LDS LES LFS LGS LSS ...
Страница 270: ...Volume 4 Base IA 32 Instruction Reference 4 263 LFS Load Full Pointer See entry for LDS LES LFS LGS LSS ...
Страница 273: ...4 266 Volume 4 Base IA 32 Instruction Reference LGS Load Full Pointer See entry for LDS LES LFS LGS LSS ...
Страница 288: ...Volume 4 Base IA 32 Instruction Reference 4 281 LSS Load Full Pointer See entry for LDS LES LFS LGS LSS ...
Страница 352: ...Volume 4 Base IA 32 Instruction Reference 4 345 ROL ROR Rotate See entry for RCL RCR ROL ROR ...
Страница 368: ...Volume 4 Base IA 32 Instruction Reference 4 361 SHL SHR Shift Instructions See entry for SAL SAR SHL SHR ...
Страница 373: ...4 366 Volume 4 Base IA 32 Instruction Reference SIDT Store Interrupt Descriptor Table Register See entry for SGDT SIDT ...
Страница 589: ...4 582 Volume 4 IA 32 SSE Instruction Reference ...
Страница 590: ...Index Intel Itanium Architecture Software Developer s Manual Rev 2 3 Index ...
Страница 591: ...Index Intel Itanium Architecture Software Developer s Manual Rev 2 3 ...
Страница 603: ...INDEX Index 12 Index for Volumes 1 2 3 and 4 ...
Страница 604: ......