CHAPTER 4 MEMORY BANK SELECT FUNCTION (
µ
PD78F0536, 78F0537, AND 78F0537D ONLY)
Preliminary User’s Manual U17260EJ3V1UD
95
4.3.3 Subroutine call between memory banks
Subroutines cannot be directly called between memory banks.
To call a subroutine between memory banks, branch once to the common area (0000H to 7FFFH), specify the
memory bank at the calling destination by using the BANK register there, execute the CALL instruction, and branch to
the call destination by that instruction.
At this time, save the current value of the BANK register to RAM. Restore the value of the BANK register before
executing the RET instruction.
Memory bank m
Common
area
Bank
area
Memory bank n
BR instruction
Common
area
Bank
area
CALL instruction
Memory bank m
Memory bank n
CALL
inst-
ruction
CALL
instruction
Change BANK and save
memory bank number at
calling source.
RET instruction
RET instruction