23
µ
PD17062
Fig. 2-3 Operation of Subroutine Call Instruction
(a) Direct subroutine call (CALL addr) (b) Indirect subroutine call (CALL @AR)
Address Program memory
Instruction
CALL SUB1
Page 0
Page 1
0000H
07FFH
0800H
0F7FH
CALL SUB1
Address Program memory
Instruction
Page 0
Page 1
0000H
0010H
0085H
MOV AR0, #5H
MOV AR1, #8H
CALL @AR
Label: Label:
0500H SUB1:
RET
07FFH
0800H
0F7FH
SUB2:
SUB3:
RET
MOV AR0, #0H
MOV AR1, #1H
CALL @AR
Fig. 2-4 Sample Uses of Subroutine Call Instruction
(a) If the subroutine return instruction is in page 1 (b) If the first address of the subroutine is in page 1
Address Program memory
Instruction
CALL SUB1
Page 0
Page 1
0000H
07FFH
0800H
0F7FH
CALL SUB1
Address Program memory
Instruction
CALL SUB1
Page 0
Page 1
0000HLabel: Label:
0500H SUB1:
RET
07FFH
0800H
0F7FH
SUB1:BR SUB2
0890H SUB2:
CALL SUB1
RET