English
Language : 

CC78K0S Datasheet, PDF (481/520 Pages) NEC – C Compiler Ver.1.30 or Later Language
CHAPTER 12 REFERENCING THE ASSEMBLER
(2) Saving the work registers (AX, BC, and DE)
The three register pairs of AX, BC, and DE are used in the C language. Their values are not restored when
returning. Therefore, if the values in registers are needed, they are saved on the calling side.
Save or restore the registers before or after an argument pass code. The HL register is always saved on the
side of the C language when it is used in the C language.
(3) Calling a C language function
A CALL instruction calls a C language function. If the C language function is a callt function, the callt
instruction performs the call.
(4) Restoring the stack pointer (SP)
The stack pointer is restored by the number of bytes holding the arguments.
(5) Referencing the return value (BC and DE)
The return value from the C language is returned as follows.
BC register
Return value of 16 or fewer bits:
Word
DE register
Return value of 17 or more bits: Higher word
BC register
Lower word
(2) Referencing arguments in a C language function
To correctly pass the i and j arguments to the C language program shown below, they are placed on the stack as
shown in Figure 12-4.
void CSUB (i, j)
int
i, j ;
{
i += j;
}
Figure 12-4. Passing Arguments to C Language
low address
CSUB (i, j)
Stack pointer
Return address to the calling side
AX register
i
j
high address
Stack area
User’s Manual U14872EJ1V0UM
481