See below.
Here
is the complete main() routine.
Nearly all of the code is concerned with subroutine linkage.
This often happens.
# main()
# {
# int a; // a: 0($fp)
# a = mysub( 6 );
# print( a );
# }
.text
.globl main
main:
# prolog
# 1. when main gets control from QTSPIM
# the stack pointer points to the top
# of the stack.
sub $fp,$sp-4 # 2. $fp = $sp - space_for_variables
move $sp,$fp # 3. $sp = $fp
# subroutine call
# 7. No T registers to push
li $a0,6 # 8. Put argument into $a0
jal mysub # 9. Jump and link to subroutine
# regaining control from the subroutine
# Return value is in $v0
# 10. No T registers to restore
sw $v0,0($fp) # a = mysub( 6 )
# print a
lw $a0,0($fp) # load a into $a0
li $v0,1 # print integer service
syscall
# epilog
li $v0,10 # 11. return to QTSPIM
syscall # 12.
What is the name of the section of
code that mysub() starts with?