I am copying one string(source) to another(destination) using movsb in assembly. However, after the instruction movsb is performed, my source string is altered. Why is that? Does movsb alter the content of the source string too?

And if movsb really does that, what other instruction can i used to copy a string to another string?

The MOVSB instruction shouldn't alter the source string, no. However, it does increment both the (E)SI and (E)DI registers so that they point to the next element of the strings.

Are you certain that you loaded the two registers correctly? What if anything does it do to the destination string?

And just for the record, which assembler are you using?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.