9.4.3 Computed Function Calls
A computed function CALL
allows programs to maintain tables of functions and
provide another way to execute state machines or Look-up Tables. When performing a table
read using a computed function CALL
, care has to be exercised if the
table location crosses a PCL memory boundary (each 256-byte block).
If using the CALL
instruction, the PCH[2:0] and PCL registers are loaded
with the operand of the CALL
instruction. PCH[6:3] is loaded with PCLATH[6:3].
The CALLW
instruction enables computed calls by combining PCLATH and
W to
form the destination address. A computed CALLW
is accomplished by
loading the W register with the desired address and executing CALLW
.
The PCL register is loaded with the value of W and PCH is loaded with PCLATH.