Assumptions for Example
We suppose the following:
- x1,y1,x2,y2 stored in memory location X
- add2 - adds together $4, $5 puts result in $6
- prod - multiplies $4, $5 puts result in $6
- sprod – (x1 * y1) + (x2 * y2), puts result in $8
- $29 is the stack pointer (address of ‘top’ of stack)
- The stack in MIPS grows downwards
- so that subtracting 4 from $29 makes room for a push
- and adding 4 to $29 adjusts for a pop