CSE 220 Lecture Notes - Lecture 7: Call Stack, Code Reuse, Memory Address
Document Summary
Macros are things we can wrap code in so we can repeatedly call it instead of having to type the same code ever and over. Essentially when the program is assembled, the macro gets substituted with the lines of code stored inside the macro body. Macros can be very helpful, but they have side effects where you can unintentionally modify the value of certain registers. Like a macro that prints a string can modify the values in and . Functions (methods) allow for more structured program, code reuse and make code easier to understand and maintain. We make a distinction between the caller and the callee. The caller is the function that calls the callee. In this example, main is the caller and sum is the callee. These are the major steps to calling a function in mips: The caller places the parameter values in argument registers - this is where the callee can access them.