Opcode Instruction Clocks Description AC LODS m8 5 Load byte [(E)SI] into AL AD LODS m16 5 Load word [(E)SI] into AX AD LODS m32 5 Load dword [(E)SI] into EAX AC LODSB 5 Load byte DS:[(E)SI] into AL AD LODSW 5 Load word DS:[(E)SI] into AX AD LODSD 5 Load dword DS:[(E)SI] into EAX
IF AddressSize = 16 THEN use SI for source-index ELSE (* AddressSize = 32 *) use ESI for source-index; FI; IF byte type of instruction THEN AL := [source-index]; (* byte load *) IF DF = 0 THEN IncDec := 1 ELSE IncDec := -1; FI; ELSE IF OperandSize = 16 THEN AX := [source-index]; (* word load *) IF DF = 0 THEN IncDec := 2 ELSE IncDec := -2; FI; ELSE (* OperandSize = 32 *) EAX := [source-index]; (* dword load *) IF DF = 0 THEN IncDec := 4 ELSE IncDec := -4; FI; FI; FI; source-index := source-index + IncDec
If the address-size attribute for this instruction is 16 bits, SI is used for the source-index register; otherwise the address-size attribute is 32 bits, and the ESI register is used. The address of the source data is determined solely by the contents of ESI/SI. Load the correct index value into SI before executing the LODS instruction. LODSB, LODSW, LODSD are synonyms for the byte, word, and doubleword LODS instructions.
LODS can be preceded by the REP prefix; however, LODS is used more typically within a LOOP construct, because further processing of the data moved into EAX, AX, or AL is usually necessary.
up:
Chapter 17 -- 80386 Instruction Set
prev: LOCK Assert LOCK# Signal Prefix
next: LOOP/LOOPcond Loop Control with CX Counter