Alan B. Pearce wrote: > > So, for a solution try this: > > > > 0204 bitnum > > rlncf WREG ;Double offset for PIC18 family only. > > addwf pcl ; > > retlw 0x01 > > retlw 0x02 > > etc > > First doing a rotate can be a bad way to do it, because you first need to > clear the carry bit. Note the use of RLNCF "rotate left no carry". -- On the other hand, you must make sure that bit 7 is clear ! So begin with an 7-bit, right justifyed index... > Note that in Jinx's code he stores W in a variable anyway, so the easier way > of doubling the value is the following code line > > addwf temp,w ; value of w already in temp, so w = 2*w > ; no need to clear carry first Don't need the temp variable : addwf wreg,w ; add W and WREG, store in W. (add W to itself) (Does this work ???) > and then the following code allows a greater than 256 (16 family) or 128 (18 > family) entries > btfsc status,c ; has doubling w set carry flag? > incf PCLATH ; assume PCLATH already set to correct value > before entering here How can you have a table larger then 256 entries, if you begun with an 8-bit "index" in the first place ? Well, you could, but only accessing the even (or odd) entries, I'd guess... > However as > someone else pointed out both the size restriction and the page boundary > restriction can be removed by doing a full 16 bit calculation... ... and to have more then 256 *usuable* table entries at all, not ? Jan-Erik. -- http://www.piclist.com hint: The PICList is archived three different ways. See http://www.piclist.com/#archives for details.