Late last evening, I wrote: >Tony - please forgive me for disagreeing with you. > >What you have written has two problems: At the label Dlist, change 'addwf >PCL' to 'movwf PCL' and change the (Dlist) in the statements with High >and Low with (Dilst+1). > >The first problems is because you already have the correct address in W >when calling the jump table. The second problem is because you need the >address of the start of the jump list. You have shifted that address by 1 >because of the 'addwf PCL'. > >dwayne > >At 01:56 PM 6/26/02 +1000, Tony Nixon wrote: >>This is one method... >> >> clrf Offset >>GData movlw High(DList) >> movwf PCLATH >> movlw Low(DList) >> addwf Offset,W >> btfsc STATUS,C >> incf PCLATH,F >> call DList >> ; do whatever with data in W >> incf LoopCount >> movlw High(GData) ; restore PCLATH >> movwf PCLATH >> goto GData >> >> org 0xWhatEver >> >>DList addwf PCL >> retlw 0x00 >> retlw 0x01 This still has a problem *if* the label DList is on the last word of a 2K ROM page. A better fix is to move the stuff that modifies PCLATH right to the DList subroutine as follows: clrf Offset GData call DList ;use Xcall if DList is on a different 2K page ; do whatever with data in W incf LoopCount goto GData org 0xWhatEver DList ;enters with appropriate offset in register Offset movlw High(DListStart) movwf PCLATH movlw Low(DListStart) addwf Offset,W btfsc STATUS,C incf PCLATH,F movwf PCL,F DListStart retlw 0x00 retlw 0x01 ... -- Dwayne Reid Trinity Electronics Systems Ltd Edmonton, AB, CANADA (780) 489-3199 voice (780) 487-6397 fax Celebrating 18 years of Engineering Innovation (1984 - 2002) .-. .-. .-. .-. .-. .-. .-. .-. .-. .- `-' `-' `-' `-' `-' `-' `-' `-' `-' Do NOT send unsolicited commercial email to this email address. This message neither grants consent to receive unsolicited commercial email nor is intended to solicit commercial email. -- http://www.piclist.com hint: PICList Posts must start with ONE topic: [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads