go to previous page   go to home page   go to next page highlighting

Answer:

Of course, if linkage conventions are followed.


maxExp

The subroutine looks like this:

## maxExp -- compute the maximum of three expressions
##
## Input:
## $a0 -- a signed integer, x
## $a1 -- a signed integer, y
##           
##  Returns: 
## $v0 -- the maximum of x*x,  x*y, or 5*y

         .text
         .globl maxExp

maxExp:
         # prolog


         # body
         # compute x*x,  x*y, 5*y 

         # subroutine maxInt call with x*x and x*y
         
         # subroutine maxInt returns max of x*x x*y

         # subroutine maxInt call with current max and x*y
         
         # subroutine maxInt returns max of previous max and x*y

         # epilog

This subroutine has all four parts of the linkage convention.


QUESTION 16:

Will this subroutine need to save any S registers?


go to previous page   go to home page   go to next page