Organisation and use of the stack
The stack is a reserved area of RAM; it therefore consists of several memory locations (frequently about 256, or 100H), used for the temporary storage of data. We introduced the concept in Chapter 4 whilst discussing memory maps. The RAM locations dedicated to stack use are no different from any others, so it's quite possible to store data there and retrieve it in the normal way. This isn't often done, of course, since it would obviously compromise stack action. Before going any further, let's look at some typical uses of the stack. 1 The contents of registers may be stored temporarily. 2 The contents of registers may be changed over via the stack. 3 The return address following a CALL to a subroutine may be saved
automatically, using the stack. 4 Data and addresses may be saved during the servicing of an 'interrupt'.