Try this: IF JUMP FOR ROUTINE0 MOVLW 0 MOVWF SSTATE IF JUMP FOR ROUTINE1 MOVLW 1 MOVWF SSTATE . . . IF JUMP FOR ROUTINE1 MOVLW 1 MOVWF SSTATE BRANCH: MOVF SSTATE,W ADDWF PCL GOTO ROUTINE0 GOTO ROUTINE1 . . . GOTO ROUTINEX Just preset values of SSTATE from 1 to X. Reggie ---------- > From: PHXSYS > To: PICLIST@MITVMA.MIT.EDU > Subject: Program Counter over 255-What to do? > Date: Tuesday, May 26, 1998 11:51 AM > > Hi everyone > > In my program I am using the program counter to sequence several routines. I > am using it like this: > > MOVF SSTATE,W > MOVWF PCL > > SSTATE is the address of the specific routine. My problem is SSTATE is an 8 > bit value and my routine length goes over 255 addresses. When it goes over 255 > it goes to the beginning of the program. I use the PAGE command before and > after routines, but it must be larger than a page. > > I have to keep the code efficient because of the serial timing, I don't have > much room for additional code. > > What are my options? > > Is there an efficient way to make SSTATE a 16bit number and will that even > work? For example if SSTATE was at 355 would the program counter no where to > go? > > Can I use a lookup table to provide any additional options? For example > offset the counter to GOTO's. I don't think I can do that. > > Is there a way to utilize a lookdown table? > > Any suggestions greatly appreciated. > > Thanks in advance > > Jon