MB95630H Series
MN702-00009-1v0-E
FUJITSU SEMICONDUCTOR LIMITED
615
APPENDIX A Instruction Overview
A.2 Special Instruction
Figure A.2-6 shows an assembler language example.
Figure A.2-6 Example of Using "XCHW A, PC"
●
CALLV #vct
This instruction is used to branch to a subroutine address stored in the vector table. The
instruction saves the return address (contents of PC) in the location at the address contained in
SP (stack pointer), and uses vector addressing to cause a branch to the address stored in the
vector table. Because CALLV #vct is a 1-byte instruction, the use of this instruction for
frequently used subroutines can reduce the entire program size.
Figure A.2-7 shows a summary of the instruction.
Figure A.2-7 Example of Executing CALLV #3
After the CALLV #vct instruction is executed, the contents of PC saved on the stack area are
the address of the operation code of the next instruction, rather than the address of the
operation code of CALLV #vct. Accordingly, Figure A.2-7 shows that the value saved in the
stack (0x1232 and 0x1233) is 0x5679, which is the address of the operation code of the
instruction that follows "CALLV vct" (return address).
MOVW
XCHW
DB
MOVW
A, #PUT
S
UB
A, PC
'PUT OUT DATA', EOL
A, 12
3
4H
(M
a
in ro
u
tine)
XCHW A, EP
PU
S
HW A
MOV A, @EP
INCW EP
MOV IO, A
CMP A, #EOL
BNE PT
S
1
POPW A
XCHW A, EP
JMP @A
PUT
S
UB
PT
S
1
(
Sub
ro
u
tine)
O
u
tp
u
t t
ab
le
d
a
t
a
here
0x12
3
4
PC
S
P
0xFEDC
PC
S
P
(Before exec
u
ting)
(After exec
u
ting)
0x12
3
2
0x567
8
0x12
3
2
0x12
33
0xXX
0xXX
0xFE
0xDC
0xFFC6
0xFFC7
0x12
3
2
0x12
33
0x56
0x79
0xFE
0xDC
0xFFC6
0xFFC7
(
−
2)