title: assembly code with MOVS
body: <p>As a beginner with assembly code, I'm confused with the movs. The resulting contents of the nine bytes starting at y would be (’a’,’b’,’c’,’a’,’b’,’c’,’a’,’b’,’c’), but i don't know why. I know movs is to copy from one memory to another, but how does the following code work? </p>
  
  <pre><code>1 .data
  2    x: .string "abcde" # 5 characters plus a null
  3    y: .space 9
  4
  5 .text
  6 .globl _start
  7 _start:
  8    movl $x, %esi              #esi point to x as source
  9    movl %esi, %edi            #edi point to x as destination
  10   addl $3, %edi              #why we add 3 to edi?
  11   movl $6, %ecx              #counter
  12   rep movsb                  #what does it exactly do?
  13 done:
  </code></pre>