title: How to reverse an array in Irvine Assembly Language?
body: <p>I am writing a number manipulation program, and one step is to reverse the array. So far I have</p>
  
  <pre><code>reverseArray proc
  mov eax, arraySize
  mov temp, eax
  Imul eax, 4
  mov esi, eax
  mov eax, 0
  mov number, 0
  jne L1
  L1: 
  cmp temp, 0
  je L3
  
  mov eax, numbers[esi]
  mov tempnumbers[ecx], eax
  
  mov eax, tempnumbers[ecx]
  call writeDec
  call crlf
  
  
  sub esi,4
  add ecx, 4
  sub temp, 1
  
  loop L1
  
  
  L2:
  ret
  
  
  L3:
  
  .If(number &gt;= 0)
  
   mov esi, 0
  .ENDIF
  mov eax, number
  cmp eax, arraySize
  je L2
  
  
  mov eax, tempnumbers[esi]
  mov numbers[esi], eax
  
  add esi, 4
  add number, 1
  loop L3
  </code></pre>
  
  <p>However this only reverses about half of my array. Did I do something wrong with the esi or ecx counters? Any help would be appreciated.</p>