> I almost thought I could do this with the 18 series, but as I look closer, > I'm thinking not. Is there a way to copy data on and off the stack? looking at the 452 data sheet under memory organisation we see a section labeled return address stack, this contains the following. "The stack space is not part of either program or data space. The stack pointer is readable and writable, and the address on the top of the stack is readable and writable through SFR registers. Data can also be pushed to, or popped from, the stack using the top-of-stack SFRs. Status bits indicate if the stack pointer is at, or beyond the 31 levels provided." so now i head off to the special function registers section under data memory, this directs us to pages 37 and 38 where we find a description of the special function registers that relate to the stack. there seems to be enough information here to write code to save/restore the stack. The code to save the stack would be something like short long [32] savedstack; //since the first entry in the stack is in slot 1 //we may as well use slot zero in the array for the //stack pointer savedstack[0] = STKPTR&0x1f; while ((STKPTR&0x1f) != 0) { savedstack[STKPTR&0x1f] = TOS; _asm POP _endasm } and the code to restore it would be something like STKPTR=0 while ((STKPTR&0x1f) != savedstack[0]) { _asm PUSH _endasm TOS = savedstack[STKPTR&0x1f]; } -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist