title: Mips incrementing a count within an Array
body: <p>I have this code that goes through  an array of 5000 ASCII values of characters and then counts the number of each character and stores it into an array in alphabetical order.</p>
  
  <pre><code>    .text
  
      la $s7,results
  </code></pre>
  
  <p>array1 is the array of 5000 ASCII characters</p>
  
  <pre><code>    la $s6,array1
  
      main:
      addi $s0,$zero, 5000
      addi $s3, $zero,96
      addi $s4, $zero,65
      loop:lw $s2,0($s6)
           addi,$t1,$zero,0
           addi $s6,$s6,4
           addi, $s5,$zero, 0
           addi $s0,$s0, -1
           bge $s2, $s3, convert
  </code></pre>
  
  <p>The substaction of of $s2, - $s4($s4 is @ )is to get the positon of where the count needs to be stored
  ex F - @ = 6 </p>
  
  <pre><code>         sub $s5, $s2, $s4
  </code></pre>
  
  <p>I was wondering if this was right for it getting to the correct position and to increment the count?</p>
  
  <pre><code>        addi $t1, $t1, 1
          loop2: addi $s7, $s7, 4
                  lw $t0,($s7)
                  add $t0, $t0, $t1
                  sw $t0,($s7)  
                  addi, $s5,$s5, -1
                  beq $s5, $zero, loop2   
           bne $s0,$zero, loop    
  </code></pre>
  
  <p>This converts the character to an upper case ASCII value.</p>
  
  <pre><code>   convert: subi $s2,$s2, 32
          addi $s5, $s5, 0
          sub $s5, $s2, $s4
          j loop2
  
     .data
  
     results: .space 128  # Words to be used to store results
  </code></pre>