Jim You need to explicity set the value of the high byte of the program counter using PCLATH. This must be done before the ADDWF PCL instruction. See section on PCL and PCLATH in the datsheet. For midrange PIC (16F877), I write: movlw 0 call getvalue ... getvalue: <--------------------------------- Set value of PCLATH here ie: Movlw xx(value depends on location on code page) addwf PCL, F Movwf PCLATH retlw B'10100000' ...etc. Ian Rozowsky R&D Director Centurion Systems (Pty) Ltd. Box 506 Cramerview 2060 South Africa roz**@centsys.co.za ||Anti-spam - please remove the ** from the e-mail address before sending|| http://www.centsys.co.za -----Original Message----- From: pic microcontroller discussion list [mailto:PICLIST@MITVMA.MIT.EDU]On Behalf Of Jim Tellier Sent: 25 July, 2003 09:58 To: PICLIST@MITVMA.MIT.EDU Subject: [PIC]: computed goto question... OK, this seems embarassingly simple, but... For midrange PIC (16F877), I write: movlw 0 call getvalue ... getvalue: addwf PCL, F retlw B'10100000' ...etc. All code is within page 0 (< 2048 bytes). Single step thru, upon exec the 'addwf' the simulator says W=0, but the retlw isn't executed... control jumps off into middle of some other code. I'd swear I've used this construction before, but this isn't flyin'! Any ideas? Thanks! Jim -- http://www.piclist.com hint: To leave the PICList mailto:piclist-unsubscribe-request@mitvma.mit.edu -- http://www.piclist.com hint: To leave the PICList mailto:piclist-unsubscribe-request@mitvma.mit.edu