On Sat, Jun 13, 2009 at 11:43 PM, Marcel Birthelmer wrote: > It doesn't have a proper HW stack, in the sense that other processors do > (then again, MIPS doesn't either, so I suppose the point is moot). I know > they probably use the indirect addressing to simulate one, but it's still > not impossible that for some implementation-specific reason, the functions > would use local memory rather than a stack. That's all that I was saying. More information from MPLAB C18 user guide: *************************************** The MPLAB C18 software stack is an upward growing stack data structure on which the compiler places function arguments and local variables that have the storage class auto. The software stack is distinct from the hardware stack upon which the PIC microcontroller places function call return addresses. The Stack Pointer (FSR1) always points to the next available stack location. MPLAB C18 uses FSR2 as the Frame Pointer, providing quick access to local variables and parameters. When a function is invoked, its stack-based arguments are pushed onto the stack in right-to-left order and the function is called. The leftmost function argument is on the top of the software stack upon entry into the function. MPLAB C18 supports parameters and local variables allocated either on the software stack or directly from global memory. The static keyword places a local variable or a function parameter in global memory instead of on the software stack.[3] In general, stack-based local variables and function parameters require more code to access than static local variables and function parameters (see static Function Arguments). Functions that use stack-based variables are more flexible in that they can be reentrant and/or recursive. *************************************** There are also differences between the Extended Mode and the Non-Extended mode. -- Xiaofan http://mcuee.blogspot.com -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist