Call a function: Difference between revisions

Content added Content deleted
m (→‎{{header|360 Assembly}}: Superfluous blanks suppressed)
Line 27: Line 27:
Due to assembler, argument are passed by reference.<br>
Due to assembler, argument are passed by reference.<br>
With:
With:
<lang 360asm>
<lang 360asm>X DS F
X DS F
Y DS F
Y DS F
Z DS F
Z DS F</lang>
</lang>
If you do not want to use the CALL macro instruction and for a link-edited object-module:
If you do not want to use the CALL macro instruction and for a link-edited object-module:
<lang 360asm>
<lang 360asm> L R15,=V(MULTPLIC)
L R15,=V(MULTPLIC)
LA R1,PARMLIST address of the paramter list
LA R1,PARMLIST address of the paramter list
BALR R14,R15 branch and link
BALR R14,R15 branch and link
Line 40: Line 37:
* ...
* ...
PARMLIST DC A(X)
PARMLIST DC A(X)
DC A(Y)
DC A(Y)</lang>
</lang>
If you call a link-edited object-module:
If you call a link-edited object-module:
<lang 360asm> CALL MULTPLIC,(X,Y) call MULTPLIC(X,Y)
<lang 360asm>
CALL MULTPLIC,(X,Y) call MULTPLIC(X,Y)
ST R0,Z Z=MULTPLIC(X,Y)</lang>
ST R0,Z Z=MULTPLIC(X,Y)
</lang>
If you call an load-module at execution time:
If you call an load-module at execution time:
<lang 360asm>
<lang 360asm> LOAD EP=MULTPLIC load load-module
LOAD EP=MULTPLIC load load-module
LR R15,R0 retrieve entry address
LR R15,R0 retrieve entry address
CALL (R15),(X,Y) call MULTPLIC(X,Y)
CALL (R15),(X,Y) call MULTPLIC(X,Y)
ST R0,Z Z=MULTPLIC(X,Y)
ST R0,Z Z=MULTPLIC(X,Y)</lang>
</lang>



=={{header|ActionScript}}==
=={{header|ActionScript}}==