This commit was generated by cvs2svn to track changes on a CVS vendor
[binutils-gdb.git] / gas / doc / c-vax.texi
1 @c Copyright (C) 1991, 92, 93, 94, 95, 96, 1998 Free Software Foundation, Inc.
2 @c This is part of the GAS manual.
3 @c For copying conditions, see the file as.texinfo.
4 @c VAX/VMS description exhanced and corrected by Klaus K"aempf, kkaempf@progis.de
5 @ifset GENERIC
6 @node Vax-Dependent
7 @chapter VAX Dependent Features
8 @cindex VAX support
9
10 @end ifset
11 @ifclear GENERIC
12 @node Machine Dependencies
13 @chapter VAX Dependent Features
14 @cindex VAX support
15
16 @end ifclear
17
18 @menu
19 * VAX-Opts:: VAX Command-Line Options
20 * VAX-float:: VAX Floating Point
21 * VAX-directives:: Vax Machine Directives
22 * VAX-opcodes:: VAX Opcodes
23 * VAX-branch:: VAX Branch Improvement
24 * VAX-operands:: VAX Operands
25 * VAX-no:: Not Supported on VAX
26 @end menu
27
28
29 @node VAX-Opts
30 @section VAX Command-Line Options
31
32 @cindex command-line options ignored, VAX
33 @cindex VAX command-line options ignored
34 The Vax version of @code{@value{AS}} accepts any of the following options,
35 gives a warning message that the option was ignored and proceeds.
36 These options are for compatibility with scripts designed for other
37 people's assemblers.
38
39 @table @code
40 @cindex @code{-D}, ignored on VAX
41 @cindex @code{-S}, ignored on VAX
42 @cindex @code{-T}, ignored on VAX
43 @item @code{-D} (Debug)
44 @itemx @code{-S} (Symbol Table)
45 @itemx @code{-T} (Token Trace)
46 These are obsolete options used to debug old assemblers.
47
48 @cindex @code{-d}, VAX option
49 @item @code{-d} (Displacement size for JUMPs)
50 This option expects a number following the @samp{-d}. Like options
51 that expect filenames, the number may immediately follow the
52 @samp{-d} (old standard) or constitute the whole of the command line
53 argument that follows @samp{-d} (@sc{gnu} standard).
54
55 @cindex @code{-V}, redundant on VAX
56 @item @code{-V} (Virtualize Interpass Temporary File)
57 Some other assemblers use a temporary file. This option
58 commanded them to keep the information in active memory rather
59 than in a disk file. @code{@value{AS}} always does this, so this
60 option is redundant.
61
62 @cindex @code{-J}, ignored on VAX
63 @item @code{-J} (JUMPify Longer Branches)
64 Many 32-bit computers permit a variety of branch instructions
65 to do the same job. Some of these instructions are short (and
66 fast) but have a limited range; others are long (and slow) but
67 can branch anywhere in virtual memory. Often there are 3
68 flavors of branch: short, medium and long. Some other
69 assemblers would emit short and medium branches, unless told by
70 this option to emit short and long branches.
71
72 @cindex @code{-t}, ignored on VAX
73 @item @code{-t} (Temporary File Directory)
74 Some other assemblers may use a temporary file, and this option
75 takes a filename being the directory to site the temporary
76 file. Since @code{@value{AS}} does not use a temporary disk file, this
77 option makes no difference. @samp{-t} needs exactly one
78 filename.
79 @end table
80
81 @cindex VMS (VAX) options
82 @cindex options for VAX/VMS
83 @cindex VAX/VMS options
84 @cindex Vax-11 C compatibility
85 @cindex symbols with uppercase, VAX/VMS
86 The Vax version of the assembler accepts additional options when
87 compiled for VMS:
88
89 @table @samp
90 @cindex @samp{-h} option, VAX/VMS
91 @item -h @var{n}
92 External symbol or section (used for global variables) names are not
93 case sensitive on VAX/VMS and always mapped to upper case. This is
94 contrary to the C language definition which explicitly distinguishes
95 upper and lower case. To implement a standard conforming C compiler,
96 names must be changed (mapped) to preserve the case information. The
97 default mapping is to convert all lower case characters to uppercase and
98 adding an underscore followed by a 6 digit hex value, representing a 24
99 digit binary value. The one digits in the binary value represent which
100 characters are uppercase in the original symbol name.
101
102 The @samp{-h @var{n}} option determines how we map names. This takes
103 several values. No @samp{-h} switch at all allows case hacking as
104 described above. A value of zero (@samp{-h0}) implies names should be
105 upper case, and inhibits the case hack. A value of 2 (@samp{-h2})
106 implies names should be all lower case, with no case hack. A value of 3
107 (@samp{-h3}) implies that case should be preserved. The value 1 is
108 unused. The @code{-H} option directs @code{@value{AS}} to display
109 every mapped symbol during assembly.
110
111 Symbols whose names include a dollar sign @samp{$} are exceptions to the
112 general name mapping. These symbols are normally only used to reference
113 VMS library names. Such symbols are always mapped to upper case.
114
115 @cindex @samp{-+} option, VAX/VMS
116 @item -+
117 The @samp{-+} option causes @code{@value{AS}} to truncate any symbol
118 name larger than 31 characters. The @samp{-+} option also prevents some
119 code following the @samp{_main} symbol normally added to make the object
120 file compatible with Vax-11 "C".
121
122 @cindex @samp{-1} option, VAX/VMS
123 @item -1
124 This option is ignored for backward compatibility with @code{@value{AS}}
125 version 1.x.
126
127 @cindex @samp{-H} option, VAX/VMS
128 @item -H
129 The @samp{-H} option causes @code{@value{AS}} to print every symbol
130 which was changed by case mapping.
131 @end table
132
133 @node VAX-float
134 @section VAX Floating Point
135
136 @cindex VAX floating point
137 @cindex floating point, VAX
138 Conversion of flonums to floating point is correct, and
139 compatible with previous assemblers. Rounding is
140 towards zero if the remainder is exactly half the least significant bit.
141
142 @code{D}, @code{F}, @code{G} and @code{H} floating point formats
143 are understood.
144
145 Immediate floating literals (@emph{e.g.} @samp{S`$6.9})
146 are rendered correctly. Again, rounding is towards zero in the
147 boundary case.
148
149 @cindex @code{float} directive, VAX
150 @cindex @code{double} directive, VAX
151 The @code{.float} directive produces @code{f} format numbers.
152 The @code{.double} directive produces @code{d} format numbers.
153
154 @node VAX-directives
155 @section Vax Machine Directives
156
157 @cindex machine directives, VAX
158 @cindex VAX machine directives
159 The Vax version of the assembler supports four directives for
160 generating Vax floating point constants. They are described in the
161 table below.
162
163 @cindex wide floating point directives, VAX
164 @table @code
165 @cindex @code{dfloat} directive, VAX
166 @item .dfloat
167 This expects zero or more flonums, separated by commas, and
168 assembles Vax @code{d} format 64-bit floating point constants.
169
170 @cindex @code{ffloat} directive, VAX
171 @item .ffloat
172 This expects zero or more flonums, separated by commas, and
173 assembles Vax @code{f} format 32-bit floating point constants.
174
175 @cindex @code{gfloat} directive, VAX
176 @item .gfloat
177 This expects zero or more flonums, separated by commas, and
178 assembles Vax @code{g} format 64-bit floating point constants.
179
180 @cindex @code{hfloat} directive, VAX
181 @item .hfloat
182 This expects zero or more flonums, separated by commas, and
183 assembles Vax @code{h} format 128-bit floating point constants.
184
185 @end table
186
187 @node VAX-opcodes
188 @section VAX Opcodes
189
190 @cindex VAX opcode mnemonics
191 @cindex opcode mnemonics, VAX
192 @cindex mnemonics for opcodes, VAX
193 All DEC mnemonics are supported. Beware that @code{case@dots{}}
194 instructions have exactly 3 operands. The dispatch table that
195 follows the @code{case@dots{}} instruction should be made with
196 @code{.word} statements. This is compatible with all unix
197 assemblers we know of.
198
199 @node VAX-branch
200 @section VAX Branch Improvement
201
202 @cindex VAX branch improvement
203 @cindex branch improvement, VAX
204 @cindex pseudo-ops for branch, VAX
205 Certain pseudo opcodes are permitted. They are for branch
206 instructions. They expand to the shortest branch instruction that
207 reaches the target. Generally these mnemonics are made by
208 substituting @samp{j} for @samp{b} at the start of a DEC mnemonic.
209 This feature is included both for compatibility and to help
210 compilers. If you do not need this feature, avoid these
211 opcodes. Here are the mnemonics, and the code they can expand into.
212
213 @table @code
214 @item jbsb
215 @samp{Jsb} is already an instruction mnemonic, so we chose @samp{jbsb}.
216 @table @asis
217 @item (byte displacement)
218 @kbd{bsbb @dots{}}
219 @item (word displacement)
220 @kbd{bsbw @dots{}}
221 @item (long displacement)
222 @kbd{jsb @dots{}}
223 @end table
224 @item jbr
225 @itemx jr
226 Unconditional branch.
227 @table @asis
228 @item (byte displacement)
229 @kbd{brb @dots{}}
230 @item (word displacement)
231 @kbd{brw @dots{}}
232 @item (long displacement)
233 @kbd{jmp @dots{}}
234 @end table
235 @item j@var{COND}
236 @var{COND} may be any one of the conditional branches
237 @code{neq}, @code{nequ}, @code{eql}, @code{eqlu}, @code{gtr},
238 @code{geq}, @code{lss}, @code{gtru}, @code{lequ}, @code{vc}, @code{vs},
239 @code{gequ}, @code{cc}, @code{lssu}, @code{cs}.
240 @var{COND} may also be one of the bit tests
241 @code{bs}, @code{bc}, @code{bss}, @code{bcs}, @code{bsc}, @code{bcc},
242 @code{bssi}, @code{bcci}, @code{lbs}, @code{lbc}.
243 @var{NOTCOND} is the opposite condition to @var{COND}.
244 @table @asis
245 @item (byte displacement)
246 @kbd{b@var{COND} @dots{}}
247 @item (word displacement)
248 @kbd{b@var{NOTCOND} foo ; brw @dots{} ; foo:}
249 @item (long displacement)
250 @kbd{b@var{NOTCOND} foo ; jmp @dots{} ; foo:}
251 @end table
252 @item jacb@var{X}
253 @var{X} may be one of @code{b d f g h l w}.
254 @table @asis
255 @item (word displacement)
256 @kbd{@var{OPCODE} @dots{}}
257 @item (long displacement)
258 @example
259 @var{OPCODE} @dots{}, foo ;
260 brb bar ;
261 foo: jmp @dots{} ;
262 bar:
263 @end example
264 @end table
265 @item jaob@var{YYY}
266 @var{YYY} may be one of @code{lss leq}.
267 @item jsob@var{ZZZ}
268 @var{ZZZ} may be one of @code{geq gtr}.
269 @table @asis
270 @item (byte displacement)
271 @kbd{@var{OPCODE} @dots{}}
272 @item (word displacement)
273 @example
274 @var{OPCODE} @dots{}, foo ;
275 brb bar ;
276 foo: brw @var{destination} ;
277 bar:
278 @end example
279 @item (long displacement)
280 @example
281 @var{OPCODE} @dots{}, foo ;
282 brb bar ;
283 foo: jmp @var{destination} ;
284 bar:
285 @end example
286 @end table
287 @item aobleq
288 @itemx aoblss
289 @itemx sobgeq
290 @itemx sobgtr
291 @table @asis
292 @item (byte displacement)
293 @kbd{@var{OPCODE} @dots{}}
294 @item (word displacement)
295 @example
296 @var{OPCODE} @dots{}, foo ;
297 brb bar ;
298 foo: brw @var{destination} ;
299 bar:
300 @end example
301 @item (long displacement)
302 @example
303 @var{OPCODE} @dots{}, foo ;
304 brb bar ;
305 foo: jmp @var{destination} ;
306 bar:
307 @end example
308 @end table
309 @end table
310
311 @node VAX-operands
312 @section VAX Operands
313
314 @cindex VAX operand notation
315 @cindex operand notation, VAX
316 @cindex immediate character, VAX
317 @cindex VAX immediate character
318 The immediate character is @samp{$} for Unix compatibility, not
319 @samp{#} as DEC writes it.
320
321 @cindex indirect character, VAX
322 @cindex VAX indirect character
323 The indirect character is @samp{*} for Unix compatibility, not
324 @samp{@@} as DEC writes it.
325
326 @cindex displacement sizing character, VAX
327 @cindex VAX displacement sizing character
328 The displacement sizing character is @samp{`} (an accent grave) for
329 Unix compatibility, not @samp{^} as DEC writes it. The letter
330 preceding @samp{`} may have either case. @samp{G} is not
331 understood, but all other letters (@code{b i l s w}) are understood.
332
333 @cindex register names, VAX
334 @cindex VAX register names
335 Register names understood are @code{r0 r1 r2 @dots{} r15 ap fp sp
336 pc}. Upper and lower case letters are equivalent.
337
338 For instance
339 @smallexample
340 tstb *w`$4(r5)
341 @end smallexample
342
343 Any expression is permitted in an operand. Operands are comma
344 separated.
345
346 @c There is some bug to do with recognizing expressions
347 @c in operands, but I forget what it is. It is
348 @c a syntax clash because () is used as an address mode
349 @c and to encapsulate sub-expressions.
350
351 @node VAX-no
352 @section Not Supported on VAX
353
354 @cindex VAX bitfields not supported
355 @cindex bitfields, not supported on VAX
356 Vax bit fields can not be assembled with @code{@value{AS}}. Someone
357 can add the required code if they really need it.