Section 9.5
Review Questions

Subroutines

  1. What are some reasons why subprograms are used? (Use your general knowledge about computer programming to answer this one.)
  1. What are some synonyms for subprogram? List at least 3.
  1. Which name is used by FORTRAN and most assembler languages?
  1. Where does the CSC-1 save the return address?
  1. What two CSC-1 instructions implement subprograms?
  1. Where does the CSC-1 store parameters?
  1. Which parameter calling method is used by the CSC-1?
               call by name
               call by reference
               call by value
               call by value/result
  1. What is the most popular way of implementing subprograms and parameters?
  1. What is another name for activation record?
  1. What two registers would be needed if the CSC-1 used a stack?
  1. Does the actual subprogram code begin with a special instruction?
  1. What role do labels play in assembler subprograms?
  1. Suppose there is a subprogram called max which computes the maximum of two parameters, called PARM1 and PARM2. The call is max(a,b). Write the CSC-1 instructions which would set up the paramters and call the subprogram. Do not worry about the return value.