3-370
INSTRUCTION SET REFERENCE
LODS/LODSB/LODSW/LODSDLoad String (Continued)
The LODS, LODSB, LODSW, and LODSD instructions can be preceded by the REP prefix for
block loads of ECX bytes, words, or doublewords. More often, however, these instructions
areused within a LOOP construct because further processing of the data moved into the register
is usually necessary before the next transfer can be made. Refer to REP/REPE/REPZ/REPNE
/REPNZRepeat String Operation Prefix in this chapter for a description of the REP prefix.
Operation
IF (byte load)
THEN
AL
<
SRC; (* byte load *)
THEN IF DF = 0
THEN (E)SI
<
(E)SI + 1;
ELSE (E)SI
<
(E)SI 1;
FI;
ELSE IF (word load)
THEN
AX
<
SRC; (* word load *)
THEN IF DF = 0
THEN (E)SI
<
(E)SI + 2;
ELSE (E)SI
<
(E)SI 2;
FI;
ELSE (* doubleword transfer *)
EAX
<
SRC; (* doubleword load *)
THEN IF DF = 0
THEN (E)SI
<
(E)SI + 4;
ELSE (E)SI
<
(E)SI 4;
FI;
FI;
FI;
Flags Affected
None.
Protected Mode Exceptions
#GP(0)
If a memory operand effective address is outside the CS, DS, ES, FS, or
GS segment limit.
If the DS, ES, FS, or GS register contains a null segment selector.
#SS(0)
If a memory operand effective address is outside the SS segment limit.
#PF(fault-code)If a page fault occurs.
#AC(0)
If alignment checking is enabled and an unaligned memory reference is
made while the current privilege level is 3.