views:

43

answers:

1

What x86 register denotes source location in movsb instruction?

+5  A: 

In 32-bit mode, esi.

In specific, movsb copies one byte from ds:esi to es:edi, the adjusts both esi and edi by 1, either up or down depending on the direction flag.

Chris Jester-Young
A bit of related x86 trivia for today's youth - `SI` (or `ESI` in the 32-bit world) stands for 'source index' and `DI` stands for 'destination index', which comes from the special-purpose uses of these registers.
Michael Burr
Also be aware the default segment registers DS and ES can be overridden to use other segment registers.
I. J. Kennedy
@I. J. Kennedy: Only the `ds` can be overridden. The `es` is fixed.
Chris Jester-Young
In general, any instruction that uses `ds` by default can be overridden with a segment prefix; any instruction that uses `es` (e.g., `stosb` and the like) is fixed and cannot be overridden.
Chris Jester-Young
Thanks for the help.