Welcome to the new platform of Programmers Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use it's exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.
understanding copying a string using movsb?
[b]Edit, nevermind I figured out that movsb automatically adjusts ESI and EDI[/b]
I just started coding assembly so please excuse my ignorance.
Below is some sample code to copy "hello world" from one variable to another.
I have built and linked this code with no issues and checked that it is working in gdb and it works fine.
My question is, if movsb moves 1 byte at a time and it copies and does not remove the characters from the original HelloWorld buffer, how does this code know it should point to the next byte in the string, when it repeats the movsb?
Look forward to hearing your responses.
.ascii "Hello World"
.lcomm Destination, 50
movl $Destination, %edi
movl $11, %ecx
movl $1, %eax
movl $0, %ebx