Yes, because main
calls a subroutine.
The completed code for main
is below.
.text .globl main main: sub $sp,$sp,4 ## push the return address sw $ra,($sp) ## la $a0,mainPr # prompt the user li $v0,4 # service 4 syscall jal doLines # process lines of input lw $ra,($sp) ## pop return address add $sp,$sp,4 ## jr $ra ## return to OS .data mainPr: .ascii "Type each line of text followed by ENTER.\n" .asciiz "Type Q at the start of a line to finish.\n"
(As before, to run on QtSPIM remove the lines with ## and use exception handler service 10 to return to the system.)
doLines
The
main
routine calls doLines
.
The flowchart shows the design for that routine.
Below is its (incomplete) code.
No time like the present to fill in those blanks.