Thanks for the great explanation Joe! I knew most of it, but it was nice to have a bit of reassurance. On Fri, Feb 19, 2010 at 5:47 PM, ivp wrote: > 'banksel' the pseudo-op isn't applicable on the 18F. SFRs are in > contiguous order. If you look at a Data Memory Map, they are > bunched down at the end of data memory. So there's no instance of > PORTA in Bank0 at the same position as TRISA in Bank1, but > 'banks' in the 16F sense don't exist on the 18F anyway as SFRs > don't co-exist with GPRs in a block like they do on a 16F, except in > Bank15, but even then the addresses are quite distinct. The whole > memory structure is much more user-friendly and less prone to errors banksel on the 18F chips actually generates a movlb. So it does actually work in some circumstances. As for my problem, I tried using the fast stack return, and my main problems seem to have disappeared. I considered it a work around as I really wanted to go back to regular context saving and not relying on the stack. After stepping through some things and really examining the .MAP file, I realized that I wasn't using the access bank at all for my GPRs! It turns out that I wasn't declaring the data block correctly and the linker was placing my data in the second half of the first block. When I tried to use ,ACCESS on a command it was overwriting a SFR. So, with my udata changed to a udata_acs, my code seems to be working. Thanks for the help everyone! I wouldn't have sat staring at the memory map until it finally clicked without your help! I'm sure I'll break something new tomorrow, so stay tuned! Josh -- A common mistake that people make when trying to design something completely foolproof is to underestimate the ingenuity of complete fools. -Douglas Adams -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist