title: MIPS binary to decimal convert
body: <p>I am trying to write a assembly program using MIPS to read a binary number and convert it to decimal format. I am trying to assign the users input into a buffer and do the calculation using a loop. How can I find out end of the binary number to return from the loop? Thank you.</p>
  
  <pre><code>    .text
  main:
  
      li $v0, 8
      la $a0, input   #; load the address
      li $a1, 32
  
      syscall
      addi $sp, $sp, -4
      li $t0, 0
      la t1, input
  
      lb $t2, 0($t1)
      sw $t2, 0($sp)
      addi $sp, $sp, -4
      addi $t1, $t1, 1
  
      .data
  input: .space 32    #; 32 bytes are allocate for input
  </code></pre>