title: How can I reverse an ASCII character array?
body: <p>The objective of this program is inverting, or reversing, an array. For example, if I have "Hello, world!" the program is supposed to print "!dlrow ,olleH".
  But instead of doing so, the program prints: "!dlrow world!". Can someone explain to me why?</p>
  
  <p>My code so far is:</p>
  
  <pre><code>.data          
  
  msg:    .ascii    "Hello, world!\n"
  
  len = . - msg
  
  _start:
  
  movl $msg, %eax
  movl $len, %ebx
  dec %ebx
  dec %ebx
  save:
  
  movb msg(%ebx), %dl
  mov %dl, (%eax)
  inc %eax
  dec %ebx
  jnz save
  
  movl $len,%edx
  movl $msg,%ecx         
  movl $1,%ebx
  movl $WRITE,%eax      # pedir write ao sistema
  int  $LINUX_SYSCALL   # chama o sistema
  
  movl $0,%ebx
  movl $EXIT,%eax       # pedir exit ao sistema
  int  $LINUX_SYSCALL   # chama o sistema
  </code></pre>