go to previous page   go to home page   go to next page hear noise

Answer:

By convention, register $a0 is used to pass the argument. But in the body of the subroutine register $a0 is used to pass arguments to the SPIM service. So a safe copy must be made in an "S" register.


Calling the Subroutine

The main program (above) is modified to use the subroutine to print out both structs. Assume the following code has been copied into main:

        . . . .
        
        # $s1 contains the address of the first struct
        # $s2 contains the address of the second struct
        #      
        # write out the first struct    
        
        move     , 
        
        jal     PStruct
           
        # write out the second struct    
        
        move     , 
        
        jal     PStruct
        

QUESTION 12:

Fill in the blanks. Look back at the subroutine if needed.


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