During normal program operation, CALL
,
CALLW
and interrupts will increment STKPTR while
RETLW
, RETURN
, and RETFIE
will
decrement STKPTR. STKPTR can be monitored to obtain the value of stack memory left at
any given time. The STKPTR always points at the currently used place on the stack.
Therefore, a CALL
or CALLW
will increment the STKPTR
and then write the PC, and a return will unload the PC value from the stack and then
decrement the STKPTR.