2 INFORM Explanation
FS100 2.2 Control Instruction : CALL
2-34
(2) RET Instruction with Return Value
For example, to create the job which adds any two register values, the
register number had to be passed from the calling job, and in the called
job, the calculation result had to be entered in any of the global variable,
then the calling job had to refer to that. This can be described as follows:
<Calling Job>
NOP
SET B000 1
SET B001 2
CALL JOB: ADD_REG
GET I0100 I099 ; Returns the calculation result to I099
<Called Job>
Job name: ADD_REG
NOP
GETREG I000 MREG#(B000)
GETREG I099 MREG#(B001)
ADD I099 I000
RET
By using the CALL instruction with argument and the RET instruction with
return value, the above can be described as follows:
<Calling Job>
NOP
CALL JOB: ADD_REG (1, 2)
GETS I001 $RV ;
Receives the addition result as the return value at $RV
<Called Job>
Job name: ADD_REG
NOP
GETARG LB000 IARG#(1)// Register 1
GETARG LB001 IARG#(2)// Register 2
GETREG LI000 MREG#(LB000)
GETREG LI001 MREG#(LB001)
ADD LI001 I000
RET LI001 ; Returns the addition result as the return value
Thus, the global variable to receive and pass the answer is no longer
necessary.