Q: Trying to make a divide routine in MIPS I am writing out a small program to divide in MIPS (mostly as practice, I know there is a pseudo-instruction, I use it for testing). For some reason the result is either double or half of what it should be. I'm unsure why.
signextLoop:
     bge $t1 , $t0 ,  signextLoopEnd #will shift divisor until greater than dividend 
     sll $t1 , $t1 , 1
     j signextLoop
signextLoopEnd:

divi32:
    blt $t0 , $t1 shift32 #if dividend < divisor jump to shifting
    xor $t0 , $t0 , $t1
    addi $t4 , $t4 , 1
shift32:
    srl $t1 , $t1 , 1
    sll $t4 , $t4 , 1
    bgt $t0 , $zero , divi32 #if dividend > 0 keep dividing; else go to output

