OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-stable/] [binutils-2.20.1/] [gas/] [doc/] [c-h8300.texi] - Blame information for rev 859

Go to most recent revision | Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.