title: MIPS drum sequencer ends imediatly on MARS enviroment
body: <p>I'm tryng to create a drum sequencer in MIPS I've stored in memory, with the directive ".word", 0 and 1 values. 1 means that the 1/16 of the 4/4 bar loop needs to be played. So register $t8 will adress the 16 words in memory where the program will control if the sound has to be played (1), or sleep (0). $t7 is a counter for verifying when the loop ends and the sequence has to be restarted. The problem is that when I assemble the program ( and MARS does it fine ) and run it, after one step of execution I obtain this message : "-- program is finished running (dropped off bottom) --" ok...but why ?!</p>
  
  <p>Here is the source Code:</p>
  
  <pre><code>.data
  
  LOOP1: .word 1, 0, 0, 0, 1, 1, 1, 0, 1, 0, 0, 0, 1, 1, 1, 0
  
  
      la $t8, LOOP1           #
  
      addi $t9, $t9, 0        #increments $t8 with the correct amount to adress every 1/16
  
      li $t2, 114             #sound's timbre
  
  Loop:
  
      addiu $t8, $t8, $t9
  
      lw $t1, 0($t8)
  
      addi $t7, $t7, 1        #$t7 is used to verify the loop's end
  
      bne $0, $t1, PlaySound      
  
      li $a0, 100
  
  
      li $v0, 32
  
      syscall                    #sleep syscall
  
  Afterplayng:
  
      sll $t9, $t9, 2
  
      beq $t7, 16, ReinitializeLoopCounter
  
          j Loop                #jumps back to the top of loop
  
  PlaySound:
  
      li $a0, 62 
  
      li $a1, 100
  
      move $a2, $t2
  
      li $a3, 120
  
      la $v0, 33
  
      syscall                #calls service 33, playing music
  
      j Afterplayng
  
  ReinitializeLoopCounter:
  
      addi $t7, $0, 1
  
      addi $t8, $t8, -64
  
      j Loop
  </code></pre>