
MOV DPH,R2
MOV DPH,R1
CLR A
JMP @A+DPTR
<pre></b>

This code is all fine. Normally the R2::R1 value is just a code address in the program someplace. In the setup for bank switching the linker sets the addresses for the target of the call into R2::R1 according to the place it thinks the call neeeds to go to. If it thinks the target is in the same bank as the current bank or someplace in the common bank then it simply inserts the target address into R2::R1 in the same way. If the linker correctly recognizes that the target address is in another bank then the R2::R1 value is set to small block of code in the interbank transfer table (which the linker puts in the common bank) and thus the small block of above intrinsic code (also in the common bank!) simply transfers control to the entry in this transfer table. Note that the transfer table is built automatically by the BL51 linker. The code at each entry in the interbank transfer table looks like this:
<b><pre>
MOV DPRT,#TRGADDR
AJMP BANKSWITCHER
