Return multiple values: Difference between revisions
→{{header|8086 Assembly}}
Puppydrum64 (talk | contribs) m (→{{header|68000 Assembly}}: actually did what the task asked me to do) |
Puppydrum64 (talk | contribs) |
||
Line 60:
{{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:▼
This function takes two 16-bit numbers in CX and DX, and outputs their sum to AX and their difference to BX.
mov bx,dx
add ax,bx
sub cx,dx
mov bx,cx
ret</lang>
|