Home  Products Tutorials Schematics Robotics Resources  Radio Stuff  Components Career  Download   Link Exchange   Sitemap


Add your Link (FREE)

Schematics and Circuits

Electronic Tutorials

Practical Experiments

More Resources

Computer Architectures - Complicating a simple Computer - Local variables

To make the call/return protocol complete, we also need to show how to allocte variables local to a particular subprogram. These variables are allocated on the stack. Fortunately, we already have all the architectural support we need for local variables.

We will use the following stack frame layout:

Allocation of local variables must now be integrated into the call/return protocol as follows:

Caller                                 Callee
------                                 ------

compute argument n in R1
push R1
...
compute argument 1 in R1
push R1
jsr callee
                                       addsp -m (to allocate m vars)
                                       compute return value in R0
                                       addsp m (to deallocate vars)
				       ret
addsp n (to pop arguments)

            

 


 

Home  Tutorials Schematics Robotics Resources  Radio Stuff  Components Career  Download   Link Exchange   Sitemap


Terms & Conditions  Privacy Policy and Disclaimer
webmaster@electronicsteacher.com