]>
Commit | Line | Data |
---|---|---|
252b5132 RH |
1 | @c Copyright (C) 1991, 92, 93, 94, 95, 1997 Free Software Foundation, Inc. |
2 | @c This is part of the GAS manual. | |
3 | @c For copying conditions, see the file as.texinfo. | |
4 | @page | |
5 | @node SH-Dependent | |
6 | @chapter Hitachi SH Dependent Features | |
7 | ||
8 | @cindex SH support | |
9 | @menu | |
10 | * SH Options:: Options | |
11 | * SH Syntax:: Syntax | |
12 | * SH Floating Point:: Floating Point | |
13 | * SH Directives:: SH Machine Directives | |
14 | * SH Opcodes:: Opcodes | |
15 | @end menu | |
16 | ||
17 | @node SH Options | |
18 | @section Options | |
19 | ||
20 | @cindex SH options (none) | |
21 | @cindex options, SH (none) | |
22 | @code{@value{AS}} has no additional command-line options for the Hitachi | |
23 | SH family. | |
24 | ||
25 | @node SH Syntax | |
26 | @section Syntax | |
27 | ||
28 | @menu | |
29 | * SH-Chars:: Special Characters | |
30 | * SH-Regs:: Register Names | |
31 | * SH-Addressing:: Addressing Modes | |
32 | @end menu | |
33 | ||
34 | @node SH-Chars | |
35 | @subsection Special Characters | |
36 | ||
37 | @cindex line comment character, SH | |
38 | @cindex SH line comment character | |
39 | @samp{!} is the line comment character. | |
40 | ||
41 | @cindex line separator, SH | |
42 | @cindex statement separator, SH | |
43 | @cindex SH line separator | |
44 | You can use @samp{;} instead of a newline to separate statements. | |
45 | ||
46 | @cindex symbol names, @samp{$} in | |
47 | @cindex @code{$} in symbol names | |
48 | Since @samp{$} has no special meaning, you may use it in symbol names. | |
49 | ||
50 | @node SH-Regs | |
51 | @subsection Register Names | |
52 | ||
53 | @cindex SH registers | |
54 | @cindex registers, SH | |
55 | You can use the predefined symbols @samp{r0}, @samp{r1}, @samp{r2}, | |
56 | @samp{r3}, @samp{r4}, @samp{r5}, @samp{r6}, @samp{r7}, @samp{r8}, | |
57 | @samp{r9}, @samp{r10}, @samp{r11}, @samp{r12}, @samp{r13}, @samp{r14}, | |
58 | and @samp{r15} to refer to the SH registers. | |
59 | ||
60 | The SH also has these control registers: | |
61 | ||
62 | @table @code | |
63 | @item pr | |
64 | procedure register (holds return address) | |
65 | ||
66 | @item pc | |
67 | program counter | |
68 | ||
69 | @item mach | |
70 | @itemx macl | |
71 | high and low multiply accumulator registers | |
72 | ||
73 | @item sr | |
74 | status register | |
75 | ||
76 | @item gbr | |
77 | global base register | |
78 | ||
79 | @item vbr | |
80 | vector base register (for interrupt vectors) | |
81 | @end table | |
82 | ||
83 | @node SH-Addressing | |
84 | @subsection Addressing Modes | |
85 | ||
86 | @cindex addressing modes, SH | |
87 | @cindex SH addressing modes | |
88 | @code{@value{AS}} understands the following addressing modes for the SH. | |
89 | @code{R@var{n}} in the following refers to any of the numbered | |
90 | registers, but @emph{not} the control registers. | |
91 | ||
92 | @table @code | |
93 | @item R@var{n} | |
94 | Register direct | |
95 | ||
96 | @item @@R@var{n} | |
97 | Register indirect | |
98 | ||
99 | @item @@-R@var{n} | |
100 | Register indirect with pre-decrement | |
101 | ||
102 | @item @@R@var{n}+ | |
103 | Register indirect with post-increment | |
104 | ||
105 | @item @@(@var{disp}, R@var{n}) | |
106 | Register indirect with displacement | |
107 | ||
108 | @item @@(R0, R@var{n}) | |
109 | Register indexed | |
110 | ||
111 | @item @@(@var{disp}, GBR) | |
112 | @code{GBR} offset | |
113 | ||
114 | @item @@(R0, GBR) | |
115 | GBR indexed | |
116 | ||
117 | @item @var{addr} | |
118 | @itemx @@(@var{disp}, PC) | |
119 | PC relative address (for branch or for addressing memory). The | |
120 | @code{@value{AS}} implementation allows you to use the simpler form | |
121 | @var{addr} anywhere a PC relative address is called for; the alternate | |
122 | form is supported for compatibility with other assemblers. | |
123 | ||
124 | @item #@var{imm} | |
125 | Immediate data | |
126 | @end table | |
127 | ||
128 | @node SH Floating Point | |
129 | @section Floating Point | |
130 | ||
131 | @cindex floating point, SH (@sc{ieee}) | |
132 | @cindex SH floating point (@sc{ieee}) | |
133 | The SH family has no hardware floating point, but the @code{.float} | |
134 | directive generates @sc{ieee} floating-point numbers for compatibility | |
135 | with other development tools. | |
136 | ||
137 | @node SH Directives | |
138 | @section SH Machine Directives | |
139 | ||
140 | @cindex SH machine directives | |
141 | @cindex machine directives, SH | |
142 | @cindex @code{uaword} directive, SH | |
143 | @cindex @code{ualong} directive, SH | |
144 | ||
145 | @table @code | |
146 | @item uaword | |
147 | @itemx ualong | |
148 | @code{@value{AS}} will issue a warning when a misaligned @code{.word} or | |
149 | @code{.long} directive is used. You may use @code{.uaword} or | |
150 | @code{.ualong} to indicate that the value is intentionally misaligned. | |
151 | @end table | |
152 | ||
153 | @node SH Opcodes | |
154 | @section Opcodes | |
155 | ||
156 | @cindex SH opcode summary | |
157 | @cindex opcode summary, SH | |
158 | @cindex mnemonics, SH | |
159 | @cindex instruction summary, SH | |
160 | For detailed information on the SH machine instruction set, see | |
161 | @cite{SH-Microcomputer User's Manual} (Hitachi Micro Systems, Inc.). | |
162 | ||
163 | @code{@value{AS}} implements all the standard SH opcodes. No additional | |
164 | pseudo-instructions are needed on this family. Note, however, that | |
165 | because @code{@value{AS}} supports a simpler form of PC-relative | |
166 | addressing, you may simply write (for example) | |
167 | ||
168 | @example | |
169 | mov.l bar,r0 | |
170 | @end example | |
171 | ||
172 | @noindent | |
173 | where other assemblers might require an explicit displacement to | |
174 | @code{bar} from the program counter: | |
175 | ||
176 | @example | |
177 | mov.l @@(@var{disp}, PC) | |
178 | @end example | |
179 | ||
180 | @ifset SMALL | |
181 | @c this table, due to the multi-col faking and hardcoded order, looks silly | |
182 | @c except in smallbook. See comments below "@set SMALL" near top of this file. | |
183 | ||
184 | Here is a summary of SH opcodes: | |
185 | ||
186 | @page | |
187 | @smallexample | |
188 | @i{Legend:} | |
189 | Rn @r{a numbered register} | |
190 | Rm @r{another numbered register} | |
191 | #imm @r{immediate data} | |
192 | disp @r{displacement} | |
193 | disp8 @r{8-bit displacement} | |
194 | disp12 @r{12-bit displacement} | |
195 | ||
196 | add #imm,Rn lds.l @@Rn+,PR | |
197 | add Rm,Rn mac.w @@Rm+,@@Rn+ | |
198 | addc Rm,Rn mov #imm,Rn | |
199 | addv Rm,Rn mov Rm,Rn | |
200 | and #imm,R0 mov.b Rm,@@(R0,Rn) | |
201 | and Rm,Rn mov.b Rm,@@-Rn | |
202 | and.b #imm,@@(R0,GBR) mov.b Rm,@@Rn | |
203 | bf disp8 mov.b @@(disp,Rm),R0 | |
204 | bra disp12 mov.b @@(disp,GBR),R0 | |
205 | bsr disp12 mov.b @@(R0,Rm),Rn | |
206 | bt disp8 mov.b @@Rm+,Rn | |
207 | clrmac mov.b @@Rm,Rn | |
208 | clrt mov.b R0,@@(disp,Rm) | |
209 | cmp/eq #imm,R0 mov.b R0,@@(disp,GBR) | |
210 | cmp/eq Rm,Rn mov.l Rm,@@(disp,Rn) | |
211 | cmp/ge Rm,Rn mov.l Rm,@@(R0,Rn) | |
212 | cmp/gt Rm,Rn mov.l Rm,@@-Rn | |
213 | cmp/hi Rm,Rn mov.l Rm,@@Rn | |
214 | cmp/hs Rm,Rn mov.l @@(disp,Rn),Rm | |
215 | cmp/pl Rn mov.l @@(disp,GBR),R0 | |
216 | cmp/pz Rn mov.l @@(disp,PC),Rn | |
217 | cmp/str Rm,Rn mov.l @@(R0,Rm),Rn | |
218 | div0s Rm,Rn mov.l @@Rm+,Rn | |
219 | div0u mov.l @@Rm,Rn | |
220 | div1 Rm,Rn mov.l R0,@@(disp,GBR) | |
221 | exts.b Rm,Rn mov.w Rm,@@(R0,Rn) | |
222 | exts.w Rm,Rn mov.w Rm,@@-Rn | |
223 | extu.b Rm,Rn mov.w Rm,@@Rn | |
224 | extu.w Rm,Rn mov.w @@(disp,Rm),R0 | |
225 | jmp @@Rn mov.w @@(disp,GBR),R0 | |
226 | jsr @@Rn mov.w @@(disp,PC),Rn | |
227 | ldc Rn,GBR mov.w @@(R0,Rm),Rn | |
228 | ldc Rn,SR mov.w @@Rm+,Rn | |
229 | ldc Rn,VBR mov.w @@Rm,Rn | |
230 | ldc.l @@Rn+,GBR mov.w R0,@@(disp,Rm) | |
231 | ldc.l @@Rn+,SR mov.w R0,@@(disp,GBR) | |
232 | ldc.l @@Rn+,VBR mova @@(disp,PC),R0 | |
233 | lds Rn,MACH movt Rn | |
234 | lds Rn,MACL muls Rm,Rn | |
235 | lds Rn,PR mulu Rm,Rn | |
236 | lds.l @@Rn+,MACH neg Rm,Rn | |
237 | lds.l @@Rn+,MACL negc Rm,Rn | |
238 | @page | |
239 | nop stc VBR,Rn | |
240 | not Rm,Rn stc.l GBR,@@-Rn | |
241 | or #imm,R0 stc.l SR,@@-Rn | |
242 | or Rm,Rn stc.l VBR,@@-Rn | |
243 | or.b #imm,@@(R0,GBR) sts MACH,Rn | |
244 | rotcl Rn sts MACL,Rn | |
245 | rotcr Rn sts PR,Rn | |
246 | rotl Rn sts.l MACH,@@-Rn | |
247 | rotr Rn sts.l MACL,@@-Rn | |
248 | rte sts.l PR,@@-Rn | |
249 | rts sub Rm,Rn | |
250 | sett subc Rm,Rn | |
251 | shal Rn subv Rm,Rn | |
252 | shar Rn swap.b Rm,Rn | |
253 | shll Rn swap.w Rm,Rn | |
254 | shll16 Rn tas.b @@Rn | |
255 | shll2 Rn trapa #imm | |
256 | shll8 Rn tst #imm,R0 | |
257 | shlr Rn tst Rm,Rn | |
258 | shlr16 Rn tst.b #imm,@@(R0,GBR) | |
259 | shlr2 Rn xor #imm,R0 | |
260 | shlr8 Rn xor Rm,Rn | |
261 | sleep xor.b #imm,@@(R0,GBR) | |
262 | stc GBR,Rn xtrct Rm,Rn | |
263 | stc SR,Rn | |
264 | @end smallexample | |
265 | @end ifset | |
266 | ||
267 | @ifset Hitachi-all | |
268 | @ifclear GENERIC | |
269 | @raisesections | |
270 | @end ifclear | |
271 | @end ifset | |
272 |