English
Language : 

CC78K0S Datasheet, PDF (452/520 Pages) NEC – C Compiler Ver.1.30 or Later Language
CHAPTER 11 EXTENDED FUNCTIONS
(C source 2)
void func1 (int, register int) ;
void main ()
{
func1 (0x1234, 0x5678) ;
}
void func1 (int p1, register int p2)
{
register int r ;
int a ;
r = p2 ;
a = p1 ;
}
(Output code)
_main:
; line 4: func1 (0x1234, 0x5678) ;
movw
push
movw
call
pop
ax, #05678H
ax
ax, #01234H
!_func1
ax
; 22136
; 4660
; Receives/passes an argument via a stack
; Passes the 1st argument to a register
; Function call
; Receives/passes an argument via a stack
; line 5: }
ret
; line 6: void func1 (int p1, register int p2)
; line 7: {
_func1:
push hl
push ax
; Loads 1st argument p1 on the stack
movw
push
ax, _@KREG12
ax
; Saves the saddr area for register arguments
movw
push
push
ax, _@KREG14
ax
ax
; Saves the saddr area for register arguments
; Reserves the area for automatic variable a
movw
movw
mov
ax, sp
hl, ax
a, [hl + 12]
xch
a, x
mov
a, [hl + 13]
movw _@KREG12, ax
; line 8: register int r ;
; line 9: int a ;
; Passes argument p2 from the stack to the saddr
area
; Allocates the register argument to _@KREG12
452
User’s Manual U14872EJ1V0UM