Return multiple values: Difference between revisions

m
Line 41:
tax ;store in X
rts</lang>
 
=={{header|68000 Assembly}}==
{{trans|ARM Assembly}}
A function's "return value" is nothing more than the register state upon exit. However, to ensure compatibility between software, there are general calling conventions that compiler-written code will follow that standardizes which registers are used to return values from a function.
 
<lang 68000devpac>sum:
;Equivalent C code:
;int sum(int a,int b)
;{
; return a+b;
;}
ADD.L D1,D0
RTS</lang>
 
=={{header|8086 Assembly}}==
{{trans|ARM Assembly}}
A function's "return value" is nothing more than the register state upon exit. However, to ensure compatibility between software, there are general calling conventions that compiler-written code will follow that standardizes which registers are used to return values from a function.
<lang asm>sum:
;Equivalent C code:
;int sum(int a,int b)
;{
; return a+b;
;}
add ax,bx
ret</lang>
 
=={{header|ACL2}}==
1,489

edits