Mitsubishi Electronics FXCPU Video Game Controller User Manual


 
7 Applied Instructions (Program Flow)
7.2 CALL / Call Subroutine
113
FXCPU Structured Programming Manual
[Basic & Applied Instruction]
1
Outline
2
Instruction List
3
Configuration of
Instruction
4
How to Read
Explanation of
Instructions
5
Basic Instruction
6
Step Ladder
Instructions
7
Applied Instructions
(Program Flow)
8
Applied Instructions
(Move and
Compare)
9
Applied Instructions
(Arithmetic and
Logical Operation)
10
Applied Instructions
(Rotation and
Shift Operation)
Program examples
1. Example of fundamental use (no nesting)
2. Example of multiple CALL instructions in subroutines (multiple nesting)
CALL instruction can be used up to 4 times in subroutine programs. Nesting of up to five layers is allowed.
Main program
While X000 is ON, the program
execution jumps to a step with the label P10.
Subroutine program
When SRET instruction is executed
after the subroutine program has executed,
the program execution returns to the original step +1.
P10:
X000
CALL
EN ENO
p
SRET
EN ENO
FEND
EN ENO
P10
P11:
P12:
Main program
When X001 turns ON from OFF, the program
execution jumps to the pointer P11 only once.
Subroutine program1
When SRET instruction is executed, the program
execution returns to the main program.
If X002 is ON while the subroutine program 1 is
executed, the program execution jumps to a step with the pointer P12.
Subroutine program2
The subroutine program with P12 is executed,
and then the program execution returns to the subroutine program
with P11 by SRET instruction.
X001
X002
X003
CALLP
EN ENO
p
FEND
EN ENO
SRET
EN ENO
CALL
EN ENO
p
SRET
EN ENO
P12
P11