Merge branch 'vendor/LDNS'
[dragonfly.git] / contrib / binutils-2.22 / gas / doc / c-m32c.texi
1 @c Copyright 2005, 2008
2 @c Free Software Foundation, Inc.
3 @c This is part of the GAS manual.
4 @c For copying conditions, see the file as.texinfo.
5 @ifset GENERIC
6 @page
7 @node M32C-Dependent
8 @chapter M32C Dependent Features
9 @end ifset
10 @ifclear GENERIC
11 @node Machine Dependencies
12 @chapter M32C Dependent Features
13 @end ifclear
14  
15 @cindex M32C support
16
17 @code{@value{AS}} can assemble code for several different members of
18 the Renesas M32C family.  Normally the default is to assemble code for
19 the M16C microprocessor.  The @code{-m32c} option may be used to
20 change the default to the M32C microprocessor.
21
22 @menu
23 * M32C-Opts::                   M32C Options
24 * M32C-Syntax::                 M32C Syntax
25 @end menu
26  
27 @node M32C-Opts
28 @section M32C Options
29  
30 @cindex options, M32C
31 @cindex M32C options
32  
33 The Renesas M32C version of @code{@value{AS}} has these
34 machine-dependent options:
35  
36 @table @code
37 @item -m32c
38 @cindex @samp{-m32c} option, M32C
39 @cindex architecture options, M32C
40 @cindex M32C architecture option
41 Assemble M32C instructions.
42  
43 @item -m16c
44 @cindex @samp{-m16c} option, M16C
45 @cindex architecture options, M16C
46 @cindex M16C architecture option
47 Assemble M16C instructions (default).
48
49 @item -relax
50 Enable support for link-time relaxations.
51
52 @item -h-tick-hex
53 Support H'00 style hex constants in addition to 0x00 style.
54
55  
56 @end table
57
58 @node M32C-Syntax
59 @section M32C Syntax
60 @menu
61 * M32C-Modifiers::              Symbolic Operand Modifiers
62 * M32C-Chars::                  Special Characters
63 @end menu
64
65 @node M32C-Modifiers
66 @subsection Symbolic Operand Modifiers
67
68 @cindex M32C modifiers
69 @cindex modifiers, M32C
70
71 The assembler supports several modifiers when using symbol addresses
72 in M32C instruction operands.  The general syntax is the following:
73
74 @smallexample
75 %modifier(symbol)
76 @end smallexample
77
78 @table @code
79 @cindex symbol modifiers
80
81 @item %dsp8
82 @itemx %dsp16
83
84 These modifiers override the assembler's assumptions about how big a
85 symbol's address is.  Normally, when it sees an operand like
86 @samp{sym[a0]} it assumes @samp{sym} may require the widest
87 displacement field (16 bits for @samp{-m16c}, 24 bits for
88 @samp{-m32c}).  These modifiers tell it to assume the address will fit
89 in an 8 or 16 bit (respectively) unsigned displacement.  Note that, of
90 course, if it doesn't actually fit you will get linker errors.  Example:
91
92 @smallexample
93 mov.w %dsp8(sym)[a0],r1
94 mov.b #0,%dsp8(sym)[a0]
95 @end smallexample
96
97 @item %hi8
98
99 This modifier allows you to load bits 16 through 23 of a 24 bit
100 address into an 8 bit register.  This is useful with, for example, the
101 M16C @samp{smovf} instruction, which expects a 20 bit address in
102 @samp{r1h} and @samp{a0}.  Example:
103
104 @smallexample
105 mov.b #%hi8(sym),r1h
106 mov.w #%lo16(sym),a0
107 smovf.b
108 @end smallexample
109
110 @item %lo16
111
112 Likewise, this modifier allows you to load bits 0 through 15 of a 24
113 bit address into a 16 bit register.
114
115 @item %hi16
116
117 This modifier allows you to load bits 16 through 31 of a 32 bit
118 address into a 16 bit register.  While the M32C family only has 24
119 bits of address space, it does support addresses in pairs of 16 bit
120 registers (like @samp{a1a0} for the @samp{lde} instruction).  This
121 modifier is for loading the upper half in such cases.  Example:
122
123 @smallexample
124 mov.w #%hi16(sym),a1
125 mov.w #%lo16(sym),a0
126 @dots{}
127 lde.w [a1a0],r1
128 @end smallexample
129
130 @end table
131
132 @node M32C-Chars
133 @subsection Special Characters
134
135 @cindex line comment character, M32C
136 @cindex M32C line comment character
137 The presence of a @samp{;} character on a line indicates the start of
138 a comment that extends to the end of that line.
139
140 If a @samp{#} appears as the first character of a line, the whole line
141 is treated as a comment, but in this case the line can also be a
142 logical line number directive (@pxref{Comments}) or a
143 preprocessor control command (@pxref{Preprocessing}).
144
145 @cindex line separator, M32C
146 @cindex statement separator, M32C
147 @cindex M32C line separator
148 The @samp{|} character can be used to separate statements on the same
149 line.