* config/sh/tm-sh.h (BELIEVE_PCC_PROMOTION): Define, so that
[deliverable/binutils-gdb.git] / gas / doc / c-h8300.texi
1 @c Copyright (C) 1991, 1992, 1993, 1994, 1995 Free Software Foundation, Inc.
2 @c This is part of the GAS manual.
3 @c For copying conditions, see the file as.texinfo.
4 @ifset GENERIC
5 @page
6 @end ifset
7 @node H8/300-Dependent
8 @chapter H8/300 Dependent Features
9
10 @cindex H8/300 support
11 @menu
12 * H8/300 Options:: Options
13 * H8/300 Syntax:: Syntax
14 * H8/300 Floating Point:: Floating Point
15 * H8/300 Directives:: H8/300 Machine Directives
16 * H8/300 Opcodes:: Opcodes
17 @end menu
18
19 @node H8/300 Options
20 @section Options
21
22 @cindex H8/300 options (none)
23 @cindex options, H8/300 (none)
24 @code{@value{AS}} has no additional command-line options for the Hitachi
25 H8/300 family.
26
27 @node H8/300 Syntax
28 @section Syntax
29 @menu
30 * H8/300-Chars:: Special Characters
31 * H8/300-Regs:: Register Names
32 * H8/300-Addressing:: Addressing Modes
33 @end menu
34
35 @node H8/300-Chars
36 @subsection Special Characters
37
38 @cindex line comment character, H8/300
39 @cindex H8/300 line comment character
40 @samp{;} is the line comment character.
41
42 @cindex line separator, H8/300
43 @cindex statement separator, H8/300
44 @cindex H8/300 line separator
45 @samp{$} can be used instead of a newline to separate statements.
46 Therefore @emph{you may not use @samp{$} in symbol names} on the H8/300.
47
48 @node H8/300-Regs
49 @subsection Register Names
50
51 @cindex H8/300 registers
52 @cindex register names, H8/300
53 You can use predefined symbols of the form @samp{r@var{n}h} and
54 @samp{r@var{n}l} to refer to the H8/300 registers as sixteen 8-bit
55 general-purpose registers. @var{n} is a digit from @samp{0} to
56 @samp{7}); for instance, both @samp{r0h} and @samp{r7l} are valid
57 register names.
58
59 You can also use the eight predefined symbols @samp{r@var{n}} to refer
60 to the H8/300 registers as 16-bit registers (you must use this form for
61 addressing).
62
63 On the H8/300H, you can also use the eight predefined symbols
64 @samp{er@var{n}} (@samp{er0} @dots{} @samp{er7}) to refer to the 32-bit
65 general purpose registers.
66
67 The two control registers are called @code{pc} (program counter; a
68 16-bit register, except on the H8/300H where it is 24 bits) and
69 @code{ccr} (condition code register; an 8-bit register). @code{r7} is
70 used as the stack pointer, and can also be called @code{sp}.
71
72 @node H8/300-Addressing
73 @subsection Addressing Modes
74
75 @cindex addressing modes, H8/300
76 @cindex H8/300 addressing modes
77 @value{AS} understands the following addressing modes for the H8/300:
78 @table @code
79 @item r@var{n}
80 Register direct
81
82 @item @@r@var{n}
83 Register indirect
84
85 @item @@(@var{d}, r@var{n})
86 @itemx @@(@var{d}:16, r@var{n})
87 @itemx @@(@var{d}:24, r@var{n})
88 Register indirect: 16-bit or 24-bit displacement @var{d} from register
89 @var{n}. (24-bit displacements are only meaningful on the H8/300H.)
90
91 @item @@r@var{n}+
92 Register indirect with post-increment
93
94 @item @@-r@var{n}
95 Register indirect with pre-decrement
96
97 @item @code{@@}@var{aa}
98 @itemx @code{@@}@var{aa}:8
99 @itemx @code{@@}@var{aa}:16
100 @itemx @code{@@}@var{aa}:24
101 Absolute address @code{aa}. (The address size @samp{:24} only makes
102 sense on the H8/300H.)
103
104 @item #@var{xx}
105 @itemx #@var{xx}:8
106 @itemx #@var{xx}:16
107 @itemx #@var{xx}:32
108 Immediate data @var{xx}. You may specify the @samp{:8}, @samp{:16}, or
109 @samp{:32} for clarity, if you wish; but @code{@value{AS}} neither
110 requires this nor uses it---the data size required is taken from
111 context.
112
113 @item @code{@@}@code{@@}@var{aa}
114 @itemx @code{@@}@code{@@}@var{aa}:8
115 Memory indirect. You may specify the @samp{:8} for clarity, if you
116 wish; but @code{@value{AS}} neither requires this nor uses it.
117 @end table
118
119 @node H8/300 Floating Point
120 @section Floating Point
121
122 @cindex floating point, H8/300 (@sc{ieee})
123 @cindex H8/300 floating point (@sc{ieee})
124 The H8/300 family has no hardware floating point, but the @code{.float}
125 directive generates @sc{ieee} floating-point numbers for compatibility
126 with other development tools.
127
128 @page
129 @node H8/300 Directives
130 @section H8/300 Machine Directives
131
132 @cindex H8/300 machine directives (none)
133 @cindex machine directives, H8/300 (none)
134 @cindex @code{word} directive, H8/300
135 @cindex @code{int} directive, H8/300
136 @code{@value{AS}} has only one machine-dependent directive for the
137 H8/300:
138
139 @table @code
140 @cindex H8/300H, assembling for
141 @item .h8300h
142 Recognize and emit additional instructions for the H8/300H variant, and
143 also make @code{.int} emit 32-bit numbers rather than the usual (16-bit)
144 for the H8/300 family.
145 @end table
146
147 On the H8/300 family (including the H8/300H) @samp{.word} directives
148 generate 16-bit numbers.
149
150 @node H8/300 Opcodes
151 @section Opcodes
152
153 @cindex H8/300 opcode summary
154 @cindex opcode summary, H8/300
155 @cindex mnemonics, H8/300
156 @cindex instruction summary, H8/300
157 For detailed information on the H8/300 machine instruction set, see
158 @cite{H8/300 Series Programming Manual} (Hitachi ADE--602--025). For
159 information specific to the H8/300H, see @cite{H8/300H Series
160 Programming Manual} (Hitachi).
161
162 @code{@value{AS}} implements all the standard H8/300 opcodes. No additional
163 pseudo-instructions are needed on this family.
164
165 @ifset SMALL
166 @c this table, due to the multi-col faking and hardcoded order, looks silly
167 @c except in smallbook. See comments below "@set SMALL" near top of this file.
168
169 The following table summarizes the H8/300 opcodes, and their arguments.
170 Entries marked @samp{*} are opcodes used only on the H8/300H.
171
172 @smallexample
173 @c Using @group seems to use the normal baselineskip, not the smallexample
174 @c baselineskip; looks approx doublespaced.
175 @i{Legend:}
176 Rs @r{source register}
177 Rd @r{destination register}
178 abs @r{absolute address}
179 imm @r{immediate data}
180 disp:N @r{N-bit displacement from a register}
181 pcrel:N @r{N-bit displacement relative to program counter}
182
183 add.b #imm,rd * andc #imm,ccr
184 add.b rs,rd band #imm,rd
185 add.w rs,rd band #imm,@@rd
186 * add.w #imm,rd band #imm,@@abs:8
187 * add.l rs,rd bra pcrel:8
188 * add.l #imm,rd * bra pcrel:16
189 adds #imm,rd bt pcrel:8
190 addx #imm,rd * bt pcrel:16
191 addx rs,rd brn pcrel:8
192 and.b #imm,rd * brn pcrel:16
193 and.b rs,rd bf pcrel:8
194 * and.w rs,rd * bf pcrel:16
195 * and.w #imm,rd bhi pcrel:8
196 * and.l #imm,rd * bhi pcrel:16
197 * and.l rs,rd bls pcrel:8
198 @page
199 * bls pcrel:16 bld #imm,rd
200 bcc pcrel:8 bld #imm,@@rd
201 * bcc pcrel:16 bld #imm,@@abs:8
202 bhs pcrel:8 bnot #imm,rd
203 * bhs pcrel:16 bnot #imm,@@rd
204 bcs pcrel:8 bnot #imm,@@abs:8
205 * bcs pcrel:16 bnot rs,rd
206 blo pcrel:8 bnot rs,@@rd
207 * blo pcrel:16 bnot rs,@@abs:8
208 bne pcrel:8 bor #imm,rd
209 * bne pcrel:16 bor #imm,@@rd
210 beq pcrel:8 bor #imm,@@abs:8
211 * beq pcrel:16 bset #imm,rd
212 bvc pcrel:8 bset #imm,@@rd
213 * bvc pcrel:16 bset #imm,@@abs:8
214 bvs pcrel:8 bset rs,rd
215 * bvs pcrel:16 bset rs,@@rd
216 bpl pcrel:8 bset rs,@@abs:8
217 * bpl pcrel:16 bsr pcrel:8
218 bmi pcrel:8 bsr pcrel:16
219 * bmi pcrel:16 bst #imm,rd
220 bge pcrel:8 bst #imm,@@rd
221 * bge pcrel:16 bst #imm,@@abs:8
222 blt pcrel:8 btst #imm,rd
223 * blt pcrel:16 btst #imm,@@rd
224 bgt pcrel:8 btst #imm,@@abs:8
225 * bgt pcrel:16 btst rs,rd
226 ble pcrel:8 btst rs,@@rd
227 * ble pcrel:16 btst rs,@@abs:8
228 bclr #imm,rd bxor #imm,rd
229 bclr #imm,@@rd bxor #imm,@@rd
230 bclr #imm,@@abs:8 bxor #imm,@@abs:8
231 bclr rs,rd cmp.b #imm,rd
232 bclr rs,@@rd cmp.b rs,rd
233 bclr rs,@@abs:8 cmp.w rs,rd
234 biand #imm,rd cmp.w rs,rd
235 biand #imm,@@rd * cmp.w #imm,rd
236 biand #imm,@@abs:8 * cmp.l #imm,rd
237 bild #imm,rd * cmp.l rs,rd
238 bild #imm,@@rd daa rs
239 bild #imm,@@abs:8 das rs
240 bior #imm,rd dec.b rs
241 bior #imm,@@rd * dec.w #imm,rd
242 bior #imm,@@abs:8 * dec.l #imm,rd
243 bist #imm,rd divxu.b rs,rd
244 bist #imm,@@rd * divxu.w rs,rd
245 bist #imm,@@abs:8 * divxs.b rs,rd
246 bixor #imm,rd * divxs.w rs,rd
247 bixor #imm,@@rd eepmov
248 bixor #imm,@@abs:8 * eepmovw
249 @page
250 * exts.w rd mov.w rs,@@abs:16
251 * exts.l rd * mov.l #imm,rd
252 * extu.w rd * mov.l rs,rd
253 * extu.l rd * mov.l @@rs,rd
254 inc rs * mov.l @@(disp:16,rs),rd
255 * inc.w #imm,rd * mov.l @@(disp:24,rs),rd
256 * inc.l #imm,rd * mov.l @@rs+,rd
257 jmp @@rs * mov.l @@abs:16,rd
258 jmp abs * mov.l @@abs:24,rd
259 jmp @@@@abs:8 * mov.l rs,@@rd
260 jsr @@rs * mov.l rs,@@(disp:16,rd)
261 jsr abs * mov.l rs,@@(disp:24,rd)
262 jsr @@@@abs:8 * mov.l rs,@@-rd
263 ldc #imm,ccr * mov.l rs,@@abs:16
264 ldc rs,ccr * mov.l rs,@@abs:24
265 * ldc @@abs:16,ccr movfpe @@abs:16,rd
266 * ldc @@abs:24,ccr movtpe rs,@@abs:16
267 * ldc @@(disp:16,rs),ccr mulxu.b rs,rd
268 * ldc @@(disp:24,rs),ccr * mulxu.w rs,rd
269 * ldc @@rs+,ccr * mulxs.b rs,rd
270 * ldc @@rs,ccr * mulxs.w rs,rd
271 * mov.b @@(disp:24,rs),rd neg.b rs
272 * mov.b rs,@@(disp:24,rd) * neg.w rs
273 mov.b @@abs:16,rd * neg.l rs
274 mov.b rs,rd nop
275 mov.b @@abs:8,rd not.b rs
276 mov.b rs,@@abs:8 * not.w rs
277 mov.b rs,rd * not.l rs
278 mov.b #imm,rd or.b #imm,rd
279 mov.b @@rs,rd or.b rs,rd
280 mov.b @@(disp:16,rs),rd * or.w #imm,rd
281 mov.b @@rs+,rd * or.w rs,rd
282 mov.b @@abs:8,rd * or.l #imm,rd
283 mov.b rs,@@rd * or.l rs,rd
284 mov.b rs,@@(disp:16,rd) orc #imm,ccr
285 mov.b rs,@@-rd pop.w rs
286 mov.b rs,@@abs:8 * pop.l rs
287 mov.w rs,@@rd push.w rs
288 * mov.w @@(disp:24,rs),rd * push.l rs
289 * mov.w rs,@@(disp:24,rd) rotl.b rs
290 * mov.w @@abs:24,rd * rotl.w rs
291 * mov.w rs,@@abs:24 * rotl.l rs
292 mov.w rs,rd rotr.b rs
293 mov.w #imm,rd * rotr.w rs
294 mov.w @@rs,rd * rotr.l rs
295 mov.w @@(disp:16,rs),rd rotxl.b rs
296 mov.w @@rs+,rd * rotxl.w rs
297 mov.w @@abs:16,rd * rotxl.l rs
298 mov.w rs,@@(disp:16,rd) rotxr.b rs
299 mov.w rs,@@-rd * rotxr.w rs
300 @page
301 * rotxr.l rs * stc ccr,@@(disp:24,rd)
302 bpt * stc ccr,@@-rd
303 rte * stc ccr,@@abs:16
304 rts * stc ccr,@@abs:24
305 shal.b rs sub.b rs,rd
306 * shal.w rs sub.w rs,rd
307 * shal.l rs * sub.w #imm,rd
308 shar.b rs * sub.l rs,rd
309 * shar.w rs * sub.l #imm,rd
310 * shar.l rs subs #imm,rd
311 shll.b rs subx #imm,rd
312 * shll.w rs subx rs,rd
313 * shll.l rs * trapa #imm
314 shlr.b rs xor #imm,rd
315 * shlr.w rs xor rs,rd
316 * shlr.l rs * xor.w #imm,rd
317 sleep * xor.w rs,rd
318 stc ccr,rd * xor.l #imm,rd
319 * stc ccr,@@rs * xor.l rs,rd
320 * stc ccr,@@(disp:16,rd) xorc #imm,ccr
321 @end smallexample
322 @end ifset
323
324 @cindex size suffixes, H8/300
325 @cindex H8/300 size suffixes
326 Four H8/300 instructions (@code{add}, @code{cmp}, @code{mov},
327 @code{sub}) are defined with variants using the suffixes @samp{.b},
328 @samp{.w}, and @samp{.l} to specify the size of a memory operand.
329 @code{@value{AS}} supports these suffixes, but does not require them;
330 since one of the operands is always a register, @code{@value{AS}} can
331 deduce the correct size.
332
333 For example, since @code{r0} refers to a 16-bit register,
334 @example
335 mov r0,@@foo
336 @exdent is equivalent to
337 mov.w r0,@@foo
338 @end example
339
340 If you use the size suffixes, @code{@value{AS}} issues a warning when
341 the suffix and the register size do not match.
This page took 0.037176 seconds and 4 git commands to generate.