Abstract
When planning programs we generally find that there are some small tasks which need to be performed frequently and if the instructions for these are written out in full each time they are needed the program becomes large and unwieldy. Much time and program space could be saved if it were possible to write the program for each task once only, and execute it repeatedly when required. Since this is such a frequent requirement, all microprocessors make provision for doing so. The program for each task is arranged as a Subroutine and stored outside the normal sequence of the main program. The subroutine is a normal segment of program but in order that the computer can return to the main program after executing it, the subroutine must end with a special Return from Subroutine (RTS or RET) instruction.
This is a preview of subscription content, log in via an institution.
Preview
Unable to display preview. Download preview PDF.
Copyright information
© 1987 J.C. Cluley
About this chapter
Cite this chapter
Cluley, J.C. (1987). Subroutines and the Use of the Stack. In: An Introduction to Low Level Programming for Microprocessors. Macmillan Computer Science Series. Palgrave, London. https://doi.org/10.1007/978-1-349-09355-7_4
Download citation
DOI: https://doi.org/10.1007/978-1-349-09355-7_4
Publisher Name: Palgrave, London
Print ISBN: 978-0-333-43692-9
Online ISBN: 978-1-349-09355-7
eBook Packages: Computer ScienceComputer Science (R0)