Section 9.5
Review Questions
Subroutines
What are some reasons why subprograms are used? (Use your general knowledge about computer programming to answer this one.)
What are some synonyms for
subprogram
? List at least 3.
Which name is used by FORTRAN and most assembler languages?
Where does the CSC-1 save the
return address
?
What two CSC-1 instructions implement subprograms?
Where does the CSC-1 store
parameters
?
Which
parameter calling method
is used by the CSC-1?
call by name call by reference call by value call by value/result
What is the most popular way of implementing subprograms and parameters?
What is another name for
activation record
?
What two registers would be needed if the CSC-1 used a
stack
?
Does the actual subprogram code begin with a special instruction?
What role do
labels
play in assembler subprograms?
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.