C166 User's Guide

Return Values

C functions (which are declared as follows) may return a single value with a specified type.

<[>type<]> funcname (<[>args<]>)

where:

typeis the type of the value returned from the function. If no type is specified, int is assumed.
funcnameis the name of the function.
argsis the argument list for the function.

Return values are always returned in registers depending on the return value type. The following table lists return types and the registers used for each.

Return TypeRegister(s)Description
bitR4.0 
signed char
unsigned char
RL4 
signed int
unsigned int
R4 
signed long
unsigned long
R4-R5LSB in R4, MSB in R5.
floatR4-R532-bit IEEE format, exponent and sign in R5.
doubleR4-R764-bit IEEE format, exponent and sign in R7.
near (2-byte) pointerR4 
far (4-byte) pointer
huge (4-byte) pointer
R4-R5Offset in R4, selector in R5.