title: Implementing toUpper function in MIPS
body: <p>So I'm trying to implement a kind of toUpper function in MIPS. The function has access to two variables: $a0, which is the starting address of a string of characters, and $a1 which is the length of the string. I'm trying to loop through the string and convert it to uppercase. Does anyone know where I'm going wrong? </p>
  
  <p>I think I'm having trouble actually loading the first character from the starting address into a variable. </p>
  
  <pre><code>to_upper:
  
      li $t0, 0 #initialize counter  
      li $t1, 0
  
  Loop: 
      addi $t0, $t0, 1
  
      sgt $t5, $t0, $a1   
      beqi $t5, 1, Done   
  
      slti $t5, $t1, 97
      beqi $t5, 1, Loop
  
      sgti $t5,$t1, 122
      beqi $t5, 1, Loop
  
      subi $t1, $t1, 32
  
  j Loop
  
      Done:
      jr $ra 
  </code></pre>