User`s manual

Dynamic C Users Manual digi.com 179
11.4.1.1 Stack Frame Diagram
Figure 11.1 shows the general appearance of a stack frame.
Figure 11.1 Assembly Code Stack Frame
The return address is always necessary. The presence of auto variables depends on the function definition.
The presence of arguments and structure return space depends on the function call. (The stack pointer may
actually point lower than the indicated mark temporarily because of temporary information pushed on the
stack.)
The shaded area in the stack frame is the stack storage allocated for auto variables. The assembler sym-
bol @SP represents the size of this area.
11.4.1.2 The Frame Reference Point
The frame reference point is a location in the stack frame that immediately follows the function’s return
address. The IX register may be used as a pointer to this location by putting the keyword useix before
the function, or the request can be specified globally by the compiler directive #useix. The default is
#nouseix. If the IX register is used as a frame reference pointer, its previous value is pushed on the
stack after the function’s return address. The frame reference point moves to encompass the saved IX
value.
Lower Addresses
Higher Addresses
(stack grows down)
Optional
Optional
Optional
Optional
Stack Frame
Frame Reference
Point
SP
Last Auto Variable
First Auto Variable
IX Register
Return Address
First Parameter
(pushed last)
Last Parameter
(pushed first)
Structure Return
Space