EWAVR_CompilerReference.pdf стр.124
FUNCTION CALL
--------------------------------------
Register parameters
For both calling conventions, the registers available for passing parameters are:
R16ЦR23
Parameters are allocated to registers using a first-fit algorithm, using parameter
alignment requirements according to the following table:
8-bit values 1 R16, R17, R18, R19, R20, R21, R22, R23
16-bit values 2 R17:R16, R19:R18, R21:R20, R23:R22
24-bit values 4 R18:R17:R16, R22:R21:R20
32-bit values 4 R19:R18:R17:R16, R23:R22:R21:R20
Register assignment using the old calling convention
In the old calling convention, the two left-most parameters are passed in registers
they are scalar and up to 32 bits in size.
The following table shows some of the possible combinations:
Parameters* Parameter 1 Parameter 2
f(b1,b2,Е) R16 R20
f(b1,w2,Е) R16 R20, R21
f(w1,l1,Е) R16, R17 R20, R21, R22, R23
f(l1,b2,Е) R16, R17, R18, R19 R20
f(l1,l2,Е) R16, R17, R18, R19 R20, R21, R22, R23
Registers used for returning values
For both calling conventions, the registers available for returning values are R16ЦR19.
Return values Passed in registers
8-bit values R16
16-bit values R17:R16
24-bit values R18:R17:R16
32-bit values R19:R18:R17:R16
Table 29: Registers used for returning values
-------------------------------------------------------
стр 118
Calling assembler routines from C
extern int foo(void);
or
extern int foo(int i, int j);