English
Language : 

CC78K0S Datasheet, PDF (467/520 Pages) NEC – C Compiler Ver.1.30 or Later Language
CHAPTER 11 EXTENDED FUNCTIONS
EXAMPLE 2
(C source)
_ _pascal noauto void func2 (int, int) ;
void main ()
{
func2 (0x1234, 0x5678) ;
}
_ _pascal noauto void func2 (int p1, int p2)
{
.
.
.
}
(Output code)
When -QR option is specified
_main:
; line
; line
; line
; line
_func2:
4 : func2 (0x1234, 0x5678) ;
movw ax, #05678H ; 22136
push ax
; Argument passed via a stack
movw ax, #01234H ; 4660 ; The first argument that is passed via a register
call !_func2
; Function call
; The stack is not corrected here
5 :}
ret
6 : _ _pascal noauto void func2 (int p1, int p2)
7 :{
push hl
xch a, x
; Saves the register for arguments
xch
xch
xch
push
movw
movw
mov
a,_@KREG12
a, x
a,_@KREG13
ax
ax, sp
hl, ax
a, [hl + 6]
xch a, x
; Allocates argument p1 to _@KREG12 (lower)
; Allocates argument p1 to _@KREG13 (higher)
; Saves the saddr area for arguments
; Argument p2 (lower) passed via a stack
; and received by a register
User’s Manual U14872EJ1V0UM
467