English
Language : 

CC78K0S Datasheet, PDF (482/520 Pages) NEC – C Compiler Ver.1.30 or Later Language
CHAPTER 12 REFERENCING THE ASSEMBLER
12.5 Referencing Variables Defined in Other Languages
(1) Referencing variables defined in the C language
If external variables defined in a C language program are referenced in an assembly language routine, the
extern declaration is used. Underscores ‘_’ are added to the beginning of the variables defined in the assembly
language routine.
C language program example
extern void subf();
char c = 0;
int i = 0;
void main()
{
subf();
}
The following occurs in the RA78K0S assembler.
$PROCESSOR (9024)
PUBLIC _subf
EXTRN _c
EXTRN _i
@@CODE CSEG
_subf:
MOV a, #04H
MOV !_c, a
MOVW ax, #07H
;7
MOVW de, #_i
INCW DE
MOV [DE], A
DECW DE
XCH A, X
MOV [DE], A
RET
END
482
User’s Manual U14872EJ1V0UM