English
Language : 

CC78K4 Datasheet, PDF (473/523 Pages) NEC – CC78K4 Ver.2.30 or Later, C Compiler Language
CHAPTER 12 REFERENCING THE ASSEMBLER
The following example shows the function call.
(C source: Large model with -QRF)
void func0(register int, int);
void main()
{
func0(0x1234, 0x5678);
}
void func0(register int p1, int p2)
{
register int r;
int a;
r = p2;
a = p1;
}
(Output assembler source)
PUBLIC _func0
PUBLIC _main
@@CODE CSEG
_main:
movw
push
movw
call
pop
ret
_func0:
push
push
movw
push
movw
movw
movw
movw
pop
pop
pop
ret
END
ax,#05678H
ax
ax,#01234H
$!_func0
ax
uup
rp3
rp3,ax
ax
ax,[sp+10]
up,ax
ax,rp3
[sp+0],ax
ax
rp3
uup
; 22136
; 4660
; Argument is passed via a stack
; The first argument is passed via a register
; Function call
; Argument is passed via a stack
; p2
;a
; Saves the register for arguments
; Allocates register arguments p1 to rp3.
; Argument p2 passed via a stack is allocated to up
; Register argument p1 is assigned
; to automatic variable a
; Restores the register for arguments
User’s Manual U15556EJ1V0UM
473