Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > sci.electronics.design > #380931
| From | Nobody <nobody@nowhere.invalid> |
|---|---|
| Newsgroups | sci.electronics.design |
| Subject | Re: OT: table CALL does not work |
| Date | 2015-10-09 23:32 +0100 |
| Organization | A noiseless patient Spider |
| Message-ID | <pan.2015.10.09.22.32.36.258000@nowhere.invalid> (permalink) |
| References | <TGURx.175753$WK.81663@fx10.iad> |
On Fri, 09 Oct 2015 12:36:18 -0700, Robert Baer wrote: > setup: > MOVLW Low(tab1) > ADDWF ptrlo,W ; add pointer to W > MOVLW High(tab1) > BTFSC STATUS,C > INCF PCLATH,F ; W=1 > CALL tab1 ;;*REMoving this, one sees 0x00 0xFF 0x01 repeating Here, W contains High(tab1), PCLATH contains zero. If you can ensure that the table doesn't cross a page boundary, it suffices to use: MOVLW High(tab1) MOVWF PCLATH MOVF ptrlo,W CALL tab1 In the most general case, you have to allow for the fact that tab1 might not even be on the same 2k super-page as the target RETLW instruction, meaning that PCLATH needs different values for the CALL and the computed goto, which basically means that the calculation needs to be moved into the table routine. E.g. MOVLW High(tab1) ; far call to tab1 MOVWF PCLATH CALL tab1 ... tab1: MOVLW High(tab1_data) ADDWF ptrhi,W MOVWF PCLATH MOVLW Low(tab1_data) ADDWF ptrlo,W BTFSC STATUS,C INCF PCLATH,F MOVWF PCL,F tab1_data: RETLW ...
Back to sci.electronics.design | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
OT: table CALL does not work Robert Baer <robertbaer@localnet.com> - 2015-10-09 12:36 -0700
Re: OT: table CALL does not work "P E Schoen" <paul@pstech-inc.com> - 2015-10-09 18:00 -0400
Re: OT: table CALL does not work Robert Baer <robertbaer@localnet.com> - 2015-10-10 00:19 -0700
Re: OT: table CALL does not work Nobody <nobody@nowhere.invalid> - 2015-10-09 23:32 +0100
Re: OT: table CALL does not work Robert Baer <robertbaer@localnet.com> - 2015-10-10 00:32 -0700
Re: OT: table CALL does not work Martin Brown <|||newspam|||@nezumi.demon.co.uk> - 2015-10-10 09:56 +0100
Re: table CALL does not work "P E Schoen" <paul@pstech-inc.com> - 2015-10-10 18:38 -0400
Re: table CALL does not work Martin Brown <|||newspam|||@nezumi.demon.co.uk> - 2015-10-12 09:10 +0100
Re: OT: table CALL does not work Nobody <nobody@nowhere.invalid> - 2015-10-11 22:50 +0100
Re: OT: table CALL does not work Robert Baer <robertbaer@localnet.com> - 2015-10-11 23:23 -0700
Re: OT: table CALL does not work Martin Riddle <martin_ridd@verizon.net> - 2015-10-11 00:27 -0400
Re: OT: table CALL does not work Martin Riddle <martin_ridd@verizon.net> - 2015-10-11 00:33 -0400
Re: OT: table CALL does not work Robert Baer <robertbaer@localnet.com> - 2015-10-11 13:37 -0700
Re: OT: table CALL does not work Martin Riddle <martin_ridd@verizon.net> - 2015-10-11 20:54 -0400
Re: OT: table CALL does not work Robert Baer <robertbaer@localnet.com> - 2015-10-11 13:35 -0700
Re: OT: table CALL does not work bitrex <bitrex@de.lete.earthlink.net> - 2015-10-11 16:44 -0400
Re: OT: table CALL does not work Martin Brown <|||newspam|||@nezumi.demon.co.uk> - 2015-10-12 18:12 +0100
csiph-web