My other comment about crossing page boundaries:
The jump into the look-up table is made by adding a value to PCL. As PCL is the lower part of the program counter, changing it makes the program fetch the next instruction from the calculated address. For example if the program address is 0x80 and you add 0x05 to PCL, the next instruction is picked up from 0x85, that how the jump table works. But (it's a BIG but), the PCL register is only 8 bits wide so when adding a value to it makes it overflow, the most significant bit is lost and the address rolls round to zero. It does not automatically move to the next page, doing that requires the paging bits in the STATUS register be changed as well. For example, consider this table, I've typed the address in the first column to demonstrate the problem:
my_table:
00FC addwf PCL,f
00FD retlw 11
00FE retlw 22
00FF retlw 33
0100 retlw 44 ;note that the page boundary is crossed
0101 retlw 55
0102 retlw 66
0103 retlw 77
If called with W equal to 0, 1 or 2 it returns 11, 22 or 33 as expected.
If called with a number higher than 2 it doesn't work, the reason being that PCL, being 8 bits wide, ignores that the top of the address has changed from 00 to 01. So instead of returning values from the table, the program jumps to a new address in the bottom of memory and tries to continue from there. Calling it with w = 3 for example would make the program jump to address zero. It is further compounded because having jumped to the wrong address, it still has the original return address on the stack. It would almost certainly cause a crash.
Brian.