> So my understanding based on what I have read and what you say here... >=20 > PAGESEL is needed to set PCLATH before each GOTO/CALL unless the target > is in the same CODE block. The call into interrupt does NOT change PCLATH= , > so there is a need to do it _within_ the handler. There is a standard handler which you will see in a lot of PIC16 code which= saves the PCLATH, W and STATUS register, and restores them all at the end = of the interrupt. Just because the CALL or GOTO is in a CODE block does not mean you will not= need to use PAGESEL within the CODE block. The defining reason for using P= AGESEL is if the CALL or GOTO is sending the program outside the current pa= ge of Flash ROM, and the size of this page various by chip. YOU need to loo= k at the datasheet for the chip you are using and make sure that YOU deal w= ith this in your code. On the other hand, you could download the development environment developed= by a past member of this group. Using macros he developed you ALWAYS put h= is equivalent of PAGESEL before EVERY CALL or GOTO, and the macro knows whe= re it is in the code, and ONLY IF NECESSARY generates the appropriate instr= uctions that emulate the PAGESEL macro. See http://www.embedinc.com/pic/ for more information. >=20 > RETURN/RETFIE don't use PCLATH, the entire address comes from the stack. Correct. >=20 > The only way to avoid these issues is to use absolute code (or to write c= ode > in a way that removes all of the relocatable code benefits) WRONG - you will still have the same issue with CALL, GOTO and interrupts w= hen using absolute mode. Absolute Mode and Relocatable Mode are purely asse= mbler and linker modes, the processor doesn't have different modes in its s= ilicon instruction set. >=20 > A remaining question... does RETURN/RETFIE reset PCLATH? In the case of > RETURN, it can be reset (as you know when the CALL happened) but in the > case of RETFIE, I guess that you store the PCLATH register just like W, F= SR > and STATUS? No. The only way to set PCLATH to anything is to deliberately load it yours= elf. RETURN/RETFIE only reload the program counter with the address that wa= s pushed onto the stack. In the case of RETFIE see my comments above. --=20 http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .