English
Language : 

CC78K0S Datasheet, PDF (165/520 Pages) NEC – C Compiler Ver.1.30 or Later Language
CHAPTER 10 LIBRARY FUNCTIONS
Table 10-2. List of Passing Arguments (Static Model)
Type of Argument
1st Argument
2nd Argument
3rd Argument
1-byte integer
A
B
H
2-byte integer
AX
BC
HL
Remark
If the arguments are a total of 4 bytes, some of the arguments are allocated to AX and BC, and the rest to
HL or H.
1- to 4-byte integers do not include structures and unions.
10.1.2 Return values
The return value of a function is stored in units of 16 bits starting from its LSB in the direction from register BC to
register DE. When returning a structure, the first address of the structure is stored in register BC. When returning a
pointer, the first address of the structure is stored in register BC.
The following shows a list of the storing of the return value. The method of storing return values is the same as
that of normal function.
Table 10-3. List of Storing Return Value
(1) Normal model
Type of Return Value
1 bit
1-byte, 2-byte integers
4-byte integer
Floating-point number (float type)
Floating-point number (double type)
Structure
Pointer
Method of Storing
CY
BC
BC (lower), DE (higher)
BC (lower), DE (higher)
BC (lower), DE (higher)
Copies the structure to return to the area specific to the
function and stores the address to BC
BC
(2) Static model
1 bit
1-byte integer
2-byte integer
4-byte integer
Pointer
Type of Return Value
Method of Storing
CY
A
AX
AX (lower), BC (higher)
AX
10.1.3 Saving registers to be used by individual libraries
Libraries that use HL (normal model) and DE (static model) save the registers used to a stack.
Libraries that use saddr area save the saddr area used to a stack. A stack area is used as a work area for each
library.
User’s Manual U14872EJ1V0UM
165