In other words, is there any case I might need this instruction?
From Intel Instructions Manual, this is what the instruction do:
Load (E)CX bytes from DS:[(E)SI] to AL.
Take the following example in NASM:
section .data
src: db 0, 1, 2, 3
section .code
mov esi, src
mov ecx, 4
rep lodsb ; mov al, byte[esi + ecx -1]; ecx++
While the instruction rep lodsb
is executing, I don't have any control over the value loaded in al
. All I can do is waiting, until the instruction terminates to get the last value of al
, which, of course I can get directly, without the loop.
The same question goes for the rest of the family: REP LODS AX
, REP LODS EAX
and REP LODS RAX
.