English
Language : 

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