title: Converting a for loop into MIPS (printing the inner loop counter)
body: <p>I want to convert this Java code into MIPS:</p>
  <p>this is the java code i want to convert</p>
  <pre><code>for (int i = rows; i &gt;= 1; i--) 
      {
          for (int j = 1; j &lt;= i; j++)
          {
              System.out.print(j+&quot; &quot;);
          }
          
          System.out.println();
      }
  </code></pre>
  <p>and this is my MIPS code so far</p>
  <pre><code>    .data
      msg1:   .asciiz &quot;\n&quot;
      
      .text
      addi $t0,$t0,6 #t0 = 5
      
  loop1:  ble $t0,0,exit 
      subi $t0,$t0,1
      
      li $v0,4
      la $a0, msg1
      syscall
  loop2:  
      addi $t1,$t1,1
      
      bgt $t1,$t0,loop1 
  
      li $v0,1 #printing int 
      move $a0,$t1
      syscall
      
      
      li $v0,11
      la $a0,' '
      syscall
      j loop2
      
  
      exit:
      li $v0,10
      syscall
  </code></pre>
  <p>it keeps giving me this output: &quot;1 2 3 4 5&quot;</p>