title: Printing from a declared array in MIPS
body: <p>So I'm making something that looks like this </p>
  
  <pre><code>for(i=0; i&lt;10; i++){
      print i;
  }
  </code></pre>
  
  <p>but in MIPS, and i'm having trouble understanding how i'm supposed to increment the index location. Here is what I have so far</p>
  
  <pre><code>.data
      a: 
          .word 3, 2, 1, 8, 6, 9, 3, 4, 2, 5
      nline: 
          .asciiz "\n"
  
      .text
      .globl main
  main:
      li $v0, 0
  
      loop1:
          bgt $t0, 10, exit
          addi $t0, $t0, 1 #counter
  
          lw $t1, a
  
          li  $v0, 1      
          move    $a0, $t1
          syscall
      exit:
          li  $v0, 10
          syscall
  </code></pre>
  
  <p>so I wouldn't want to put lw $t1, a inside the loop, but the idea is that with every iteration of the loop it would print 3, 4, 1, 8 and I know that would be a, a+4, a+8, a+12, ect, but I don't understand how to code that without there being a thousand functions.</p>