title: Unwanted ASCII characters in MIPS
body: <pre><code>bigloop:
  
     li  $s0, 0
  
  stripNonAlpha:
  
     lb $t5, ($a0)
     beqz $t5, contt
  
     add $t4, $s0, $a0       #address of input[i] in $t4
     lb  $t5, 0($t4)          #load value of input[i]
     addi $s0, $s0, 1     #i = i + 1
  
     slti $t1, $t5, 48        #if ascii code is less than 48
     bne $t1, $zero, strip   #remove ascii character
  
     slti $t1, $t5, 58       #if ascii code is greater than 57
  
     slti $t2, $t5, 65        #if ascii code is less than 65
     slt $t3, $t1, $t2       
     bne $t3, $zero, strip   #remove ascii character
  
     slti $t1, $t5, 91       #if ascii code is greater than 90
  
     slti $t2, $t5, 97        #if ascii code is less than 97
     slt $t3, $t1, $t2
     bne $t3, $zero, strip   #remove ascii character
  
     slti $t1, $t5, 123    #if ascii char is greater than 122
     beq $t1, $zero, strip   #remove ascii character
  
     j stripNonAlpha       #go to stripNonAlpha
  
  strip:
  
     add    $t5, $s0, $a0       #address of Buffer[i] in $t5
     add $t5, $t5, 32
     sb  $zero, 0($a0)      #Buffer[i] = 0
     addi   $s0, $s0, 1     #i = i + 1
     j   stripNonAlpha       #go to stripNonAlpha
  
  j bigloop
  
  contt:
  </code></pre>
  
  <p>I have such a case with these snippet of MIPS code that checks against any non alphanumeric character, when I print below whatever I write to console, it puts an additional 32 of ASCII value. For example, instead of a space character (32) it prints @ (64), or instead of ! (33), it prints capital A (65). I could not see, what may be the reason? Thanks in advance.</p>