See below.
The outline is completed below. Input and output is left out. Detecting the end of input by testing for a sentinel value, as we do here, is usually regarded as poor style. It is used here to simplify the example.
main: li $v1,0 # zero the sum loop: . . . . # prompt the user for input li $v0,5 # read the integer syscall # into $v0 beq $v0,-999,done # while ( $v0 =/= -999 ) blt $v0,-32,out # less than -32 bgt $v0,32,out # greather than 32 addu $v1,$v1,$v0 # if in range add # else skip out: b loop done: . . . . # write out result
(Memory Test: ) What do set instructions do on MIPS?