Sub Routine Calls Between Program Files
Sub Routine Calls Between Program Files: ECALL, ECALLP, SBRT, RET
Instruction | Device address | No. of Steps | Flag | |||||||||||||||
M | X | Y | K | L | F | T | C | S | Z | D | @D | Int. | Error | Zero | Carry | |||
ECALL (P) | ID | - | - | - | - | - | - | - | - | - | - | - | - | o | 3 | - | - | - |
n | - | - | - | - | - | - | - | - | - | - | - | - | o | |||||
SBRT | n | - | - | - | - | - | - | - | - | - | - | - | - | o | 1 | - | - | - |
RET | - | - | - | - | - | - | - | - | - | - | - | - | - | - | 1 | - | - | - |
Functions
When the input condition for the ECALL ID No. n instruction is turned ON, it moves to the corresponding sub routine ID program and executes the called operations between SBRT n and RET inside the sub routine program according to the ECALL ID No. n instruction.
ECALL ID No. n can be used by nesting.
The SBRT n and RET program must have the number corresponding to the ECALL ID No. n.
Conditions processed as an error:
When a value of n is entered other than 0 ~ 127.
When the ECALL ID No. n instruction exists without the corresponding program file.
When the SBRT n or the RET instruction stands alone.
It is possible to CALL or ECALL another SBRT within a SBRT.
Example)
When the input condition (M02) for the ECALL 3 (Program ID) 2 (Sub Routine) is turned ON, it moves to the corresponding sub routine program ID ‘3’ and executes the called operations between the SBRT 2 and the RET according to the ECALL 3 2 instruction.