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

Answer:

Four bytes, for the single variable a.


main

Here is the code for main and its translation into assembly language. Fill in the blanks (Look for the Rules for Main.)

Recall that a variable needs four bytes on the stack.


#  main()
#  {
#    int a;
#    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.         
frame for main
  
         # 2. $fp = $sp - space_for_variables                         
         sub      , , 
         
         # 3. $sp = $fp
            $sp,$fp         
         

                                  # subroutine call

         . . . .
         
                                  # return from subroutine   
         
         . . . .     
         
                                  # epilog
                                  # return to OS 


QUESTION 10:

Fill in the blanks as the comments suggest.


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