Tony, That would be great! I think I understand it now, but a little reinforcement would be great. Feel free to send it to this address. Thanks again! Josh -- A common mistake that people make when trying to design something completely foolproof is to underestimate the ingenuity of complete fools. -Douglas Adams > > Hi Josh, > > When the PCL is changed by any instruction, the PCLATH is used to make > up the ROM address bits that the instruction can't. > > For example, a GOTO instruction can only fit 11 bits of address > information in it. As the 14 bit PICs are 13 bit addressable, there > needs to be two other bits specified somewhere. These 2 bits come from > the PCLATH bits <4,3> and are placed into the 13 bit ROM address (PC) in > bit positions 12 and 11. This is done automatically whenever a GOTO or > CALL instruction is processed. This equates to 2K ROM page boundaries > for these two instructions. > > If the PCL is changed by something like ADDWF PCL, then only 8 bits of > address information is available from the instruction itself. So in this > case, 5 extra bits need to come from somewhere to make up 13 bits total. > These 5 bits also come from the PCLATH in bits <4-0>, and are placed > into the ROM address (PC) in bit positions 8 to 12. This is also done > automatically whenever an instruction such as ADDWF PCL, SUBWF PCL is > processed. This equates to the 256 word ROM boundaries for these type of > instructions. > > RETURN, RETFIE and RETLW instructions pull a complete 13 bit word from > the stack and place it directly into the Program Counter, and the PCLATH > value 'is not' changed. > > > As an aside, how do you know if your program crosses a page boundary? I > > have never checked, and I know for this program it should be safe to let > > my table start on page 3, but how do I know for sure? > > Warning messages are places in the *.lst file and at the end of the > assembly information file providing that these messages are not turned > off by a compiler directive. > > If you want, I can forward you an animated turorial (Windows 95 up) on > this subject to help make it a bit clearer. It will be about 600K. > > -- > Best regards > > Tony -- http://www.piclist.com hint: To leave the PICList mailto:piclist-unsubscribe-request@mitvma.mit.edu