title: Reversing stack elements MIPS logical error
body: <p>I am new to MIPS and writing a program of stack which reverses the elements in array.. i have tried everything to see if anything is wrong.. If anyone who can guide me?</p>
  <pre><code>.data
  array: .word 4, 1, 2, 3, 2, 23, 33, 3, 1, 9
  .word 21, 23, 25, 27, 29, 31, 3, 5, 7, 5
  .word 41, 43, 45, 47, 49, 51, 53, 55, 57, 59
  length: .word 30
  
  .text
  .globl main
  .ent main
  main:
  
  la $t0, array
  li $t1, 0 
  lw $t2, length 
  pushLoop:
  lw $t4, ($t0) 
  sw $t4, ($sp)
  add $t2, $t1, 0 
  add $t0, $t0, 4 
  blt $t1, $t2, pushLoop 
  
  
  la $t0, array 
  li $t1, 0 
  lw $t2, length 
  popLoop:
  lw $t4, ($sp)
  addu $sp, $sp, 4 
  sw $t4, ($t0) 
  add $t1, $t1, 1 
  add $t0, $t0, 4 
  blt $t1, $t2, popLoop 
  
  
  
  li $v0, 10 
  syscall 
  .end main
  </code></pre>