6.2.5 Stack
The stack allows a combination of up to 8 program calls and interrupts to occur. The stack contains
the return address from this branch in program execution.
Mid-Range MCU devices have an 8-level deep x 13-bit wide hardware stack. The stack space is
not part of either program or data space and the stack pointer is not readable or writable. The PC
is PUSHed onto the stack when a CALL instruction is executed or an interrupt causes a branch.
The stack is POPed in the event of a RETURN, RETLW or a RETFIE instruction execution. PCLATH
is not modified when the stack is PUSHed or POPed.
After the stack has been PUSHed eight times, the ninth push overwrites the value that was stored
from the first push. The tenth push overwrites the second push (and so on). An example of the
overwriting of the stack is shown in Figure 6-3.
...
...
...