user3097712
user3097712

Reputation: 1675

What does the instruction LODS DWORD PTR DS:[ESI]?

i have the following assembly instruction(as you can also see in the title):

 LODS DWORD PTR DS:[ESI]

On one website i have found out that:

 The lods instruction is unique among the string instructions. 
 You will never use a repeat prefix with this instruction. 
 The lods instruction copies the byte or word pointed at by ds:si 
 into the al, ax, or eax register, after which it increments or 
 decrements the si register by one, two, or four. 

But I did not the understand the point: how can i be sure in which of the registers al, ax or eax the byte or word is copied.

Can someone explain it to me in a more

Upvotes: 1

Views: 1858

Answers (1)

Russell Borogove
Russell Borogove

Reputation: 19037

The size of the operation determines which register is targeted and how far the ESI register is advanced. For LODS DWORD, a double-word (32-bit) datum is loaded, which means the 32-bit EAX register. LODS WORD would be 16-bit into the 16-bit AX register, and LODS BYTE would be the 8-bit AL.

Upvotes: 2

Related Questions