//----------------------------------------------------// // Generic template for function invocation // //----------------------------------------------------// // this code starts building the NEW frame for // the function that has been called // Make space for rv: PUSHIMM 0 // or ADDSP 1 // Store the current FBR value, which represents the // location of the current frame. The current frame is // the frame below the new one SaM is building. SaM // will be able to "locate" the previous with the // saved FBR: PUSHFBR // Push the parameter values: _code_for_pushing_param_values // Set up new FBR for n params: PUSHSP // push SP ("top" of stack) PUSHIMM n+1 // push # of params+1 SUB // SP - (params+1) POPFBR // store new FBR in the *register* // Call function f JSR f // Pop params ADDSP -n // Restore "old" FBR; now the FBR contains the // *previous* value of FBR, which had been saved: POPFBR