It would be useful to have a read integer subroutine.
T he subroutine prompts the user for an integer and reads it in. The integer is returned in $v0. Here is a start on the subroutine:
$v0
# pread -- prompt for and read an integer # # on entry: # $ra -- return address # # on exit: # $v0 -- the integer pread: la $a0,prompt # print string li $v0,4 # service 4 syscall li $v0,5 # read int into $v0 syscall # service 5 # return nop # branch delay slot .data prompt: .asciiz "Enter an integer"
Fill in the blanks.