Computer Science 237
Computer Organization
Williams College
Fall 2006
Lecture 14: More Subroutines in Assembly
Date: October 13, 2006
Agenda
Announcements
Computer Science colloquium today, 2:30 PM, TCL 206, Computer Science faculty discuss their research. Snacks upstairs before
Free Google stuff in the CS office
Lab next week: we will meet briefly in TCL 216 to set up your accounts to use LogicWorks and to learn the basics of that package
More Subroutines in Assembly
Naming local variables - negative offsets from the frame pointer
Dealing with pointers - always 32-bit entities (on the 68K) even when they point to a byte-sized or a word-sized entity
Pointers are stored in address registers
Access data through pointers using indirection
By following pointers, we can modify variables on the stack
in a different function's call frame
Getting a pointer to a variable:
LEA
instruction
Pushing a pointer to a variable right onto the stack:
PEA
instruction
Examples
swap
strcpy