Fujitsu F2MC-8FX Computer Hardware User Manual


 
45
CHAPTER 5 CPU SOFTWARE ARCHITECTURE
Figure 5.2-1 Example of Using XCHW A, PC
CALLV #k
This instruction is used for branching to a subroutine address registered in the table. In this addressing
mode, the information about #k is included in the instruction code and the tale addresses listed in Table 5.2-
1 are created. After saving the contents of the current program counter (PC) in the stack, the program
branches to the address in the table. Because it is a 1-byte instruction, using it for frequently-used
subroutines reduces the size of the entire program.
[Main routine]
...
[Subroutine]
MOVW A, #PUTSUB
XCHW A, PC
DB 'PUT OUT DATA', EOL
MOVW A, #1234
H
PUTSUB XCHW A, EP
PUSHW A
PTS1 MOV A, @EP
INCW EP
MOV IO, A
CMP A, #EOL
BNE PTS1
POPW A
XCHW A, EP
JMP @A
Output table data here.
...
...
Table 5.2-1 Jump Address Table
#k Address table (upper jump address : lower jump address)
0FFC0
H
:FFC1
H
1FFC2
H
:FFC3
H
2FFC4
H
:FFC5
H
3FFC6
H
:FFC7
H
4FFC8
H
:FFC9
H
5FFCA
H
:FFCB
H
6FFCC
H
:FFCD
H
7FFCE
H
:FFCF
H