CHAPTER 4 MEMORY BANK SELECT FUNCTION (
µ
PD78F0536, 78F0537, AND 78F0537D ONLY)
Preliminary User’s Manual U17260EJ3V1UD
97
4.3.4 Instruction branch to bank area by interrupt
When an interrupt occurs, instructions can branch to the memory bank specified by the BANK register by using the
vector table, but it is difficult to identify the BANK register when the interrupt occurs.
Therefore, specify the branch destination address specified by the vector table in the common area (0000H to
7FFFH), specify the memory bank at the branch destination by using the BANK register in the common area, and
execute the CALL instruction. At this time, save the BANK register value before the change to RAM, and restore the
value of the BANK register before executing the RETI instruction.
Remark
Allocate interrupt servicing that requires a quick response in the common area.
Memory bank m
Common
area
Bank
area
Memory bank n
Instruction branch
Save the original memory bank number.
Specify the address and memory bank
at the destination, and execute the call
instruction.
Vector table
•
Software example (when using interrupt request of 16-bit timer/event counter 00)
VCTBL CSEG AT
0020H
DW
BNKITM000
; Specifies an address at the timer interrupt destination.
RAMD DSEG
SADDR
R_BNKRN: DS
1
; Secures RAM for saving the memory bank number before the interrupt occurs.
BNKC CSEG
AT
7000H
BNKITM000:
;
Inter-memory
bank interrupt servicing routine
PUSH
AX
; Saves the contents of the AX register.
MOV
A,BANK
MOV
R_BNKRN,A
; Saves the memory bank number before the interrupt to RAM.
MOV
BANK,#BANKNUM TEST
; Specifies the memory bank number of the interrupt routine.
CALL
!TEST
; Calls the interrupt routine.
MOV
A,R_BNKRN
; Restores the memory bank number before the interrupt.
MOV
BANK,A
POP
AX
; Restores the contents of the AX register.
RETI
BN3 CSEG
BANK3
TEST:
; Interrupt servicing routine
MOV
⋅⋅⋅
:
:
RET
END