next up previous contents index
Next: 4.5.10 Function return values Up: 4.5 The PIC16 port Previous: 4.5.8 Memory Models   Contents   Index

4.5.9 Stack

The stack implementation for the PIC16 port uses two indirect registers, FSR1 and FSR2.

The following stack models are supported by PIC16 port

SMALL model means that only the FSRxL byte is used to access stack and frame, while LARGE uses both FSRxL and FSRxH registers. The following table shows the stack/frame pointers sizes according to stack model and the maximum space they can address:

Stack & Frame pointer sizes according to stack model small large
Stack pointer FSR1 8-bits 16-bits
Frame pointer FSR2 8-bits 16-bits

Currently stack and frame pointers should be initialized explicit by the user at the desired Data RAM position (see 4.5.5 Pragma Stack). Uninitialized stack and frame pointers can result in unexpected behavior of the resulting binary.


next up previous contents index
Next: 4.5.10 Function return values Up: 4.5 The PIC16 port Previous: 4.5.8 Memory Models   Contents   Index
Bernhard Held 2004-02-21