English
Language : 

CC78K0S Datasheet, PDF (314/520 Pages) NEC – C Compiler Ver.1.30 or Later Language
CHAPTER 11 EXTENDED FUNCTIONS
Register Variables
register
EXAMPLE
(C source)
void func ();
void main ()
{
register int i, j;
i = 0; j = 1;
i += j;
func ();
}
(Output object of compiler)
• When the -SM option is not specified (example of register variable allocation to register HL and the saddr
area)
The following labels are declared by the startup routine (refer to APPENDIX A LIST OF LABELS FOR saddr
AREA).
EXTRN
_main:
push
movw
push
_@KREG00
hl
ax, _@KREG14
ax
; References the saddr area to be used
; Saves the contents of the register at the beginning of the function
; Saves the contents of the saddr at the beginning of the function
;
movw
movw
incw
movw
xch
add
xch
addc
movw
call
hl, #00H
ax, hl
ax
_@KREG14,ax
a, x
a, l
a, x
a, l
hl, ax
!_func
; The following codes are output in the middle of the function
;
;
;
;
;
;
;
;
;
pop
movw
pop
ret
ax
_@KREG00, ax
hl
; Restores contents of the saddr at the end of the function
;
; Restores contents of the register at the end of the function
314
User’s Manual U14872EJ1V0UM