Function Return Values

CPU registers are always used for function return values. The following table lists the return types and the registers used for each.

Return Type

Register

Description

 bit

Carry Flag

char,
unsigned char,
1-byte ptr

R7

int,
unsigned int,
2-byte ptr

R6 & R7

MSB in R6, LSB in R7

long,
unsigned long

R4 - R7

MSB in R4, LSB in R7

float

R4 - R7

32-Bit IEEE format

untyped ptr

R1 - R3

Memory type in R3, MSB R2, LSB R1

NOTE
If the first parameter of a function is of type bit, other parameters are not passed in registers. This is because the parameters that can be passed in registers are out of sequence with the numbering scheme shown above.  For this reason, bit parameters should be declared at the end of the argument list.