title: Reverse String MASM
body: <p>I have this code designed to take a string in &quot;originString&quot; and put it in reverse order in &quot;destinationString&quot;. I can't figure out how to make destinationString fill up and not just hold one value and then also print out with writeString and not just writeChar. Here is what i have.</p>
  <pre><code>INCLUDE     Irvine32.inc
  INCLUDELIB  Irvine32.lib
  
  .386
  .model flat, stdcall
  .stack 4096
  
  ExitProcess PROTO, dwExitCode:DWORD
  
  .data
  originString        BYTE    &quot;ABCDEFGHIJKLMNOPQRSTUVWXYZ&quot;, 0
  destinationString   BYTE    SIZEOF originString DUP(?), 0
  counter             BYTE    1
  
  
  
  
  .code
  main PROC
      ; YOUR CODE GOES HERE...
      ; Write a procedure that copies the contents of 'originString' to
      ;  'destinationString', but in reverse order.  You should use the
      ;  provided initialization value for 'originString' to test, but your
      ;  solution must work even if the contents or 'originString' are changed.
      MOV EAX, LENGTHOF originString
      MOV ECX, EAX
  
  countLoop_BEGIN:
                      
      MOVZX EAX, counter
      MOV EBX, LENGTHOF originString
      SUB EBX, EAX
      MOV AL, BYTE PTR [originString + (EBX-1)]
      cmp destinationString, ' '
      je   end_shifting
      inc EBX
      MOV destinationString, AL
      MOVZX EDX, destinationString
      CALL WriteString
      ;CALL Crlf
      INC counter
  
      LOOP countLoop_Begin    ; If ECX IS NOT EQUAL to 0, decrement ECX by 1 and JMP to 'countLoop_Begin'.
                              ; If ECX IS EQUAL to 0, do not jump and move onto the instruction following LOOP.
  
      MOV destinationString, AL
      MOV EDX, OFFSET destinationString
      CALL WriteString
      CALL Crlf
      end_shifting:    
          ret
  
  
      INVOKE ExitProcess, 0
  
  main ENDP
  
  
  
  END main
  </code></pre>