title: Nested Loop Problem for MIPS (Prime Numbers)
body: <p>Hi I'm new to MIPS and I know my code is a tad bit messy, here's a prime numbers code I've written and it keeps bugging me, but I cant seem to figure out what is wrong with my code. I think the issue is with the nested loops since I'm not very used to using the loops using MIPS. I've been using MARS for coding MIPS and every time I run it, it just freezes.</p>
  <p>Here's my a section of my code where I coded the loop part for prime numbers below:</p>
  <pre><code>    #Outer loop 
  L2: move $t3, $zero
      # Inner loop
  L1: remu $t4, $t1, $t2
  bne $t4, $zero, I
  move $t3, $t5
  I:  
  blt $t2, $t1 L1
  bne $t3, $zero, P
  li  $v0, 1          
  move    $a0, $t1       
  syscall
  li  $v0, 4      
  la  $a0, space
  syscall   
       
  P:  
  move $t2, $t6
  bgt  $t1, $t0, E    
  j L2
  E:  li  $v0,    10  
      syscall     # call operating sys
  end:    jr  $ra
  
  </code></pre>