xref: /dflybsd-src/contrib/binutils-2.27/gas/doc/c-rl78.texi (revision e656dc90e3d65d744d534af2f5ea88cf8101ebcf)
1*a9fa9459Szrj@c Copyright (C) 2011-2016 Free Software Foundation, Inc.
2*a9fa9459Szrj@c This is part of the GAS manual.
3*a9fa9459Szrj@c For copying conditions, see the file as.texinfo.
4*a9fa9459Szrj@ifset GENERIC
5*a9fa9459Szrj@page
6*a9fa9459Szrj@node RL78-Dependent
7*a9fa9459Szrj@chapter RL78 Dependent Features
8*a9fa9459Szrj@end ifset
9*a9fa9459Szrj@ifclear GENERIC
10*a9fa9459Szrj@node Machine Dependencies
11*a9fa9459Szrj@chapter RL78 Dependent Features
12*a9fa9459Szrj@end ifclear
13*a9fa9459Szrj
14*a9fa9459Szrj@cindex RL78 support
15*a9fa9459Szrj@menu
16*a9fa9459Szrj* RL78-Opts::                   RL78 Assembler Command Line Options
17*a9fa9459Szrj* RL78-Modifiers::              Symbolic Operand Modifiers
18*a9fa9459Szrj* RL78-Directives::             Assembler Directives
19*a9fa9459Szrj* RL78-Syntax::                 Syntax
20*a9fa9459Szrj@end menu
21*a9fa9459Szrj
22*a9fa9459Szrj@node RL78-Opts
23*a9fa9459Szrj@section RL78 Options
24*a9fa9459Szrj@cindex options, RL78
25*a9fa9459Szrj@cindex RL78 options
26*a9fa9459Szrj
27*a9fa9459Szrj@table @code
28*a9fa9459Szrj@item relax
29*a9fa9459SzrjEnable support for link-time relaxation.
30*a9fa9459Szrj
31*a9fa9459Szrj@item norelax
32*a9fa9459SzrjDisable support for link-time relaxation (default).
33*a9fa9459Szrj
34*a9fa9459Szrj@item mg10
35*a9fa9459SzrjMark the generated binary as targeting the G10 variant of the RL78
36*a9fa9459Szrjarchitecture.
37*a9fa9459Szrj
38*a9fa9459Szrj@item mg13
39*a9fa9459SzrjMark the generated binary as targeting the G13 variant of the RL78
40*a9fa9459Szrjarchitecture.
41*a9fa9459Szrj
42*a9fa9459Szrj@item mg14
43*a9fa9459Szrj@itemx mrl78
44*a9fa9459SzrjMark the generated binary as targeting the G14 variant of the RL78
45*a9fa9459Szrjarchitecture.  This is the default.
46*a9fa9459Szrj
47*a9fa9459Szrj@item m32bit-doubles
48*a9fa9459SzrjMark the generated binary as one that uses 32-bits to hold the
49*a9fa9459Szrj@code{double} floating point type.  This is the default.
50*a9fa9459Szrj
51*a9fa9459Szrj@item m64bit-doubles
52*a9fa9459SzrjMark the generated binary as one that uses 64-bits to hold the
53*a9fa9459Szrj@code{double} floating point type.
54*a9fa9459Szrj
55*a9fa9459Szrj@end table
56*a9fa9459Szrj
57*a9fa9459Szrj@node RL78-Modifiers
58*a9fa9459Szrj@section Symbolic Operand Modifiers
59*a9fa9459Szrj
60*a9fa9459Szrj@cindex RL78 modifiers
61*a9fa9459Szrj@cindex syntax, RL78
62*a9fa9459Szrj
63*a9fa9459SzrjThe RL78 has three modifiers that adjust the relocations used by the
64*a9fa9459Szrjlinker:
65*a9fa9459Szrj
66*a9fa9459Szrj@table @code
67*a9fa9459Szrj
68*a9fa9459Szrj@item %lo16()
69*a9fa9459Szrj
70*a9fa9459SzrjWhen loading a 20-bit (or wider) address into registers, this modifier
71*a9fa9459Szrjselects the 16 least significant bits.
72*a9fa9459Szrj
73*a9fa9459Szrj@smallexample
74*a9fa9459Szrj  movw ax,#%lo16(_sym)
75*a9fa9459Szrj@end smallexample
76*a9fa9459Szrj
77*a9fa9459Szrj@item %hi16()
78*a9fa9459Szrj
79*a9fa9459SzrjWhen loading a 20-bit (or wider) address into registers, this modifier
80*a9fa9459Szrjselects the 16 most significant bits.
81*a9fa9459Szrj
82*a9fa9459Szrj@smallexample
83*a9fa9459Szrj  movw ax,#%hi16(_sym)
84*a9fa9459Szrj@end smallexample
85*a9fa9459Szrj
86*a9fa9459Szrj@item %hi8()
87*a9fa9459Szrj
88*a9fa9459SzrjWhen loading a 20-bit (or wider) address into registers, this modifier
89*a9fa9459Szrjselects the 8 bits that would go into CS or ES (i.e. bits 23..16).
90*a9fa9459Szrj
91*a9fa9459Szrj@smallexample
92*a9fa9459Szrj  mov es, #%hi8(_sym)
93*a9fa9459Szrj@end smallexample
94*a9fa9459Szrj
95*a9fa9459Szrj@end table
96*a9fa9459Szrj
97*a9fa9459Szrj@node RL78-Directives
98*a9fa9459Szrj@section Assembler Directives
99*a9fa9459Szrj
100*a9fa9459Szrj@cindex assembler directives, RL78
101*a9fa9459Szrj@cindex RL78 assembler directives
102*a9fa9459Szrj
103*a9fa9459SzrjIn addition to the common directives, the RL78 adds these:
104*a9fa9459Szrj
105*a9fa9459Szrj@table @code
106*a9fa9459Szrj
107*a9fa9459Szrj@item .double
108*a9fa9459SzrjOutput a constant in ``double'' format, which is either a 32-bit
109*a9fa9459Szrjor a 64-bit floating point value, depending upon the setting of the
110*a9fa9459Szrj@option{-m32bit-doubles}|@option{-m64bit-doubles} command line
111*a9fa9459Szrjoption.
112*a9fa9459Szrj
113*a9fa9459Szrj@item .bss
114*a9fa9459SzrjSelect the BSS section.
115*a9fa9459Szrj
116*a9fa9459Szrj@item .3byte
117*a9fa9459SzrjOutput a constant value in a three byte format.
118*a9fa9459Szrj
119*a9fa9459Szrj@item .int
120*a9fa9459Szrj@itemx .word
121*a9fa9459SzrjOutput a constant value in a four byte format.
122*a9fa9459Szrj
123*a9fa9459Szrj@end table
124*a9fa9459Szrj
125*a9fa9459Szrj@node RL78-Syntax
126*a9fa9459Szrj@section Syntax for the RL78
127*a9fa9459Szrj@menu
128*a9fa9459Szrj* RL78-Chars::                Special Characters
129*a9fa9459Szrj@end menu
130*a9fa9459Szrj
131*a9fa9459Szrj@node RL78-Chars
132*a9fa9459Szrj@subsection Special Characters
133*a9fa9459Szrj
134*a9fa9459Szrj@cindex line comment character, RL78
135*a9fa9459Szrj@cindex RL78 line comment character
136*a9fa9459SzrjThe presence of a @samp{;} appearing anywhere on a line indicates the
137*a9fa9459Szrjstart of a comment that extends to the end of that line.
138*a9fa9459Szrj
139*a9fa9459SzrjIf a @samp{#} appears as the first character of a line then the whole
140*a9fa9459Szrjline is treated as a comment, but in this case the line can also be a
141*a9fa9459Szrjlogical line number directive (@pxref{Comments}) or a preprocessor
142*a9fa9459Szrjcontrol command (@pxref{Preprocessing}).
143*a9fa9459Szrj
144*a9fa9459Szrj@cindex line separator, RL78
145*a9fa9459Szrj@cindex statement separator, RL78
146*a9fa9459Szrj@cindex RL78 line separator
147*a9fa9459SzrjThe @samp{|} character can be used to separate statements on the same
148*a9fa9459Szrjline.
149