5.8.6.2 Software Stack Return Values

Functions that use the software stack will pass values back to the calling function via btemp variables, provided the value is 4 bytes or less in size. The W register will be used to return byte-sized values for Enhanced Mid-range device functions that do not have a variable number of arguments. For objects larger than 4 bytes in size, they are returned on the stack. Reentrant PIC18 functions that return a value of type __bit do so using bit #0 in btemp0; other devices use the carry bit in the STATUS register.

As there is no frame pointer, accessing the return value location, or other stack-based objects, is not recommended in hand-written assembly code.