1
votes

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

1
Also, the reason that you don't use a rep prefix is that you need to inspect the loaded value somehow before repeating. - Kerrek SB

1 Answers

2
votes

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.