under m68k description, indicate that only a subset of moto syntax is handled
[binutils-gdb.git] / gas / doc / as.texinfo
1 \input texinfo @c -*-Texinfo-*-
2 @c Copyright (c) 1991 1992 1993 1994 Free Software Foundation, Inc.
3 @c UPDATE!! On future updates--
4 @c (1) check for new machine-dep cmdline options in
5 @c md_parse_option definitions in config/tc-*.c
6 @c (2) for platform-specific directives, examine md_pseudo_op
7 @c in config/tc-*.c
8 @c (3) for object-format specific directives, examine obj_pseudo_op
9 @c in config/obj-*.c
10 @c (4) portable directives in potable[] in read.c
11 @c %**start of header
12 @setfilename as.info
13 @c ---config---
14 @c defaults, config file may override:
15 @set have-stabs
16 @c ---
17 @include asconfig.texi
18 @c ---
19 @c common OR combinations of conditions
20 @ifset AOUT
21 @set aout-bout
22 @end ifset
23 @ifset BOUT
24 @set aout-bout
25 @end ifset
26 @ifset H8/300
27 @set H8
28 @end ifset
29 @ifset H8/500
30 @set H8
31 @end ifset
32 @ifset SH
33 @set H8
34 @end ifset
35 @ifset HPPA
36 @set abnormal-separator
37 @end ifset
38 @c ------------
39 @ifset GENERIC
40 @settitle Using @value{AS}
41 @end ifset
42 @ifclear GENERIC
43 @settitle Using @value{AS} (@value{TARGET})
44 @end ifclear
45 @setchapternewpage odd
46 @c %**end of header
47
48 @c @smallbook
49 @c @set SMALL
50 @c WARE! Some of the machine-dependent sections contain tables of machine
51 @c instructions. Except in multi-column format, these tables look silly.
52 @c Unfortunately, Texinfo doesn't have a general-purpose multi-col format, so
53 @c the multi-col format is faked within @example sections.
54 @c
55 @c Again unfortunately, the natural size that fits on a page, for these tables,
56 @c is different depending on whether or not smallbook is turned on.
57 @c This matters, because of order: text flow switches columns at each page
58 @c break.
59 @c
60 @c The format faked in this source works reasonably well for smallbook,
61 @c not well for the default large-page format. This manual expects that if you
62 @c turn on @smallbook, you will also uncomment the "@set SMALL" to enable the
63 @c tables in question. You can turn on one without the other at your
64 @c discretion, of course.
65 @ifinfo
66 @set SMALL
67 @c the insn tables look just as silly in info files regardless of smallbook,
68 @c might as well show 'em anyways.
69 @end ifinfo
70
71 @ifinfo
72 @format
73 START-INFO-DIR-ENTRY
74 * As: (as). The GNU assembler.
75 END-INFO-DIR-ENTRY
76 @end format
77 @end ifinfo
78
79 @finalout
80 @syncodeindex ky cp
81
82 @ifinfo
83 This file documents the GNU Assembler "@value{AS}".
84
85 Copyright (C) 1991, 1992, 1993, 1994 Free Software Foundation, Inc.
86
87 Permission is granted to make and distribute verbatim copies of
88 this manual provided the copyright notice and this permission notice
89 are preserved on all copies.
90
91 @ignore
92 Permission is granted to process this file through Tex and print the
93 results, provided the printed document carries copying permission
94 notice identical to this one except for the removal of this paragraph
95 (this paragraph not being relevant to the printed manual).
96
97 @end ignore
98 Permission is granted to copy and distribute modified versions of this manual
99 under the conditions for verbatim copying, provided that the entire resulting
100 derived work is distributed under the terms of a permission notice identical to
101 this one.
102
103 Permission is granted to copy and distribute translations of this manual
104 into another language, under the above conditions for modified versions.
105 @end ifinfo
106
107 @titlepage
108 @title Using @value{AS}
109 @subtitle The GNU Assembler
110 @ifclear GENERIC
111 @subtitle for the @value{TARGET} family
112 @end ifclear
113 @sp 1
114 @subtitle January 1994
115 @sp 1
116 @sp 13
117 The Free Software Foundation Inc. thanks The Nice Computer
118 Company of Australia for loaning Dean Elsner to write the
119 first (Vax) version of @code{as} for Project GNU.
120 The proprietors, management and staff of TNCCA thank FSF for
121 distracting the boss while they got some work
122 done.
123 @sp 3
124 @author Dean Elsner, Jay Fenlason & friends
125 @page
126 @tex
127 {\parskip=0pt
128 \hfill {\it Using {\tt @value{AS}}}\par
129 \hfill Edited by Roland Pesch for Cygnus Support\par
130 }
131 %"boxit" macro for figures:
132 %Modified from Knuth's ``boxit'' macro from TeXbook (answer to exercise 21.3)
133 \gdef\boxit#1#2{\vbox{\hrule\hbox{\vrule\kern3pt
134 \vbox{\parindent=0pt\parskip=0pt\hsize=#1\kern3pt\strut\hfil
135 #2\hfil\strut\kern3pt}\kern3pt\vrule}\hrule}}%box with visible outline
136 \gdef\ibox#1#2{\hbox to #1{#2\hfil}\kern8pt}% invisible box
137 @end tex
138
139 @vskip 0pt plus 1filll
140 Copyright @copyright{} 1991, 1992, 1993, 1994 Free Software Foundation, Inc.
141
142 Permission is granted to make and distribute verbatim copies of
143 this manual provided the copyright notice and this permission notice
144 are preserved on all copies.
145
146 Permission is granted to copy and distribute modified versions of this manual
147 under the conditions for verbatim copying, provided that the entire resulting
148 derived work is distributed under the terms of a permission notice identical to
149 this one.
150
151 Permission is granted to copy and distribute translations of this manual
152 into another language, under the above conditions for modified versions.
153 @end titlepage
154
155 @ifinfo
156 @node Top
157 @top Using @value{AS}
158
159 This file is a user guide to the @sc{gnu} assembler @code{@value{AS}}.
160 @ifclear GENERIC
161 This version of the file describes @code{@value{AS}} configured to generate
162 code for @value{TARGET} architectures.
163 @end ifclear
164 @menu
165 * Overview:: Overview
166 * Invoking:: Command-Line Options
167 * Syntax:: Syntax
168 * Sections:: Sections and Relocation
169 * Symbols:: Symbols
170 * Expressions:: Expressions
171 * Pseudo Ops:: Assembler Directives
172 * Machine Dependencies:: Machine Dependent Features
173 * Acknowledgements:: Who Did What
174 * Index:: Index
175 @end menu
176 @end ifinfo
177
178 @node Overview
179 @chapter Overview
180 @iftex
181 This manual is a user guide to the @sc{gnu} assembler @code{@value{AS}}.
182 @ifclear GENERIC
183 This version of the manual describes @code{@value{AS}} configured to generate
184 code for @value{TARGET} architectures.
185 @end ifclear
186 @end iftex
187
188 @cindex invocation summary
189 @cindex option summary
190 @cindex summary of options
191 Here is a brief summary of how to invoke @code{@value{AS}}. For details,
192 @pxref{Invoking,,Comand-Line Options}.
193
194 @c We don't use deffn and friends for the following because they seem
195 @c to be limited to one line for the header.
196 @smallexample
197 @value{AS} [ -a[dhlns] ] [ -D ] [ -f ] [ --help ]
198 [ -I @var{dir} ] [ -J ] [ -K ] [ -L ] [ -o @var{objfile} ]
199 [ -R ] [ --statistics ] [ -v ] [ -version ] [ --version ]
200 [ -W ] [ -w ] [ -x ] [ -Z ]
201 @ifset A29K
202 @c am29k has no machine-dependent assembler options
203 @end ifset
204 @ifset H8
205 @c Hitachi family chips have no machine-dependent assembler options
206 @end ifset
207 @ifset HPPA
208 @c HPPA has no machine-dependent assembler options (yet).
209 @end ifset
210 @ifset SPARC
211 [ -Av6 | -Av7 | -Av8 | -Asparclite | -bump ]
212 @end ifset
213 @ifset Z8000
214 @c Z8000 has no machine-dependent assembler options
215 @end ifset
216 @ifset I960
217 @c see md_parse_option in tc-i960.c
218 [ -ACA | -ACA_A | -ACB | -ACC | -AKA | -AKB | -AKC | -AMC ]
219 [ -b ] [ -no-relax ]
220 @end ifset
221 @ifset M680X0
222 [ -l ] [ -m68000 | -m68010 | -m68020 | ... ]
223 @end ifset
224 @ifset MIPS
225 [ -nocpp ] [ -EL ] [ -EB ] [ -G @var{num} ] [ -mcpu=@var{CPU} ]
226 [ -mips1 ] [ -mips2 ] [ -mips3 ] [ -m4650 ] [ -no-m4650 ]
227 [ --trap ] [ --break ]
228 @end ifset
229 [ -- | @var{files} @dots{} ]
230 @end smallexample
231
232 @table @code
233 @item -a[dhlns]
234 Turn on listings, in any of a variety of ways:
235
236 @table @code
237 @item -ad
238 omit debugging directives
239
240 @item -ah
241 include high-level source
242
243 @item -al
244 include assembly
245
246 @item -an
247 omit forms processing
248
249 @item -as
250 include symbols
251 @end table
252
253 You may combine these options; for example, use @samp{-aln} for assembly
254 listing without forms processing. By itself, @samp{-a} defaults to
255 @samp{-ahls}---that is, all listings turned on.
256
257 @item -D
258 Ignored. This option is accepted for script compatibility with calls to
259 other assemblers.
260
261 @item -f
262 ``fast''---skip whitespace and comment preprocessing (assume source is
263 compiler output).
264
265 @item --help
266 Print a summary of the command line options and exit.
267
268 @item -I @var{dir}
269 Add directory @var{dir} to the search list for @code{.include} directives.
270
271 @item -J
272 Don't warn about signed overflow.
273
274 @item -K
275 @ifclear DIFF-TBL-KLUGE
276 This option is accepted but has no effect on the @value{TARGET} family.
277 @end ifclear
278 @ifset DIFF-TBL-KLUGE
279 Issue warnings when difference tables altered for long displacements.
280 @end ifset
281
282 @item -L
283 Keep (in the symbol table) local symbols, starting with @samp{L}.
284
285 @item -o @var{objfile}
286 Name the object-file output from @code{@value{AS}} @var{objfile}.
287
288 @item -R
289 Fold the data section into the text section.
290
291 @item --statistics
292 Print the maximum space (in bytes) and total time (in seconds) used by
293 assembly.
294
295 @item -v
296 @itemx -version
297 Print the @code{as} version.
298
299 @item --version
300 Print the @code{as} version and exit.
301
302 @item -W
303 Suppress warning messages.
304
305 @item -w
306 Ignored.
307
308 @item -x
309 Ignored.
310
311 @item -Z
312 Generate an object file even after errors.
313
314 @item -- | @var{files} @dots{}
315 Standard input, or source files to assemble.
316
317 @end table
318
319 @ifset I960
320 The following options are available when @value{AS} is configured for the
321 Intel 80960 processor.
322
323 @table @code
324 @item -ACA | -ACA_A | -ACB | -ACC | -AKA | -AKB | -AKC | -AMC
325 Specify which variant of the 960 architecture is the target.
326
327 @item -b
328 Add code to collect statistics about branches taken.
329
330 @item -no-relax
331 Do not alter compare-and-branch instructions for long displacements;
332 error if necessary.
333
334 @end table
335 @end ifset
336
337 @ifset M680X0
338 The following options are available when @value{AS} is configured for the
339 Motorola 68000 series.
340
341 @table @code
342
343 @item -l
344 Shorten references to undefined symbols, to one word instead of two.
345
346 @item -m68000 | -m68008 | -m68010 | -m68020 | -m68030 | -m68040
347 @itemx | -m68302 | -m68331 | -m68332 | -m68333 | -m68340 | -mcpu32
348 Specify what processor in the 68000 family is the target. The default
349 is normally the 68020, but this can be changed at configuration time.
350
351 @item -m68881 | -m68882 | -mno-68881 | -mno-68882
352 The target machine does (or does not) have a floating-point coprocessor.
353 The default is to assume a coprocessor for 68020, 68030, and cpu32. Although
354 the basic 68000 is not compatible with the 68881, a combination of the
355 two can be specified, since it's possible to do emulation of the
356 coprocessor instructions with the main processor.
357
358 @item -m68851 | -mno-68851
359 The target machine does (or does not) have a memory-management
360 unit coprocessor. The default is to assume an MMU for 68020 and up.
361
362 @end table
363 @end ifset
364
365 @ifset SPARC
366 The following options are available when @code{@value{AS}} is configured
367 for the SPARC architecture:
368
369 @table @code
370 @item -Av6 | -Av7 | -Av8 | -Asparclite
371 Explicitly select a variant of the SPARC architecture.
372
373 @item -bump
374 Warn when the assembler switches to another architecture.
375 @end table
376 @end ifset
377
378 @ifset MIPS
379 The following options are available when @value{AS} is configured for
380 a MIPS processor.
381
382 @table @code
383 @item -G @var{num}
384 This option sets the largest size of an object that can be referenced
385 implicitly with the @code{gp} register. It is only accepted for targets that
386 use ECOFF format, such as a DECstation running Ultrix. The default value is 8.
387
388 @cindex MIPS endianness
389 @cindex endianness, MIPS
390 @cindex big endian output, MIPS
391 @item -EB
392 Generate ``big endian'' format output.
393
394 @cindex little endian output, MIPS
395 @item -EL
396 Generate ``little endian'' format output.
397
398 @cindex MIPS ISA
399 @item -mips1
400 @itemx -mips2
401 @itemx -mips3
402 Generate code for a particular MIPS Instruction Set Architecture level.
403 @samp{-mips1} corresponds to the @sc{r2000} and @sc{r3000} processors,
404 @samp{-mips2} to the @sc{r6000} processor, and @samp{-mips3} to the @sc{r4000}
405 processor.
406
407 @item -m4650
408 @item -no-m4650
409 Generate code for the MIPS @sc{r4650} chip. This tells the assembler to accept
410 the @samp{mad} and @samp{madu} instruction, and to not schedule @samp{nop}
411 instructions around accesses to the @samp{HI} and @samp{LO} registers.
412 @samp{-no-m4650} turns off this option.
413
414 @item -mcpu=@var{CPU}
415 Generate code for a particular MIPS cpu. This has little effect on the
416 assembler, but it is passed by @code{@value{GCC}}.
417
418 @item -nocpp
419 @code{@value{AS}} ignores this option. It is accepted for compatibility with
420 the native tools.
421
422 @item --trap
423 @itemx --no-trap
424 @itemx --break
425 @itemx --no-break
426 Control how to deal with multiplication overflow and division by zero.
427 @samp{--trap} or @samp{--no-break} (which are synonyms) take a trap exception
428 (and only work for Instruction Set Architecture level 2 and higher);
429 @samp{--break} or @samp{--no-trap} (also synonyms, and the default) take a
430 break exception.
431 @end table
432 @end ifset
433
434 @menu
435 * Manual:: Structure of this Manual
436 * GNU Assembler:: @value{AS}, the GNU Assembler
437 * Object Formats:: Object File Formats
438 * Command Line:: Command Line
439 * Input Files:: Input Files
440 * Object:: Output (Object) File
441 * Errors:: Error and Warning Messages
442 @end menu
443
444 @node Manual
445 @section Structure of this Manual
446
447 @cindex manual, structure and purpose
448 This manual is intended to describe what you need to know to use
449 @sc{gnu} @code{@value{AS}}. We cover the syntax expected in source files, including
450 notation for symbols, constants, and expressions; the directives that
451 @code{@value{AS}} understands; and of course how to invoke @code{@value{AS}}.
452
453 @ifclear GENERIC
454 We also cover special features in the @value{TARGET}
455 configuration of @code{@value{AS}}, including assembler directives.
456 @end ifclear
457 @ifset GENERIC
458 This manual also describes some of the machine-dependent features of
459 various flavors of the assembler.
460 @end ifset
461
462 @cindex machine instructions (not covered)
463 On the other hand, this manual is @emph{not} intended as an introduction
464 to programming in assembly language---let alone programming in general!
465 In a similar vein, we make no attempt to introduce the machine
466 architecture; we do @emph{not} describe the instruction set, standard
467 mnemonics, registers or addressing modes that are standard to a
468 particular architecture.
469 @ifset GENERIC
470 You may want to consult the manufacturer's
471 machine architecture manual for this information.
472 @end ifset
473 @ifclear GENERIC
474 @ifset H8/300
475 For information on the H8/300 machine instruction set, see @cite{H8/300
476 Series Programming Manual} (Hitachi ADE--602--025). For the H8/300H,
477 see @cite{H8/300H Series Programming Manual} (Hitachi).
478 @end ifset
479 @ifset H8/500
480 For information on the H8/500 machine instruction set, see @cite{H8/500
481 Series Programming Manual} (Hitachi M21T001).
482 @end ifset
483 @ifset SH
484 For information on the Hitachi SH machine instruction set, see
485 @cite{SH-Microcomputer User's Manual} (Hitachi Micro Systems, Inc.).
486 @end ifset
487 @ifset Z8000
488 For information on the Z8000 machine instruction set, see @cite{Z8000 CPU Technical Manual}
489 @end ifset
490 @end ifclear
491
492 @c I think this is premature---pesch@cygnus.com, 17jan1991
493 @ignore
494 Throughout this manual, we assume that you are running @dfn{GNU},
495 the portable operating system from the @dfn{Free Software
496 Foundation, Inc.}. This restricts our attention to certain kinds of
497 computer (in particular, the kinds of computers that @sc{gnu} can run on);
498 once this assumption is granted examples and definitions need less
499 qualification.
500
501 @code{@value{AS}} is part of a team of programs that turn a high-level
502 human-readable series of instructions into a low-level
503 computer-readable series of instructions. Different versions of
504 @code{@value{AS}} are used for different kinds of computer.
505 @end ignore
506
507 @c There used to be a section "Terminology" here, which defined
508 @c "contents", "byte", "word", and "long". Defining "word" to any
509 @c particular size is confusing when the .word directive may generate 16
510 @c bits on one machine and 32 bits on another; in general, for the user
511 @c version of this manual, none of these terms seem essential to define.
512 @c They were used very little even in the former draft of the manual;
513 @c this draft makes an effort to avoid them (except in names of
514 @c directives).
515
516 @node GNU Assembler
517 @section @value{AS}, the GNU Assembler
518
519 @sc{gnu} @code{as} is really a family of assemblers.
520 @ifclear GENERIC
521 This manual describes @code{@value{AS}}, a member of that family which is
522 configured for the @value{TARGET} architectures.
523 @end ifclear
524 If you use (or have used) the @sc{gnu} assembler on one architecture, you
525 should find a fairly similar environment when you use it on another
526 architecture. Each version has much in common with the others,
527 including object file formats, most assembler directives (often called
528 @dfn{pseudo-ops}) and assembler syntax.@refill
529
530 @cindex purpose of @sc{gnu} @code{@value{AS}}
531 @code{@value{AS}} is primarily intended to assemble the output of the
532 @sc{gnu} C compiler @code{@value{GCC}} for use by the linker
533 @code{@value{LD}}. Nevertheless, we've tried to make @code{@value{AS}}
534 assemble correctly everything that other assemblers for the same
535 machine would assemble.
536 @ifset VAX
537 Any exceptions are documented explicitly (@pxref{Machine Dependencies}).
538 @end ifset
539 @ifset M680X0
540 @c This remark should appear in generic version of manual; assumption
541 @c here is that generic version sets M680x0.
542 This doesn't mean @code{@value{AS}} always uses the same syntax as another
543 assembler for the same architecture; for example, we know of several
544 incompatible versions of 680x0 assembly language syntax.
545 @end ifset
546
547 Unlike older assemblers, @code{@value{AS}} is designed to assemble a source
548 program in one pass of the source file. This has a subtle impact on the
549 @kbd{.org} directive (@pxref{Org,,@code{.org}}).
550
551 @node Object Formats
552 @section Object File Formats
553
554 @cindex object file format
555 The @sc{gnu} assembler can be configured to produce several alternative
556 object file formats. For the most part, this does not affect how you
557 write assembly language programs; but directives for debugging symbols
558 are typically different in different file formats. @xref{Symbol
559 Attributes,,Symbol Attributes}.
560 @ifclear GENERIC
561 @ifclear MULTI-OBJ
562 On the @value{TARGET}, @code{@value{AS}} is configured to produce
563 @value{OBJ-NAME} format object files.
564 @end ifclear
565 @c The following should exhaust all configs that set MULTI-OBJ, ideally
566 @ifset A29K
567 On the @value{TARGET}, @code{@value{AS}} can be configured to produce either
568 @code{a.out} or COFF format object files.
569 @end ifset
570 @ifset I960
571 On the @value{TARGET}, @code{@value{AS}} can be configured to produce either
572 @code{b.out} or COFF format object files.
573 @end ifset
574 @ifset HPPA
575 On the @value{TARGET}, @code{@value{AS}} can be configured to produce either
576 SOM or ELF format object files.
577 @end ifset
578 @end ifclear
579
580 @node Command Line
581 @section Command Line
582
583 @cindex command line conventions
584 After the program name @code{@value{AS}}, the command line may contain
585 options and file names. Options may appear in any order, and may be
586 before, after, or between file names. The order of file names is
587 significant.
588
589 @cindex standard input, as input file
590 @kindex --
591 @file{--} (two hyphens) by itself names the standard input file
592 explicitly, as one of the files for @code{@value{AS}} to assemble.
593
594 @cindex options, command line
595 Except for @samp{--} any command line argument that begins with a
596 hyphen (@samp{-}) is an option. Each option changes the behavior of
597 @code{@value{AS}}. No option changes the way another option works. An
598 option is a @samp{-} followed by one or more letters; the case of
599 the letter is important. All options are optional.
600
601 Some options expect exactly one file name to follow them. The file
602 name may either immediately follow the option's letter (compatible
603 with older assemblers) or it may be the next command argument (@sc{gnu}
604 standard). These two command lines are equivalent:
605
606 @smallexample
607 @value{AS} -o my-object-file.o mumble.s
608 @value{AS} -omy-object-file.o mumble.s
609 @end smallexample
610
611 @node Input Files
612 @section Input Files
613
614 @cindex input
615 @cindex source program
616 @cindex files, input
617 We use the phrase @dfn{source program}, abbreviated @dfn{source}, to
618 describe the program input to one run of @code{@value{AS}}. The program may
619 be in one or more files; how the source is partitioned into files
620 doesn't change the meaning of the source.
621
622 @c I added "con" prefix to "catenation" just to prove I can overcome my
623 @c APL training... pesch@cygnus.com
624 The source program is a concatenation of the text in all the files, in the
625 order specified.
626
627 Each time you run @code{@value{AS}} it assembles exactly one source
628 program. The source program is made up of one or more files.
629 (The standard input is also a file.)
630
631 You give @code{@value{AS}} a command line that has zero or more input file
632 names. The input files are read (from left file name to right). A
633 command line argument (in any position) that has no special meaning
634 is taken to be an input file name.
635
636 If you give @code{@value{AS}} no file names it attempts to read one input file
637 from the @code{@value{AS}} standard input, which is normally your terminal. You
638 may have to type @key{ctl-D} to tell @code{@value{AS}} there is no more program
639 to assemble.
640
641 Use @samp{--} if you need to explicitly name the standard input file
642 in your command line.
643
644 If the source is empty, @code{@value{AS}} produces a small, empty object
645 file.
646
647 @subheading Filenames and Line-numbers
648
649 @cindex input file linenumbers
650 @cindex line numbers, in input files
651 There are two ways of locating a line in the input file (or files) and
652 either may be used in reporting error messages. One way refers to a line
653 number in a physical file; the other refers to a line number in a
654 ``logical'' file. @xref{Errors, ,Error and Warning Messages}.
655
656 @dfn{Physical files} are those files named in the command line given
657 to @code{@value{AS}}.
658
659 @dfn{Logical files} are simply names declared explicitly by assembler
660 directives; they bear no relation to physical files. Logical file names
661 help error messages reflect the original source file, when @code{@value{AS}}
662 source is itself synthesized from other files.
663 @xref{App-File,,@code{.app-file}}.
664
665 @node Object
666 @section Output (Object) File
667
668 @cindex object file
669 @cindex output file
670 @kindex a.out
671 @kindex .o
672 Every time you run @code{@value{AS}} it produces an output file, which is
673 your assembly language program translated into numbers. This file
674 is the object file. Its default name is
675 @ifclear BOUT
676 @code{a.out}.
677 @end ifclear
678 @ifset BOUT
679 @ifset GENERIC
680 @code{a.out}, or
681 @end ifset
682 @code{b.out} when @code{@value{AS}} is configured for the Intel 80960.
683 @end ifset
684 You can give it another name by using the @code{-o} option. Conventionally,
685 object file names end with @file{.o}. The default name is used for historical
686 reasons: older assemblers were capable of assembling self-contained programs
687 directly into a runnable program. (For some formats, this isn't currently
688 possible, but it can be done for the @code{a.out} format.)
689
690 @cindex linker
691 @kindex ld
692 The object file is meant for input to the linker @code{@value{LD}}. It contains
693 assembled program code, information to help @code{@value{LD}} integrate
694 the assembled program into a runnable file, and (optionally) symbolic
695 information for the debugger.
696
697 @c link above to some info file(s) like the description of a.out.
698 @c don't forget to describe GNU info as well as Unix lossage.
699
700 @node Errors
701 @section Error and Warning Messages
702
703 @cindex error messsages
704 @cindex warning messages
705 @cindex messages from @code{@value{AS}}
706 @code{@value{AS}} may write warnings and error messages to the standard error
707 file (usually your terminal). This should not happen when a compiler
708 runs @code{@value{AS}} automatically. Warnings report an assumption made so
709 that @code{@value{AS}} could keep assembling a flawed program; errors report a
710 grave problem that stops the assembly.
711
712 @cindex format of warning messages
713 Warning messages have the format
714
715 @smallexample
716 file_name:@b{NNN}:Warning Message Text
717 @end smallexample
718
719 @noindent
720 @cindex line numbers, in warnings/errors
721 (where @b{NNN} is a line number). If a logical file name has been given
722 (@pxref{App-File,,@code{.app-file}}) it is used for the filename,
723 otherwise the name of the current input file is used. If a logical line
724 number was given
725 @ifset GENERIC
726 (@pxref{Line,,@code{.line}})
727 @end ifset
728 @ifclear GENERIC
729 @ifclear A29K
730 (@pxref{Line,,@code{.line}})
731 @end ifclear
732 @ifset A29K
733 (@pxref{Ln,,@code{.ln}})
734 @end ifset
735 @end ifclear
736 then it is used to calculate the number printed,
737 otherwise the actual line in the current source file is printed. The
738 message text is intended to be self explanatory (in the grand Unix
739 tradition).
740
741 @cindex format of error messages
742 Error messages have the format
743 @smallexample
744 file_name:@b{NNN}:FATAL:Error Message Text
745 @end smallexample
746 The file name and line number are derived as for warning
747 messages. The actual message text may be rather less explanatory
748 because many of them aren't supposed to happen.
749
750 @node Invoking
751 @chapter Command-Line Options
752
753 @cindex options, all versions of @code{@value{AS}}
754 This chapter describes command-line options available in @emph{all}
755 versions of the @sc{gnu} assembler; @pxref{Machine Dependencies}, for options specific
756 @ifclear GENERIC
757 to the @value{TARGET}.
758 @end ifclear
759 @ifset GENERIC
760 to particular machine architectures.
761 @end ifset
762
763 If you are invoking @code{@value{AS}} via the @sc{gnu} C compiler (version 2), you
764 can use the @samp{-Wa} option to pass arguments through to the
765 assembler. The assembler arguments must be separated from each other
766 (and the @samp{-Wa}) by commas. For example:
767
768 @smallexample
769 gcc -c -g -O -Wa,-alh,-L file.c
770 @end smallexample
771
772 @noindent
773 emits a listing to standard output with high-level
774 and assembly source.
775
776 Usually you do not need to use this @samp{-Wa} mechanism, since many compiler
777 command-line options are automatically passed to the assembler by the compiler.
778 (You can call the @sc{gnu} compiler driver with the @samp{-v} option to see
779 precisely what options it passes to each compilation pass, including the
780 assembler.)
781
782 @menu
783 * a:: -a[dhlns] enable listings
784 * D:: -D for compatibility
785 * f:: -f to work faster
786 * I:: -I for .include search path
787 @ifclear DIFF-TBL-KLUGE
788 * K:: -K for compatibility
789 @end ifclear
790 @ifset DIFF-TBL-KLUGE
791 * K:: -K for difference tables
792 @end ifset
793
794 * L:: -L to retain local labels
795 * o:: -o to name the object file
796 * R:: -R to join data and text sections
797 * statistics:: --statistics to see statistics about assembly
798 * v:: -v to announce version
799 * W:: -W to suppress warnings
800 * Z:: -Z to make object file even after errors
801 @end menu
802
803 @node a
804 @section Enable Listings: @code{-a[dhlns]}
805
806 @kindex -a
807 @kindex -ad
808 @kindex -ah
809 @kindex -al
810 @kindex -an
811 @kindex -as
812 @cindex listings, enabling
813 @cindex assembly listings, enabling
814
815 These options enable listing output from the assembler. By itself,
816 @samp{-a} requests high-level, assembly, and symbols listing.
817 You can use other letters to select specific options for the list:
818 @samp{-ah} requests a high-level language listing,
819 @samp{-al} requests an output-program assembly listing, and
820 @samp{-as} requests a symbol table listing.
821 High-level listings require that a compiler debugging option like
822 @samp{-g} be used, and that assembly listings (@samp{-al}) be requested
823 also.
824
825 Use the @samp{-ad} option to omit debugging directives from the
826 listing.
827
828 Once you have specified one of these options, you can further control
829 listing output and its appearance using the directives @code{.list},
830 @code{.nolist}, @code{.psize}, @code{.eject}, @code{.title}, and
831 @code{.sbttl}.
832 The @samp{-an} option turns off all forms processing.
833 If you do not request listing output with one of the @samp{-a} options, the
834 listing-control directives have no effect.
835
836 The letters after @samp{-a} may be combined into one option,
837 @emph{e.g.}, @samp{-aln}.
838
839 @node D
840 @section @code{-D}
841
842 @kindex -D
843 This option has no effect whatsoever, but it is accepted to make it more
844 likely that scripts written for other assemblers also work with
845 @code{@value{AS}}.
846
847 @node f
848 @section Work Faster: @code{-f}
849
850 @kindex -f
851 @cindex trusted compiler
852 @cindex faster processing (@code{-f})
853 @samp{-f} should only be used when assembling programs written by a
854 (trusted) compiler. @samp{-f} stops the assembler from doing whitespace
855 and comment preprocessing on
856 the input file(s) before assembling them. @xref{Preprocessing,
857 ,Preprocessing}.
858
859 @quotation
860 @emph{Warning:} if you use @samp{-f} when the files actually need to be
861 preprocessed (if they contain comments, for example), @code{@value{AS}} does
862 not work correctly.
863 @end quotation
864
865 @node I
866 @section @code{.include} search path: @code{-I} @var{path}
867
868 @kindex -I @var{path}
869 @cindex paths for @code{.include}
870 @cindex search path for @code{.include}
871 @cindex @code{include} directive search path
872 Use this option to add a @var{path} to the list of directories
873 @code{@value{AS}} searches for files specified in @code{.include}
874 directives (@pxref{Include,,@code{.include}}). You may use @code{-I} as
875 many times as necessary to include a variety of paths. The current
876 working directory is always searched first; after that, @code{@value{AS}}
877 searches any @samp{-I} directories in the same order as they were
878 specified (left to right) on the command line.
879
880 @node K
881 @section Difference Tables: @code{-K}
882
883 @kindex -K
884 @ifclear DIFF-TBL-KLUGE
885 On the @value{TARGET} family, this option is allowed, but has no effect. It is
886 permitted for compatibility with the @sc{gnu} assembler on other platforms,
887 where it can be used to warn when the assembler alters the machine code
888 generated for @samp{.word} directives in difference tables. The @value{TARGET}
889 family does not have the addressing limitations that sometimes lead to this
890 alteration on other platforms.
891 @end ifclear
892
893 @ifset DIFF-TBL-KLUGE
894 @cindex difference tables, warning
895 @cindex warning for altered difference tables
896 @code{@value{AS}} sometimes alters the code emitted for directives of the form
897 @samp{.word @var{sym1}-@var{sym2}}; @pxref{Word,,@code{.word}}.
898 You can use the @samp{-K} option if you want a warning issued when this
899 is done.
900 @end ifset
901
902 @node L
903 @section Include Local Labels: @code{-L}
904
905 @kindex -L
906 @cindex local labels, retaining in output
907 Labels beginning with @samp{L} (upper case only) are called @dfn{local
908 labels}. @xref{Symbol Names}. Normally you do not see such labels when
909 debugging, because they are intended for the use of programs (like
910 compilers) that compose assembler programs, not for your notice.
911 Normally both @code{@value{AS}} and @code{@value{LD}} discard such labels, so you do not
912 normally debug with them.
913
914 This option tells @code{@value{AS}} to retain those @samp{L@dots{}} symbols
915 in the object file. Usually if you do this you also tell the linker
916 @code{@value{LD}} to preserve symbols whose names begin with @samp{L}.
917
918 By default, a local label is any label beginning with @samp{L}, but each
919 target is allowed to redefine the local label prefix.
920 @ifset HPPA
921 On the HPPA local labels begin with @samp{L$}.
922 @end ifset
923
924 @node o
925 @section Name the Object File: @code{-o}
926
927 @kindex -o
928 @cindex naming object file
929 @cindex object file name
930 There is always one object file output when you run @code{@value{AS}}. By
931 default it has the name
932 @ifset GENERIC
933 @ifset I960
934 @file{a.out} (or @file{b.out}, for Intel 960 targets only).
935 @end ifset
936 @ifclear I960
937 @file{a.out}.
938 @end ifclear
939 @end ifset
940 @ifclear GENERIC
941 @ifset I960
942 @file{b.out}.
943 @end ifset
944 @ifclear I960
945 @file{a.out}.
946 @end ifclear
947 @end ifclear
948 You use this option (which takes exactly one filename) to give the
949 object file a different name.
950
951 Whatever the object file is called, @code{@value{AS}} overwrites any
952 existing file of the same name.
953
954 @node R
955 @section Join Data and Text Sections: @code{-R}
956
957 @kindex -R
958 @cindex data and text sections, joining
959 @cindex text and data sections, joining
960 @cindex joining text and data sections
961 @cindex merging text and data sections
962 @code{-R} tells @code{@value{AS}} to write the object file as if all
963 data-section data lives in the text section. This is only done at
964 the very last moment: your binary data are the same, but data
965 section parts are relocated differently. The data section part of
966 your object file is zero bytes long because all its bytes are
967 appended to the text section. (@xref{Sections,,Sections and Relocation}.)
968
969 When you specify @code{-R} it would be possible to generate shorter
970 address displacements (because we do not have to cross between text and
971 data section). We refrain from doing this simply for compatibility with
972 older versions of @code{@value{AS}}. In future, @code{-R} may work this way.
973
974 @ifset COFF
975 When @code{@value{AS}} is configured for COFF output,
976 this option is only useful if you use sections named @samp{.text} and
977 @samp{.data}.
978 @end ifset
979
980 @ifset HPPA
981 @code{-R} is not supported for any of the HPPA targets. Using
982 @code{-R} generates a warning from @code{@value{AS}}.
983 @end ifset
984
985 @node statistics
986 @section Display Assembly Statistics: @code{--statistics}
987
988 @kindex --statistics
989 @cindex statistics, about assembly
990 @cindex time, total for assembly
991 @cindex space used, maximum for assembly
992 Use @samp{--statistics} to display two statistics about the resources used by
993 @code{@value{AS}}: the maximum amount of space allocated during the assembly
994 (in bytes), and the total execution time taken for the assembly (in @sc{cpu}
995 seconds).
996
997 @node v
998 @section Announce Version: @code{-v}
999
1000 @kindex -v
1001 @kindex -version
1002 @cindex @code{@value{AS}} version
1003 @cindex version of @code{@value{AS}}
1004 You can find out what version of as is running by including the
1005 option @samp{-v} (which you can also spell as @samp{-version}) on the
1006 command line.
1007
1008 @node W
1009 @section Suppress Warnings: @code{-W}
1010
1011 @kindex -W
1012 @cindex suppressing warnings
1013 @cindex warnings, suppressing
1014 @code{@value{AS}} should never give a warning or error message when
1015 assembling compiler output. But programs written by people often
1016 cause @code{@value{AS}} to give a warning that a particular assumption was
1017 made. All such warnings are directed to the standard error file.
1018 If you use this option, no warnings are issued. This option only
1019 affects the warning messages: it does not change any particular of how
1020 @code{@value{AS}} assembles your file. Errors, which stop the assembly, are
1021 still reported.
1022
1023 @node Z
1024 @section Generate Object File in Spite of Errors: @code{-Z}
1025 @cindex object file, after errors
1026 @cindex errors, continuing after
1027 After an error message, @code{@value{AS}} normally produces no output. If for
1028 some reason you are interested in object file output even after
1029 @code{@value{AS}} gives an error message on your program, use the @samp{-Z}
1030 option. If there are any errors, @code{@value{AS}} continues anyways, and
1031 writes an object file after a final warning message of the form @samp{@var{n}
1032 errors, @var{m} warnings, generating bad object file.}
1033
1034 @node Syntax
1035 @chapter Syntax
1036
1037 @cindex machine-independent syntax
1038 @cindex syntax, machine-independent
1039 This chapter describes the machine-independent syntax allowed in a
1040 source file. @code{@value{AS}} syntax is similar to what many other
1041 assemblers use; it is inspired by the BSD 4.2
1042 @ifclear VAX
1043 assembler.
1044 @end ifclear
1045 @ifset VAX
1046 assembler, except that @code{@value{AS}} does not assemble Vax bit-fields.
1047 @end ifset
1048
1049 @menu
1050 * Preprocessing:: Preprocessing
1051 * Whitespace:: Whitespace
1052 * Comments:: Comments
1053 * Symbol Intro:: Symbols
1054 * Statements:: Statements
1055 * Constants:: Constants
1056 @end menu
1057
1058 @node Preprocessing
1059 @section Preprocessing
1060
1061 @cindex preprocessing
1062 The @code{@value{AS}} internal preprocessor:
1063 @itemize @bullet
1064 @cindex whitespace, removed by preprocessor
1065 @item
1066 adjusts and removes extra whitespace. It leaves one space or tab before
1067 the keywords on a line, and turns any other whitespace on the line into
1068 a single space.
1069
1070 @cindex comments, removed by preprocessor
1071 @item
1072 removes all comments, replacing them with a single space, or an
1073 appropriate number of newlines.
1074
1075 @cindex constants, converted by preprocessor
1076 @item
1077 converts character constants into the appropriate numeric values.
1078 @end itemize
1079
1080 It does not do macro processing, include file handling, or
1081 anything else you may get from your C compiler's preprocessor. You can
1082 do include file processing with the @code{.include} directive
1083 (@pxref{Include,,@code{.include}}). You can use the @sc{gnu} C compiler driver
1084 to get other ``CPP'' style preprocessing, by giving the input file a
1085 @samp{.S} suffix. @xref{Overall Options,, Options Controlling the Kind of
1086 Output, gcc.info, Using GNU CC}.
1087
1088 Excess whitespace, comments, and character constants
1089 cannot be used in the portions of the input text that are not
1090 preprocessed.
1091
1092 @cindex turning preprocessing on and off
1093 @cindex preprocessing, turning on and off
1094 @kindex #NO_APP
1095 @kindex #APP
1096 If the first line of an input file is @code{#NO_APP} or if you use the
1097 @samp{-f} option, whitespace and comments are not removed from the input file.
1098 Within an input file, you can ask for whitespace and comment removal in
1099 specific portions of the by putting a line that says @code{#APP} before the
1100 text that may contain whitespace or comments, and putting a line that says
1101 @code{#NO_APP} after this text. This feature is mainly intend to support
1102 @code{asm} statements in compilers whose output is otherwise free of comments
1103 and whitespace.
1104
1105 @node Whitespace
1106 @section Whitespace
1107
1108 @cindex whitespace
1109 @dfn{Whitespace} is one or more blanks or tabs, in any order.
1110 Whitespace is used to separate symbols, and to make programs neater for
1111 people to read. Unless within character constants
1112 (@pxref{Characters,,Character Constants}), any whitespace means the same
1113 as exactly one space.
1114
1115 @node Comments
1116 @section Comments
1117
1118 @cindex comments
1119 There are two ways of rendering comments to @code{@value{AS}}. In both
1120 cases the comment is equivalent to one space.
1121
1122 Anything from @samp{/*} through the next @samp{*/} is a comment.
1123 This means you may not nest these comments.
1124
1125 @smallexample
1126 /*
1127 The only way to include a newline ('\n') in a comment
1128 is to use this sort of comment.
1129 */
1130
1131 /* This sort of comment does not nest. */
1132 @end smallexample
1133
1134 @cindex line comment character
1135 Anything from the @dfn{line comment} character to the next newline
1136 is considered a comment and is ignored. The line comment character is
1137 @ifset VAX
1138 @samp{#} on the Vax;
1139 @end ifset
1140 @ifset I960
1141 @samp{#} on the i960;
1142 @end ifset
1143 @ifset SPARC
1144 @samp{!} on the SPARC;
1145 @end ifset
1146 @ifset M680X0
1147 @samp{|} on the 680x0;
1148 @end ifset
1149 @ifset A29K
1150 @samp{;} for the AMD 29K family;
1151 @end ifset
1152 @ifset H8/300
1153 @samp{;} for the H8/300 family;
1154 @end ifset
1155 @ifset H8/500
1156 @samp{!} for the H8/500 family;
1157 @end ifset
1158 @ifset HPPA
1159 @samp{;} for the HPPA;
1160 @end ifset
1161 @ifset SH
1162 @samp{!} for the Hitachi SH;
1163 @end ifset
1164 @ifset Z8000
1165 @samp{!} for the Z8000;
1166 @end ifset
1167 see @ref{Machine Dependencies}. @refill
1168 @c FIXME What about i386, m88k, i860?
1169
1170 @ifset GENERIC
1171 On some machines there are two different line comment characters. One
1172 character only begins a comment if it is the first non-whitespace character on
1173 a line, while the other always begins a comment.
1174 @end ifset
1175
1176 @kindex #
1177 @cindex lines starting with @code{#}
1178 @cindex logical line numbers
1179 To be compatible with past assemblers, lines that begin with @samp{#} have a
1180 special interpretation. Following the @samp{#} should be an absolute
1181 expression (@pxref{Expressions}): the logical line number of the @emph{next}
1182 line. Then a string (@pxref{Strings,, Strings}) is allowed: if present it is a
1183 new logical file name. The rest of the line, if any, should be whitespace.
1184
1185 If the first non-whitespace characters on the line are not numeric,
1186 the line is ignored. (Just like a comment.)
1187
1188 @smallexample
1189 # This is an ordinary comment.
1190 # 42-6 "new_file_name" # New logical file name
1191 # This is logical line # 36.
1192 @end smallexample
1193 This feature is deprecated, and may disappear from future versions
1194 of @code{@value{AS}}.
1195
1196 @node Symbol Intro
1197 @section Symbols
1198
1199 @cindex characters used in symbols
1200 @ifclear SPECIAL-SYMS
1201 A @dfn{symbol} is one or more characters chosen from the set of all
1202 letters (both upper and lower case), digits and the three characters
1203 @samp{_.$}.
1204 @end ifclear
1205 @ifset SPECIAL-SYMS
1206 @ifclear GENERIC
1207 @ifset H8
1208 A @dfn{symbol} is one or more characters chosen from the set of all
1209 letters (both upper and lower case), digits and the three characters
1210 @samp{._$}. (Save that, on the H8/300 only, you may not use @samp{$} in
1211 symbol names.)
1212 @end ifset
1213 @end ifclear
1214 @end ifset
1215 @ifset GENERIC
1216 On most machines, you can also use @code{$} in symbol names; exceptions
1217 are noted in @ref{Machine Dependencies}.
1218 @end ifset
1219 No symbol may begin with a digit. Case is significant.
1220 There is no length limit: all characters are significant. Symbols are
1221 delimited by characters not in that set, or by the beginning of a file
1222 (since the source program must end with a newline, the end of a file is
1223 not a possible symbol delimiter). @xref{Symbols}.
1224 @cindex length of symbols
1225
1226 @node Statements
1227 @section Statements
1228
1229 @cindex statements, structure of
1230 @cindex line separator character
1231 @cindex statement separator character
1232 @ifclear GENERIC
1233 @ifclear abnormal-separator
1234 A @dfn{statement} ends at a newline character (@samp{\n}) or at a
1235 semicolon (@samp{;}). The newline or semicolon is considered part of
1236 the preceding statement. Newlines and semicolons within character
1237 constants are an exception: they do not end statements.
1238 @end ifclear
1239 @ifset abnormal-separator
1240 @ifset A29K
1241 A @dfn{statement} ends at a newline character (@samp{\n}) or an ``at''
1242 sign (@samp{@@}). The newline or at sign is considered part of the
1243 preceding statement. Newlines and at signs within character constants
1244 are an exception: they do not end statements.
1245 @end ifset
1246 @ifset HPPA
1247 A @dfn{statement} ends at a newline character (@samp{\n}) or an exclamation
1248 point (@samp{!}). The newline or exclamation point is considered part of the
1249 preceding statement. Newlines and exclamation points within character
1250 constants are an exception: they do not end statements.
1251 @end ifset
1252 @ifset H8
1253 A @dfn{statement} ends at a newline character (@samp{\n}); or (for the
1254 H8/300) a dollar sign (@samp{$}); or (for the
1255 Hitachi-SH or the
1256 H8/500) a semicolon
1257 (@samp{;}). The newline or separator character is considered part of
1258 the preceding statement. Newlines and separators within character
1259 constants are an exception: they do not end statements.
1260 @end ifset
1261 @end ifset
1262 @end ifclear
1263 @ifset GENERIC
1264 A @dfn{statement} ends at a newline character (@samp{\n}) or line
1265 separator character. (The line separator is usually @samp{;}, unless
1266 this conflicts with the comment character; @pxref{Machine Dependencies}.) The
1267 newline or separator character is considered part of the preceding
1268 statement. Newlines and separators within character constants are an
1269 exception: they do not end statements.
1270 @end ifset
1271
1272 @cindex newline, required at file end
1273 @cindex EOF, newline must precede
1274 It is an error to end any statement with end-of-file: the last
1275 character of any input file should be a newline.@refill
1276
1277 @cindex continuing statements
1278 @cindex multi-line statements
1279 @cindex statement on multiple lines
1280 You may write a statement on more than one line if you put a
1281 backslash (@kbd{\}) immediately in front of any newlines within the
1282 statement. When @code{@value{AS}} reads a backslashed newline both
1283 characters are ignored. You can even put backslashed newlines in
1284 the middle of symbol names without changing the meaning of your
1285 source program.
1286
1287 An empty statement is allowed, and may include whitespace. It is ignored.
1288
1289 @cindex instructions and directives
1290 @cindex directives and instructions
1291 @c "key symbol" is not used elsewhere in the document; seems pedantic to
1292 @c @defn{} it in that case, as was done previously... pesch@cygnus.com,
1293 @c 13feb91.
1294 A statement begins with zero or more labels, optionally followed by a
1295 key symbol which determines what kind of statement it is. The key
1296 symbol determines the syntax of the rest of the statement. If the
1297 symbol begins with a dot @samp{.} then the statement is an assembler
1298 directive: typically valid for any computer. If the symbol begins with
1299 a letter the statement is an assembly language @dfn{instruction}: it
1300 assembles into a machine language instruction.
1301 @ifset GENERIC
1302 Different versions of @code{@value{AS}} for different computers
1303 recognize different instructions. In fact, the same symbol may
1304 represent a different instruction in a different computer's assembly
1305 language.@refill
1306 @end ifset
1307
1308 @cindex @code{:} (label)
1309 @cindex label (@code{:})
1310 A label is a symbol immediately followed by a colon (@code{:}).
1311 Whitespace before a label or after a colon is permitted, but you may not
1312 have whitespace between a label's symbol and its colon. @xref{Labels}.
1313
1314 @ifset HPPA
1315 For HPPA targets, labels need not be immediately followed by a colon, but
1316 the definition of a label must begin in column zero. This also implies that
1317 only one label may be defined on each line.
1318 @end ifset
1319
1320 @smallexample
1321 label: .directive followed by something
1322 another_label: # This is an empty statement.
1323 instruction operand_1, operand_2, @dots{}
1324 @end smallexample
1325
1326 @node Constants
1327 @section Constants
1328
1329 @cindex constants
1330 A constant is a number, written so that its value is known by
1331 inspection, without knowing any context. Like this:
1332 @smallexample
1333 @group
1334 .byte 74, 0112, 092, 0x4A, 0X4a, 'J, '\J # All the same value.
1335 .ascii "Ring the bell\7" # A string constant.
1336 .octa 0x123456789abcdef0123456789ABCDEF0 # A bignum.
1337 .float 0f-314159265358979323846264338327\
1338 95028841971.693993751E-40 # - pi, a flonum.
1339 @end group
1340 @end smallexample
1341
1342 @menu
1343 * Characters:: Character Constants
1344 * Numbers:: Number Constants
1345 @end menu
1346
1347 @node Characters
1348 @subsection Character Constants
1349
1350 @cindex character constants
1351 @cindex constants, character
1352 There are two kinds of character constants. A @dfn{character} stands
1353 for one character in one byte and its value may be used in
1354 numeric expressions. String constants (properly called string
1355 @emph{literals}) are potentially many bytes and their values may not be
1356 used in arithmetic expressions.
1357
1358 @menu
1359 * Strings:: Strings
1360 * Chars:: Characters
1361 @end menu
1362
1363 @node Strings
1364 @subsubsection Strings
1365
1366 @cindex string constants
1367 @cindex constants, string
1368 A @dfn{string} is written between double-quotes. It may contain
1369 double-quotes or null characters. The way to get special characters
1370 into a string is to @dfn{escape} these characters: precede them with
1371 a backslash @samp{\} character. For example @samp{\\} represents
1372 one backslash: the first @code{\} is an escape which tells
1373 @code{@value{AS}} to interpret the second character literally as a backslash
1374 (which prevents @code{@value{AS}} from recognizing the second @code{\} as an
1375 escape character). The complete list of escapes follows.
1376
1377 @cindex escape codes, character
1378 @cindex character escape codes
1379 @table @kbd
1380 @c @item \a
1381 @c Mnemonic for ACKnowledge; for ASCII this is octal code 007.
1382 @c
1383 @item \b
1384 @cindex @code{\b} (backspace character)
1385 @cindex backspace (@code{\b})
1386 Mnemonic for backspace; for ASCII this is octal code 010.
1387
1388 @c @item \e
1389 @c Mnemonic for EOText; for ASCII this is octal code 004.
1390 @c
1391 @item \f
1392 @cindex @code{\f} (formfeed character)
1393 @cindex formfeed (@code{\f})
1394 Mnemonic for FormFeed; for ASCII this is octal code 014.
1395
1396 @item \n
1397 @cindex @code{\n} (newline character)
1398 @cindex newline (@code{\n})
1399 Mnemonic for newline; for ASCII this is octal code 012.
1400
1401 @c @item \p
1402 @c Mnemonic for prefix; for ASCII this is octal code 033, usually known as @code{escape}.
1403 @c
1404 @item \r
1405 @cindex @code{\r} (carriage return character)
1406 @cindex carriage return (@code{\r})
1407 Mnemonic for carriage-Return; for ASCII this is octal code 015.
1408
1409 @c @item \s
1410 @c Mnemonic for space; for ASCII this is octal code 040. Included for compliance with
1411 @c other assemblers.
1412 @c
1413 @item \t
1414 @cindex @code{\t} (tab)
1415 @cindex tab (@code{\t})
1416 Mnemonic for horizontal Tab; for ASCII this is octal code 011.
1417
1418 @c @item \v
1419 @c Mnemonic for Vertical tab; for ASCII this is octal code 013.
1420 @c @item \x @var{digit} @var{digit} @var{digit}
1421 @c A hexadecimal character code. The numeric code is 3 hexadecimal digits.
1422 @c
1423 @item \ @var{digit} @var{digit} @var{digit}
1424 @cindex @code{\@var{ddd}} (octal character code)
1425 @cindex octal character code (@code{\@var{ddd}})
1426 An octal character code. The numeric code is 3 octal digits.
1427 For compatibility with other Unix systems, 8 and 9 are accepted as digits:
1428 for example, @code{\008} has the value 010, and @code{\009} the value 011.
1429
1430 @ifset HPPA
1431 @item \@code{x} @var{hex-digit} @var{hex-digit}
1432 @cindex @code{\@var{xdd}} (hex character code)
1433 @cindex hex character code (@code{\@var{xdd}})
1434 A hex character code. The numeric code is 2 hexadecimal digits. Either
1435 upper or lower case @code{x} works.
1436 @end ifset
1437
1438 @item \\
1439 @cindex @code{\\} (@samp{\} character)
1440 @cindex backslash (@code{\\})
1441 Represents one @samp{\} character.
1442
1443 @c @item \'
1444 @c Represents one @samp{'} (accent acute) character.
1445 @c This is needed in single character literals
1446 @c (@xref{Characters,,Character Constants}.) to represent
1447 @c a @samp{'}.
1448 @c
1449 @item \"
1450 @cindex @code{\"} (doublequote character)
1451 @cindex doublequote (@code{\"})
1452 Represents one @samp{"} character. Needed in strings to represent
1453 this character, because an unescaped @samp{"} would end the string.
1454
1455 @item \ @var{anything-else}
1456 Any other character when escaped by @kbd{\} gives a warning, but
1457 assembles as if the @samp{\} was not present. The idea is that if
1458 you used an escape sequence you clearly didn't want the literal
1459 interpretation of the following character. However @code{@value{AS}} has no
1460 other interpretation, so @code{@value{AS}} knows it is giving you the wrong
1461 code and warns you of the fact.
1462 @end table
1463
1464 Which characters are escapable, and what those escapes represent,
1465 varies widely among assemblers. The current set is what we think
1466 the BSD 4.2 assembler recognizes, and is a subset of what most C
1467 compilers recognize. If you are in doubt, do not use an escape
1468 sequence.
1469
1470 @node Chars
1471 @subsubsection Characters
1472
1473 @cindex single character constant
1474 @cindex character, single
1475 @cindex constant, single character
1476 A single character may be written as a single quote immediately
1477 followed by that character. The same escapes apply to characters as
1478 to strings. So if you want to write the character backslash, you
1479 must write @kbd{'\\} where the first @code{\} escapes the second
1480 @code{\}. As you can see, the quote is an acute accent, not a
1481 grave accent. A newline
1482 @ifclear GENERIC
1483 @ifclear abnormal-separator
1484 (or semicolon @samp{;})
1485 @end ifclear
1486 @ifset abnormal-separator
1487 @ifset A29K
1488 (or at sign @samp{@@})
1489 @end ifset
1490 @ifset H8
1491 (or dollar sign @samp{$}, for the H8/300; or semicolon @samp{;} for the
1492 Hitachi SH or
1493 H8/500)
1494 @end ifset
1495 @end ifset
1496 @end ifclear
1497 immediately following an acute accent is taken as a literal character
1498 and does not count as the end of a statement. The value of a character
1499 constant in a numeric expression is the machine's byte-wide code for
1500 that character. @code{@value{AS}} assumes your character code is ASCII:
1501 @kbd{'A} means 65, @kbd{'B} means 66, and so on. @refill
1502
1503 @node Numbers
1504 @subsection Number Constants
1505
1506 @cindex constants, number
1507 @cindex number constants
1508 @code{@value{AS}} distinguishes three kinds of numbers according to how they
1509 are stored in the target machine. @emph{Integers} are numbers that
1510 would fit into an @code{int} in the C language. @emph{Bignums} are
1511 integers, but they are stored in more than 32 bits. @emph{Flonums}
1512 are floating point numbers, described below.
1513
1514 @menu
1515 * Integers:: Integers
1516 * Bignums:: Bignums
1517 * Flonums:: Flonums
1518 @ifclear GENERIC
1519 @ifset I960
1520 * Bit Fields:: Bit Fields
1521 @end ifset
1522 @end ifclear
1523 @end menu
1524
1525 @node Integers
1526 @subsubsection Integers
1527 @cindex integers
1528 @cindex constants, integer
1529
1530 @cindex binary integers
1531 @cindex integers, binary
1532 A binary integer is @samp{0b} or @samp{0B} followed by zero or more of
1533 the binary digits @samp{01}.
1534
1535 @cindex octal integers
1536 @cindex integers, octal
1537 An octal integer is @samp{0} followed by zero or more of the octal
1538 digits (@samp{01234567}).
1539
1540 @cindex decimal integers
1541 @cindex integers, decimal
1542 A decimal integer starts with a non-zero digit followed by zero or
1543 more digits (@samp{0123456789}).
1544
1545 @cindex hexadecimal integers
1546 @cindex integers, hexadecimal
1547 A hexadecimal integer is @samp{0x} or @samp{0X} followed by one or
1548 more hexadecimal digits chosen from @samp{0123456789abcdefABCDEF}.
1549
1550 Integers have the usual values. To denote a negative integer, use
1551 the prefix operator @samp{-} discussed under expressions
1552 (@pxref{Prefix Ops,,Prefix Operators}).
1553
1554 @node Bignums
1555 @subsubsection Bignums
1556
1557 @cindex bignums
1558 @cindex constants, bignum
1559 A @dfn{bignum} has the same syntax and semantics as an integer
1560 except that the number (or its negative) takes more than 32 bits to
1561 represent in binary. The distinction is made because in some places
1562 integers are permitted while bignums are not.
1563
1564 @node Flonums
1565 @subsubsection Flonums
1566 @cindex flonums
1567 @cindex floating point numbers
1568 @cindex constants, floating point
1569
1570 @cindex precision, floating point
1571 A @dfn{flonum} represents a floating point number. The translation is
1572 indirect: a decimal floating point number from the text is converted by
1573 @code{@value{AS}} to a generic binary floating point number of more than
1574 sufficient precision. This generic floating point number is converted
1575 to a particular computer's floating point format (or formats) by a
1576 portion of @code{@value{AS}} specialized to that computer.
1577
1578 A flonum is written by writing (in order)
1579 @itemize @bullet
1580 @item
1581 The digit @samp{0}.
1582 @ifset HPPA
1583 (@samp{0} is optional on the HPPA.)
1584 @end ifset
1585
1586 @item
1587 A letter, to tell @code{@value{AS}} the rest of the number is a flonum.
1588 @ifset GENERIC
1589 @kbd{e} is recommended. Case is not important.
1590 @ignore
1591 @c FIXME: verify if flonum syntax really this vague for most cases
1592 (Any otherwise illegal letter works here, but that might be changed. Vax BSD
1593 4.2 assembler seems to allow any of @samp{defghDEFGH}.)
1594 @end ignore
1595
1596 On the H8/300, H8/500,
1597 Hitachi SH,
1598 and AMD 29K architectures, the letter must be
1599 one of the letters @samp{DFPRSX} (in upper or lower case).
1600
1601 On the Intel 960 architecture, the letter must be
1602 one of the letters @samp{DFT} (in upper or lower case).
1603
1604 On the HPPA architecture, the letter must be @samp{E} (upper case only).
1605 @end ifset
1606 @ifclear GENERIC
1607 @ifset A29K
1608 One of the letters @samp{DFPRSX} (in upper or lower case).
1609 @end ifset
1610 @ifset H8
1611 One of the letters @samp{DFPRSX} (in upper or lower case).
1612 @end ifset
1613 @ifset I960
1614 One of the letters @samp{DFT} (in upper or lower case).
1615 @end ifset
1616 @ifset HPPA
1617 The letter @samp{E} (upper case only).
1618 @end ifset
1619 @end ifclear
1620
1621 @item
1622 An optional sign: either @samp{+} or @samp{-}.
1623
1624 @item
1625 An optional @dfn{integer part}: zero or more decimal digits.
1626
1627 @item
1628 An optional @dfn{fractional part}: @samp{.} followed by zero
1629 or more decimal digits.
1630
1631 @item
1632 An optional exponent, consisting of:
1633
1634 @itemize @bullet
1635 @item
1636 An @samp{E} or @samp{e}.
1637 @c I can't find a config where "EXP_CHARS" is other than 'eE', but in
1638 @c principle this can perfectly well be different on different targets.
1639 @item
1640 Optional sign: either @samp{+} or @samp{-}.
1641 @item
1642 One or more decimal digits.
1643 @end itemize
1644
1645 @end itemize
1646
1647 At least one of the integer part or the fractional part must be
1648 present. The floating point number has the usual base-10 value.
1649
1650 @code{@value{AS}} does all processing using integers. Flonums are computed
1651 independently of any floating point hardware in the computer running
1652 @code{@value{AS}}.
1653
1654 @ifclear GENERIC
1655 @ifset I960
1656 @c Bit fields are written as a general facility but are also controlled
1657 @c by a conditional-compilation flag---which is as of now (21mar91)
1658 @c turned on only by the i960 config of GAS.
1659 @node Bit Fields
1660 @subsubsection Bit Fields
1661
1662 @cindex bit fields
1663 @cindex constants, bit field
1664 You can also define numeric constants as @dfn{bit fields}.
1665 specify two numbers separated by a colon---
1666 @example
1667 @var{mask}:@var{value}
1668 @end example
1669 @noindent
1670 @code{@value{AS}} applies a bitwise @sc{and} between @var{mask} and
1671 @var{value}.
1672
1673 The resulting number is then packed
1674 @ifset GENERIC
1675 @c this conditional paren in case bit fields turned on elsewhere than 960
1676 (in host-dependent byte order)
1677 @end ifset
1678 into a field whose width depends on which assembler directive has the
1679 bit-field as its argument. Overflow (a result from the bitwise and
1680 requiring more binary digits to represent) is not an error; instead,
1681 more constants are generated, of the specified width, beginning with the
1682 least significant digits.@refill
1683
1684 The directives @code{.byte}, @code{.hword}, @code{.int}, @code{.long},
1685 @code{.short}, and @code{.word} accept bit-field arguments.
1686 @end ifset
1687 @end ifclear
1688
1689 @node Sections
1690 @chapter Sections and Relocation
1691 @cindex sections
1692 @cindex relocation
1693
1694 @menu
1695 * Secs Background:: Background
1696 * Ld Sections:: @value{LD} Sections
1697 * As Sections:: @value{AS} Internal Sections
1698 * Sub-Sections:: Sub-Sections
1699 * bss:: bss Section
1700 @end menu
1701
1702 @node Secs Background
1703 @section Background
1704
1705 Roughly, a section is a range of addresses, with no gaps; all data
1706 ``in'' those addresses is treated the same for some particular purpose.
1707 For example there may be a ``read only'' section.
1708
1709 @cindex linker, and assembler
1710 @cindex assembler, and linker
1711 The linker @code{@value{LD}} reads many object files (partial programs) and
1712 combines their contents to form a runnable program. When @code{@value{AS}}
1713 emits an object file, the partial program is assumed to start at address 0.
1714 @code{@value{LD}} assigns the final addresses for the partial program, so that
1715 different partial programs do not overlap. This is actually an
1716 oversimplification, but it suffices to explain how @code{@value{AS}} uses
1717 sections.
1718
1719 @code{@value{LD}} moves blocks of bytes of your program to their run-time
1720 addresses. These blocks slide to their run-time addresses as rigid
1721 units; their length does not change and neither does the order of bytes
1722 within them. Such a rigid unit is called a @emph{section}. Assigning
1723 run-time addresses to sections is called @dfn{relocation}. It includes
1724 the task of adjusting mentions of object-file addresses so they refer to
1725 the proper run-time addresses.
1726 @ifset H8
1727 For the H8/300 and H8/500,
1728 and for the Hitachi SH,
1729 @code{@value{AS}} pads sections if needed to
1730 ensure they end on a word (sixteen bit) boundary.
1731 @end ifset
1732
1733 @cindex standard @code{@value{AS}} sections
1734 An object file written by @code{@value{AS}} has at least three sections, any
1735 of which may be empty. These are named @dfn{text}, @dfn{data} and
1736 @dfn{bss} sections.
1737
1738 @ifset COFF
1739 @ifset GENERIC
1740 When it generates COFF output,
1741 @end ifset
1742 @code{@value{AS}} can also generate whatever other named sections you specify
1743 using the @samp{.section} directive (@pxref{Section,,@code{.section}}).
1744 If you do not use any directives that place output in the @samp{.text}
1745 or @samp{.data} sections, these sections still exist, but are empty.
1746 @end ifset
1747
1748 @ifset HPPA
1749 @ifset GENERIC
1750 When @code{@value{AS}} generates SOM or ELF output for the HPPA,
1751 @end ifset
1752 @code{@value{AS}} can also generate whatever other named sections you
1753 specify using the @samp{.space} and @samp{.subspace} directives. See
1754 @cite{HP9000 Series 800 Assembly Language Reference Manual}
1755 (HP 92432-90001) for details on the @samp{.space} and @samp{.subspace}
1756 assembler directives.
1757
1758 @ifset SOM
1759 Additionally, @code{@value{AS}} uses different names for the standard
1760 text, data, and bss sections when generating SOM output. Program text
1761 is placed into the @samp{$CODE$} section, data into @samp{$DATA$}, and
1762 BSS into @samp{$BSS$}.
1763 @end ifset
1764 @end ifset
1765
1766 Within the object file, the text section starts at address @code{0}, the
1767 data section follows, and the bss section follows the data section.
1768
1769 @ifset HPPA
1770 When generating either SOM or ELF output files on the HPPA, the text
1771 section starts at address @code{0}, the data section at address
1772 @code{0x4000000}, and the bss section follows the data section.
1773 @end ifset
1774
1775 To let @code{@value{LD}} know which data changes when the sections are
1776 relocated, and how to change that data, @code{@value{AS}} also writes to the
1777 object file details of the relocation needed. To perform relocation
1778 @code{@value{LD}} must know, each time an address in the object
1779 file is mentioned:
1780 @itemize @bullet
1781 @item
1782 Where in the object file is the beginning of this reference to
1783 an address?
1784 @item
1785 How long (in bytes) is this reference?
1786 @item
1787 Which section does the address refer to? What is the numeric value of
1788 @display
1789 (@var{address}) @minus{} (@var{start-address of section})?
1790 @end display
1791 @item
1792 Is the reference to an address ``Program-Counter relative''?
1793 @end itemize
1794
1795 @cindex addresses, format of
1796 @cindex section-relative addressing
1797 In fact, every address @code{@value{AS}} ever uses is expressed as
1798 @display
1799 (@var{section}) + (@var{offset into section})
1800 @end display
1801 @noindent
1802 Further, most expressions @code{@value{AS}} computes have this section-relative
1803 nature.
1804 @ifset SOM
1805 (For some object formats, such as SOM for the HPPA, some expressions are
1806 symbol-relative instead.)
1807 @end ifset
1808
1809 In this manual we use the notation @{@var{secname} @var{N}@} to mean ``offset
1810 @var{N} into section @var{secname}.''
1811
1812 Apart from text, data and bss sections you need to know about the
1813 @dfn{absolute} section. When @code{@value{LD}} mixes partial programs,
1814 addresses in the absolute section remain unchanged. For example, address
1815 @code{@{absolute 0@}} is ``relocated'' to run-time address 0 by
1816 @code{@value{LD}}. Although the linker never arranges two partial programs'
1817 data sections with overlapping addresses after linking, @emph{by definition}
1818 their absolute sections must overlap. Address @code{@{absolute@ 239@}} in one
1819 part of a program is always the same address when the program is running as
1820 address @code{@{absolute@ 239@}} in any other part of the program.
1821
1822 The idea of sections is extended to the @dfn{undefined} section. Any
1823 address whose section is unknown at assembly time is by definition
1824 rendered @{undefined @var{U}@}---where @var{U} is filled in later.
1825 Since numbers are always defined, the only way to generate an undefined
1826 address is to mention an undefined symbol. A reference to a named
1827 common block would be such a symbol: its value is unknown at assembly
1828 time so it has section @emph{undefined}.
1829
1830 By analogy the word @emph{section} is used to describe groups of sections in
1831 the linked program. @code{@value{LD}} puts all partial programs' text
1832 sections in contiguous addresses in the linked program. It is
1833 customary to refer to the @emph{text section} of a program, meaning all
1834 the addresses of all partial programs' text sections. Likewise for
1835 data and bss sections.
1836
1837 Some sections are manipulated by @code{@value{LD}}; others are invented for
1838 use of @code{@value{AS}} and have no meaning except during assembly.
1839
1840 @node Ld Sections
1841 @section @value{LD} Sections
1842 @code{@value{LD}} deals with just four kinds of sections, summarized below.
1843
1844 @table @strong
1845
1846 @ifset COFF
1847 @cindex named sections
1848 @cindex sections, named
1849 @item named sections
1850 @end ifset
1851 @ifset aout-bout
1852 @cindex text section
1853 @cindex data section
1854 @itemx text section
1855 @itemx data section
1856 @end ifset
1857 These sections hold your program. @code{@value{AS}} and @code{@value{LD}} treat them as
1858 separate but equal sections. Anything you can say of one section is
1859 true another.
1860 @ifset aout-bout
1861 When the program is running, however, it is
1862 customary for the text section to be unalterable. The
1863 text section is often shared among processes: it contains
1864 instructions, constants and the like. The data section of a running
1865 program is usually alterable: for example, C variables would be stored
1866 in the data section.
1867 @end ifset
1868
1869 @cindex bss section
1870 @item bss section
1871 This section contains zeroed bytes when your program begins running. It
1872 is used to hold unitialized variables or common storage. The length of
1873 each partial program's bss section is important, but because it starts
1874 out containing zeroed bytes there is no need to store explicit zero
1875 bytes in the object file. The bss section was invented to eliminate
1876 those explicit zeros from object files.
1877
1878 @cindex absolute section
1879 @item absolute section
1880 Address 0 of this section is always ``relocated'' to runtime address 0.
1881 This is useful if you want to refer to an address that @code{@value{LD}} must
1882 not change when relocating. In this sense we speak of absolute
1883 addresses being ``unrelocatable'': they do not change during relocation.
1884
1885 @cindex undefined section
1886 @item undefined section
1887 This ``section'' is a catch-all for address references to objects not in
1888 the preceding sections.
1889 @c FIXME: ref to some other doc on obj-file formats could go here.
1890 @end table
1891
1892 @cindex relocation example
1893 An idealized example of three relocatable sections follows.
1894 @ifset COFF
1895 The example uses the traditional section names @samp{.text} and @samp{.data}.
1896 @end ifset
1897 Memory addresses are on the horizontal axis.
1898
1899 @c TEXI2ROFF-KILL
1900 @ifinfo
1901 @c END TEXI2ROFF-KILL
1902 @smallexample
1903 +-----+----+--+
1904 partial program # 1: |ttttt|dddd|00|
1905 +-----+----+--+
1906
1907 text data bss
1908 seg. seg. seg.
1909
1910 +---+---+---+
1911 partial program # 2: |TTT|DDD|000|
1912 +---+---+---+
1913
1914 +--+---+-----+--+----+---+-----+~~
1915 linked program: | |TTT|ttttt| |dddd|DDD|00000|
1916 +--+---+-----+--+----+---+-----+~~
1917
1918 addresses: 0 @dots{}
1919 @end smallexample
1920 @c TEXI2ROFF-KILL
1921 @end ifinfo
1922 @need 5000
1923 @tex
1924
1925 \line{\it Partial program \#1: \hfil}
1926 \line{\ibox{2.5cm}{\tt text}\ibox{2cm}{\tt data}\ibox{1cm}{\tt bss}\hfil}
1927 \line{\boxit{2.5cm}{\tt ttttt}\boxit{2cm}{\tt dddd}\boxit{1cm}{\tt 00}\hfil}
1928
1929 \line{\it Partial program \#2: \hfil}
1930 \line{\ibox{1cm}{\tt text}\ibox{1.5cm}{\tt data}\ibox{1cm}{\tt bss}\hfil}
1931 \line{\boxit{1cm}{\tt TTT}\boxit{1.5cm}{\tt DDDD}\boxit{1cm}{\tt 000}\hfil}
1932
1933 \line{\it linked program: \hfil}
1934 \line{\ibox{.5cm}{}\ibox{1cm}{\tt text}\ibox{2.5cm}{}\ibox{.75cm}{}\ibox{2cm}{\tt data}\ibox{1.5cm}{}\ibox{2cm}{\tt bss}\hfil}
1935 \line{\boxit{.5cm}{}\boxit{1cm}{\tt TTT}\boxit{2.5cm}{\tt
1936 ttttt}\boxit{.75cm}{}\boxit{2cm}{\tt dddd}\boxit{1.5cm}{\tt
1937 DDDD}\boxit{2cm}{\tt 00000}\ \dots\hfil}
1938
1939 \line{\it addresses: \hfil}
1940 \line{0\dots\hfil}
1941
1942 @end tex
1943 @c END TEXI2ROFF-KILL
1944
1945 @node As Sections
1946 @section @value{AS} Internal Sections
1947
1948 @cindex internal @code{@value{AS}} sections
1949 @cindex sections in messages, internal
1950 These sections are meant only for the internal use of @code{@value{AS}}. They
1951 have no meaning at run-time. You do not really need to know about these
1952 sections for most purposes; but they can be mentioned in @code{@value{AS}}
1953 warning messages, so it might be helpful to have an idea of their
1954 meanings to @code{@value{AS}}. These sections are used to permit the
1955 value of every expression in your assembly language program to be a
1956 section-relative address.
1957
1958 @table @b
1959 @item ASSEMBLER-INTERNAL-LOGIC-ERROR!
1960 @cindex assembler internal logic error
1961 An internal assembler logic error has been found. This means there is a
1962 bug in the assembler.
1963
1964 @item expr section
1965 @cindex expr (internal section)
1966 The assembler stores complex expression internally as combinations of
1967 symbols. When it needs to represent an expression as a symbol, it puts
1968 it in the expr section.
1969 @c FIXME item debug
1970 @c FIXME item transfer[t] vector preload
1971 @c FIXME item transfer[t] vector postload
1972 @c FIXME item register
1973 @end table
1974
1975 @node Sub-Sections
1976 @section Sub-Sections
1977
1978 @cindex numbered subsections
1979 @cindex grouping data
1980 @ifset aout-bout
1981 Assembled bytes
1982 @ifset COFF
1983 conventionally
1984 @end ifset
1985 fall into two sections: text and data.
1986 @end ifset
1987 You may have separate groups of
1988 @ifset GENERIC
1989 data in named sections
1990 @end ifset
1991 @ifclear GENERIC
1992 @ifclear aout-bout
1993 data in named sections
1994 @end ifclear
1995 @ifset aout-bout
1996 text or data
1997 @end ifset
1998 @end ifclear
1999 that you want to end up near to each other in the object file, even though they
2000 are not contiguous in the assembler source. @code{@value{AS}} allows you to
2001 use @dfn{subsections} for this purpose. Within each section, there can be
2002 numbered subsections with values from 0 to 8192. Objects assembled into the
2003 same subsection go into the object file together with other objects in the same
2004 subsection. For example, a compiler might want to store constants in the text
2005 section, but might not want to have them interspersed with the program being
2006 assembled. In this case, the compiler could issue a @samp{.text 0} before each
2007 section of code being output, and a @samp{.text 1} before each group of
2008 constants being output.
2009
2010 Subsections are optional. If you do not use subsections, everything
2011 goes in subsection number zero.
2012
2013 @ifset GENERIC
2014 Each subsection is zero-padded up to a multiple of four bytes.
2015 (Subsections may be padded a different amount on different flavors
2016 of @code{@value{AS}}.)
2017 @end ifset
2018 @ifclear GENERIC
2019 @ifset H8
2020 On the H8/300 and H8/500 platforms, each subsection is zero-padded to a word
2021 boundary (two bytes).
2022 The same is true on the Hitachi SH.
2023 @end ifset
2024 @ifset I960
2025 @c FIXME section padding (alignment)?
2026 @c Rich Pixley says padding here depends on target obj code format; that
2027 @c doesn't seem particularly useful to say without further elaboration,
2028 @c so for now I say nothing about it. If this is a generic BFD issue,
2029 @c these paragraphs might need to vanish from this manual, and be
2030 @c discussed in BFD chapter of binutils (or some such).
2031 @end ifset
2032 @ifset A29K
2033 On the AMD 29K family, no particular padding is added to section or
2034 subsection sizes; @value{AS} forces no alignment on this platform.
2035 @end ifset
2036 @end ifclear
2037
2038 Subsections appear in your object file in numeric order, lowest numbered
2039 to highest. (All this to be compatible with other people's assemblers.)
2040 The object file contains no representation of subsections; @code{@value{LD}} and
2041 other programs that manipulate object files see no trace of them.
2042 They just see all your text subsections as a text section, and all your
2043 data subsections as a data section.
2044
2045 To specify which subsection you want subsequent statements assembled
2046 into, use a numeric argument to specify it, in a @samp{.text
2047 @var{expression}} or a @samp{.data @var{expression}} statement.
2048 @ifset COFF
2049 @ifset GENERIC
2050 When generating COFF output, you
2051 @end ifset
2052 @ifclear GENERIC
2053 You
2054 @end ifclear
2055 can also use an extra subsection
2056 argument with arbitrary named sections: @samp{.section @var{name},
2057 @var{expression}}.
2058 @end ifset
2059 @var{Expression} should be an absolute expression.
2060 (@xref{Expressions}.) If you just say @samp{.text} then @samp{.text 0}
2061 is assumed. Likewise @samp{.data} means @samp{.data 0}. Assembly
2062 begins in @code{text 0}. For instance:
2063 @smallexample
2064 .text 0 # The default subsection is text 0 anyway.
2065 .ascii "This lives in the first text subsection. *"
2066 .text 1
2067 .ascii "But this lives in the second text subsection."
2068 .data 0
2069 .ascii "This lives in the data section,"
2070 .ascii "in the first data subsection."
2071 .text 0
2072 .ascii "This lives in the first text section,"
2073 .ascii "immediately following the asterisk (*)."
2074 @end smallexample
2075
2076 Each section has a @dfn{location counter} incremented by one for every byte
2077 assembled into that section. Because subsections are merely a convenience
2078 restricted to @code{@value{AS}} there is no concept of a subsection location
2079 counter. There is no way to directly manipulate a location counter---but the
2080 @code{.align} directive changes it, and any label definition captures its
2081 current value. The location counter of the section where statements are being
2082 assembled is said to be the @dfn{active} location counter.
2083
2084 @node bss
2085 @section bss Section
2086
2087 @cindex bss section
2088 @cindex common variable storage
2089 The bss section is used for local common variable storage.
2090 You may allocate address space in the bss section, but you may
2091 not dictate data to load into it before your program executes. When
2092 your program starts running, all the contents of the bss
2093 section are zeroed bytes.
2094
2095 Addresses in the bss section are allocated with special directives; you
2096 may not assemble anything directly into the bss section. Hence there
2097 are no bss subsections. @xref{Comm,,@code{.comm}},
2098 @pxref{Lcomm,,@code{.lcomm}}.
2099
2100 @node Symbols
2101 @chapter Symbols
2102
2103 @cindex symbols
2104 Symbols are a central concept: the programmer uses symbols to name
2105 things, the linker uses symbols to link, and the debugger uses symbols
2106 to debug.
2107
2108 @quotation
2109 @cindex debuggers, and symbol order
2110 @emph{Warning:} @code{@value{AS}} does not place symbols in the object file in
2111 the same order they were declared. This may break some debuggers.
2112 @end quotation
2113
2114 @menu
2115 * Labels:: Labels
2116 * Setting Symbols:: Giving Symbols Other Values
2117 * Symbol Names:: Symbol Names
2118 * Dot:: The Special Dot Symbol
2119 * Symbol Attributes:: Symbol Attributes
2120 @end menu
2121
2122 @node Labels
2123 @section Labels
2124
2125 @cindex labels
2126 A @dfn{label} is written as a symbol immediately followed by a colon
2127 @samp{:}. The symbol then represents the current value of the
2128 active location counter, and is, for example, a suitable instruction
2129 operand. You are warned if you use the same symbol to represent two
2130 different locations: the first definition overrides any other
2131 definitions.
2132
2133 @ifset HPPA
2134 On the HPPA, the usual form for a label need not be immediately followed by a
2135 colon, but instead must start in column zero. Only one label may be defined on
2136 a single line. To work around this, the HPPA version of @code{@value{AS}} also
2137 provides a special directive @code{.label} for defining labels more flexibly.
2138 @end ifset
2139
2140 @node Setting Symbols
2141 @section Giving Symbols Other Values
2142
2143 @cindex assigning values to symbols
2144 @cindex symbol values, assigning
2145 A symbol can be given an arbitrary value by writing a symbol, followed
2146 by an equals sign @samp{=}, followed by an expression
2147 (@pxref{Expressions}). This is equivalent to using the @code{.set}
2148 directive. @xref{Set,,@code{.set}}.
2149
2150 @node Symbol Names
2151 @section Symbol Names
2152
2153 @cindex symbol names
2154 @cindex names, symbol
2155 @ifclear SPECIAL-SYMS
2156 Symbol names begin with a letter or with one of @samp{._}. On most
2157 machines, you can also use @code{$} in symbol names; exceptions are
2158 noted in @ref{Machine Dependencies}. That character may be followed by any
2159 string of digits, letters, dollar signs (unless otherwise noted in
2160 @ref{Machine Dependencies}), and underscores.
2161 @end ifclear
2162 @ifset A29K
2163 For the AMD 29K family, @samp{?} is also allowed in the
2164 body of a symbol name, though not at its beginning.
2165 @end ifset
2166
2167 @ifset SPECIAL-SYMS
2168 @ifset H8
2169 Symbol names begin with a letter or with one of @samp{._}. On the
2170 Hitachi SH or the
2171 H8/500, you can also use @code{$} in symbol names. That character may
2172 be followed by any string of digits, letters, dollar signs (save on the
2173 H8/300), and underscores.
2174 @end ifset
2175 @end ifset
2176
2177 Case of letters is significant: @code{foo} is a different symbol name
2178 than @code{Foo}.
2179
2180 Each symbol has exactly one name. Each name in an assembly language program
2181 refers to exactly one symbol. You may use that symbol name any number of times
2182 in a program.
2183
2184 @subheading Local Symbol Names
2185
2186 @cindex local symbol names
2187 @cindex symbol names, local
2188 @cindex temporary symbol names
2189 @cindex symbol names, temporary
2190 Local symbols help compilers and programmers use names temporarily.
2191 There are ten local symbol names, which are re-used throughout the
2192 program. You may refer to them using the names @samp{0} @samp{1}
2193 @dots{} @samp{9}. To define a local symbol, write a label of the form
2194 @samp{@b{N}:} (where @b{N} represents any digit). To refer to the most
2195 recent previous definition of that symbol write @samp{@b{N}b}, using the
2196 same digit as when you defined the label. To refer to the next
2197 definition of a local label, write @samp{@b{N}f}---where @b{N} gives you
2198 a choice of 10 forward references. The @samp{b} stands for
2199 ``backwards'' and the @samp{f} stands for ``forwards''.
2200
2201 Local symbols are not emitted by the current @sc{gnu} C compiler.
2202
2203 There is no restriction on how you can use these labels, but
2204 remember that at any point in the assembly you can refer to at most
2205 10 prior local labels and to at most 10 forward local labels.
2206
2207 Local symbol names are only a notation device. They are immediately
2208 transformed into more conventional symbol names before the assembler
2209 uses them. The symbol names stored in the symbol table, appearing in
2210 error messages and optionally emitted to the object file have these
2211 parts:
2212
2213 @table @code
2214 @item L
2215 All local labels begin with @samp{L}. Normally both @code{@value{AS}} and
2216 @code{@value{LD}} forget symbols that start with @samp{L}. These labels are
2217 used for symbols you are never intended to see. If you use the
2218 @samp{-L} option then @code{@value{AS}} retains these symbols in the
2219 object file. If you also instruct @code{@value{LD}} to retain these symbols,
2220 you may use them in debugging.
2221
2222 @item @var{digit}
2223 If the label is written @samp{0:} then the digit is @samp{0}.
2224 If the label is written @samp{1:} then the digit is @samp{1}.
2225 And so on up through @samp{9:}.
2226
2227 @item @ctrl{A}
2228 This unusual character is included so you do not accidentally invent
2229 a symbol of the same name. The character has ASCII value
2230 @samp{\001}.
2231
2232 @item @emph{ordinal number}
2233 This is a serial number to keep the labels distinct. The first
2234 @samp{0:} gets the number @samp{1}; The 15th @samp{0:} gets the
2235 number @samp{15}; @emph{etc.}. Likewise for the other labels @samp{1:}
2236 through @samp{9:}.
2237 @end table
2238
2239 For instance, the first @code{1:} is named @code{L1@ctrl{A}1}, the 44th
2240 @code{3:} is named @code{L3@ctrl{A}44}.
2241
2242 @node Dot
2243 @section The Special Dot Symbol
2244
2245 @cindex dot (symbol)
2246 @cindex @code{.} (symbol)
2247 @cindex current address
2248 @cindex location counter
2249 The special symbol @samp{.} refers to the current address that
2250 @code{@value{AS}} is assembling into. Thus, the expression @samp{melvin:
2251 .long .} defines @code{melvin} to contain its own address.
2252 Assigning a value to @code{.} is treated the same as a @code{.org}
2253 directive. Thus, the expression @samp{.=.+4} is the same as saying
2254 @ifclear no-space-dir
2255 @samp{.space 4}.
2256 @end ifclear
2257 @ifset no-space-dir
2258 @ifset A29K
2259 @samp{.block 4}.
2260 @end ifset
2261 @end ifset
2262
2263 @node Symbol Attributes
2264 @section Symbol Attributes
2265
2266 @cindex symbol attributes
2267 @cindex attributes, symbol
2268 Every symbol has, as well as its name, the attributes ``Value'' and
2269 ``Type''. Depending on output format, symbols can also have auxiliary
2270 attributes.
2271 @ifset INTERNALS
2272 The detailed definitions are in @file{a.out.h}.
2273 @end ifset
2274
2275 If you use a symbol without defining it, @code{@value{AS}} assumes zero for
2276 all these attributes, and probably won't warn you. This makes the
2277 symbol an externally defined symbol, which is generally what you
2278 would want.
2279
2280 @menu
2281 * Symbol Value:: Value
2282 * Symbol Type:: Type
2283 @ifset aout-bout
2284 @ifset GENERIC
2285 * a.out Symbols:: Symbol Attributes: @code{a.out}
2286 @end ifset
2287 @ifclear GENERIC
2288 @ifclear BOUT
2289 * a.out Symbols:: Symbol Attributes: @code{a.out}
2290 @end ifclear
2291 @ifset BOUT
2292 * a.out Symbols:: Symbol Attributes: @code{a.out}, @code{b.out}
2293 @end ifset
2294 @end ifclear
2295 @end ifset
2296 @ifset COFF
2297 * COFF Symbols:: Symbol Attributes for COFF
2298 @end ifset
2299 @ifset SOM
2300 * SOM Symbols:: Symbol Attributes for SOM
2301 @end ifset
2302 @end menu
2303
2304 @node Symbol Value
2305 @subsection Value
2306
2307 @cindex value of a symbol
2308 @cindex symbol value
2309 The value of a symbol is (usually) 32 bits. For a symbol which labels a
2310 location in the text, data, bss or absolute sections the value is the
2311 number of addresses from the start of that section to the label.
2312 Naturally for text, data and bss sections the value of a symbol changes
2313 as @code{@value{LD}} changes section base addresses during linking. Absolute
2314 symbols' values do not change during linking: that is why they are
2315 called absolute.
2316
2317 The value of an undefined symbol is treated in a special way. If it is
2318 0 then the symbol is not defined in this assembler source file, and
2319 @code{@value{LD}} tries to determine its value from other files linked into the
2320 same program. You make this kind of symbol simply by mentioning a symbol
2321 name without defining it. A non-zero value represents a @code{.comm}
2322 common declaration. The value is how much common storage to reserve, in
2323 bytes (addresses). The symbol refers to the first address of the
2324 allocated storage.
2325
2326 @node Symbol Type
2327 @subsection Type
2328
2329 @cindex type of a symbol
2330 @cindex symbol type
2331 The type attribute of a symbol contains relocation (section)
2332 information, any flag settings indicating that a symbol is external, and
2333 (optionally), other information for linkers and debuggers. The exact
2334 format depends on the object-code output format in use.
2335
2336 @ifset aout-bout
2337 @ifclear GENERIC
2338 @ifset BOUT
2339 @c The following avoids a "widow" subsection title. @group would be
2340 @c better if it were available outside examples.
2341 @need 1000
2342 @node a.out Symbols
2343 @subsection Symbol Attributes: @code{a.out}, @code{b.out}
2344
2345 @cindex @code{b.out} symbol attributes
2346 @cindex symbol attributes, @code{b.out}
2347 These symbol attributes appear only when @code{@value{AS}} is configured for
2348 one of the Berkeley-descended object output formats---@code{a.out} or
2349 @code{b.out}.
2350
2351 @end ifset
2352 @ifclear BOUT
2353 @node a.out Symbols
2354 @subsection Symbol Attributes: @code{a.out}
2355
2356 @cindex @code{a.out} symbol attributes
2357 @cindex symbol attributes, @code{a.out}
2358
2359 @end ifclear
2360 @end ifclear
2361 @ifset GENERIC
2362 @node a.out Symbols
2363 @subsection Symbol Attributes: @code{a.out}
2364
2365 @cindex @code{a.out} symbol attributes
2366 @cindex symbol attributes, @code{a.out}
2367
2368 @end ifset
2369 @menu
2370 * Symbol Desc:: Descriptor
2371 * Symbol Other:: Other
2372 @end menu
2373
2374 @node Symbol Desc
2375 @subsubsection Descriptor
2376
2377 @cindex descriptor, of @code{a.out} symbol
2378 This is an arbitrary 16-bit value. You may establish a symbol's
2379 descriptor value by using a @code{.desc} statement
2380 (@pxref{Desc,,@code{.desc}}). A descriptor value means nothing to
2381 @code{@value{AS}}.
2382
2383 @node Symbol Other
2384 @subsubsection Other
2385
2386 @cindex other attribute, of @code{a.out} symbol
2387 This is an arbitrary 8-bit value. It means nothing to @code{@value{AS}}.
2388 @end ifset
2389
2390 @ifset COFF
2391 @node COFF Symbols
2392 @subsection Symbol Attributes for COFF
2393
2394 @cindex COFF symbol attributes
2395 @cindex symbol attributes, COFF
2396
2397 The COFF format supports a multitude of auxiliary symbol attributes;
2398 like the primary symbol attributes, they are set between @code{.def} and
2399 @code{.endef} directives.
2400
2401 @subsubsection Primary Attributes
2402
2403 @cindex primary attributes, COFF symbols
2404 The symbol name is set with @code{.def}; the value and type,
2405 respectively, with @code{.val} and @code{.type}.
2406
2407 @subsubsection Auxiliary Attributes
2408
2409 @cindex auxiliary attributes, COFF symbols
2410 The @code{@value{AS}} directives @code{.dim}, @code{.line}, @code{.scl},
2411 @code{.size}, and @code{.tag} can generate auxiliary symbol table
2412 information for COFF.
2413 @end ifset
2414
2415 @ifset SOM
2416 @node SOM Symbols
2417 @subsection Symbol Attributes for SOM
2418
2419 @cindex SOM symbol attributes
2420 @cindex symbol attributes, SOM
2421
2422 The SOM format for the HPPA supports a multitude of symbol attributes set with
2423 the @code{.EXPORT} and @code{.IMPORT} directives.
2424
2425 The attributes are described in @cite{HP9000 Series 800 Assembly
2426 Language Reference Manual} (HP 92432-90001) under the @code{IMPORT} and
2427 @code{EXPORT} assembler directive documentation.
2428 @end ifset
2429
2430 @node Expressions
2431 @chapter Expressions
2432
2433 @cindex expressions
2434 @cindex addresses
2435 @cindex numeric values
2436 An @dfn{expression} specifies an address or numeric value.
2437 Whitespace may precede and/or follow an expression.
2438
2439 The result of an expression must be an absolute number, or else an offset into
2440 a particular section. If an expression is not absolute, and there is not
2441 enough information when @code{@value{AS}} sees the expression to know its
2442 section, a second pass over the source program might be necessary to interpret
2443 the expression---but the second pass is currently not implemented.
2444 @code{@value{AS}} aborts with an error message in this situation.
2445
2446 @menu
2447 * Empty Exprs:: Empty Expressions
2448 * Integer Exprs:: Integer Expressions
2449 @end menu
2450
2451 @node Empty Exprs
2452 @section Empty Expressions
2453
2454 @cindex empty expressions
2455 @cindex expressions, empty
2456 An empty expression has no value: it is just whitespace or null.
2457 Wherever an absolute expression is required, you may omit the
2458 expression, and @code{@value{AS}} assumes a value of (absolute) 0. This
2459 is compatible with other assemblers.
2460
2461 @node Integer Exprs
2462 @section Integer Expressions
2463
2464 @cindex integer expressions
2465 @cindex expressions, integer
2466 An @dfn{integer expression} is one or more @emph{arguments} delimited
2467 by @emph{operators}.
2468
2469 @menu
2470 * Arguments:: Arguments
2471 * Operators:: Operators
2472 * Prefix Ops:: Prefix Operators
2473 * Infix Ops:: Infix Operators
2474 @end menu
2475
2476 @node Arguments
2477 @subsection Arguments
2478
2479 @cindex expression arguments
2480 @cindex arguments in expressions
2481 @cindex operands in expressions
2482 @cindex arithmetic operands
2483 @dfn{Arguments} are symbols, numbers or subexpressions. In other
2484 contexts arguments are sometimes called ``arithmetic operands''. In
2485 this manual, to avoid confusing them with the ``instruction operands'' of
2486 the machine language, we use the term ``argument'' to refer to parts of
2487 expressions only, reserving the word ``operand'' to refer only to machine
2488 instruction operands.
2489
2490 Symbols are evaluated to yield @{@var{section} @var{NNN}@} where
2491 @var{section} is one of text, data, bss, absolute,
2492 or undefined. @var{NNN} is a signed, 2's complement 32 bit
2493 integer.
2494
2495 Numbers are usually integers.
2496
2497 A number can be a flonum or bignum. In this case, you are warned
2498 that only the low order 32 bits are used, and @code{@value{AS}} pretends
2499 these 32 bits are an integer. You may write integer-manipulating
2500 instructions that act on exotic constants, compatible with other
2501 assemblers.
2502
2503 @cindex subexpressions
2504 Subexpressions are a left parenthesis @samp{(} followed by an integer
2505 expression, followed by a right parenthesis @samp{)}; or a prefix
2506 operator followed by an argument.
2507
2508 @node Operators
2509 @subsection Operators
2510
2511 @cindex operators, in expressions
2512 @cindex arithmetic functions
2513 @cindex functions, in expressions
2514 @dfn{Operators} are arithmetic functions, like @code{+} or @code{%}. Prefix
2515 operators are followed by an argument. Infix operators appear
2516 between their arguments. Operators may be preceded and/or followed by
2517 whitespace.
2518
2519 @node Prefix Ops
2520 @subsection Prefix Operator
2521
2522 @cindex prefix operators
2523 @code{@value{AS}} has the following @dfn{prefix operators}. They each take
2524 one argument, which must be absolute.
2525
2526 @c the tex/end tex stuff surrounding this small table is meant to make
2527 @c it align, on the printed page, with the similar table in the next
2528 @c section (which is inside an enumerate).
2529 @tex
2530 \global\advance\leftskip by \itemindent
2531 @end tex
2532
2533 @table @code
2534 @item -
2535 @dfn{Negation}. Two's complement negation.
2536 @item ~
2537 @dfn{Complementation}. Bitwise not.
2538 @end table
2539
2540 @tex
2541 \global\advance\leftskip by -\itemindent
2542 @end tex
2543
2544 @node Infix Ops
2545 @subsection Infix Operators
2546
2547 @cindex infix operators
2548 @cindex operators, permitted arguments
2549 @dfn{Infix operators} take two arguments, one on either side. Operators
2550 have precedence, but operations with equal precedence are performed left
2551 to right. Apart from @code{+} or @code{-}, both arguments must be
2552 absolute, and the result is absolute.
2553
2554 @enumerate
2555 @cindex operator precedence
2556 @cindex precedence of operators
2557
2558 @item
2559 Highest Precedence
2560
2561 @table @code
2562 @item *
2563 @dfn{Multiplication}.
2564
2565 @item /
2566 @dfn{Division}. Truncation is the same as the C operator @samp{/}
2567
2568 @item %
2569 @dfn{Remainder}.
2570
2571 @item <
2572 @itemx <<
2573 @dfn{Shift Left}. Same as the C operator @samp{<<}.
2574
2575 @item >
2576 @itemx >>
2577 @dfn{Shift Right}. Same as the C operator @samp{>>}.
2578 @end table
2579
2580 @item
2581 Intermediate precedence
2582
2583 @table @code
2584 @item |
2585
2586 @dfn{Bitwise Inclusive Or}.
2587
2588 @item &
2589 @dfn{Bitwise And}.
2590
2591 @item ^
2592 @dfn{Bitwise Exclusive Or}.
2593
2594 @item !
2595 @dfn{Bitwise Or Not}.
2596 @end table
2597
2598 @item
2599 Lowest Precedence
2600
2601 @table @code
2602 @item +
2603 @cindex addition, permitted arguments
2604 @cindex plus, permitted arguments
2605 @cindex arguments for addition
2606 @dfn{Addition}. If either argument is absolute, the result has the section of
2607 the other argument. You may not add together arguments from different
2608 sections.
2609
2610 @item -
2611 @cindex subtraction, permitted arguments
2612 @cindex minus, permitted arguments
2613 @cindex arguments for subtraction
2614 @dfn{Subtraction}. If the right argument is absolute, the
2615 result has the section of the left argument.
2616 If both arguments are in the same section, the result is absolute.
2617 You may not subtract arguments from different sections.
2618 @c FIXME is there still something useful to say about undefined - undefined ?
2619 @end table
2620 @end enumerate
2621
2622 In short, it's only meaningful to add or subtract the @emph{offsets} in an
2623 address; you can only have a defined section in one of the two arguments.
2624
2625 @node Pseudo Ops
2626 @chapter Assembler Directives
2627
2628 @cindex directives, machine independent
2629 @cindex pseudo-ops, machine independent
2630 @cindex machine independent directives
2631 All assembler directives have names that begin with a period (@samp{.}).
2632 The rest of the name is letters, usually in lower case.
2633
2634 This chapter discusses directives that are available regardless of the
2635 target machine configuration for the @sc{gnu} assembler.
2636 @ifset GENERIC
2637 Some machine configurations provide additional directives.
2638 @xref{Machine Dependencies}.
2639 @end ifset
2640 @ifclear GENERIC
2641 @ifset machine-directives
2642 @xref{Machine Dependencies} for additional directives.
2643 @end ifset
2644 @end ifclear
2645
2646 @menu
2647 * Abort:: @code{.abort}
2648 @ifset COFF
2649 * ABORT:: @code{.ABORT}
2650 @end ifset
2651
2652 * Align:: @code{.align @var{abs-expr} , @var{abs-expr}}
2653 * App-File:: @code{.app-file @var{string}}
2654 * Ascii:: @code{.ascii "@var{string}"}@dots{}
2655 * Asciz:: @code{.asciz "@var{string}"}@dots{}
2656 * Byte:: @code{.byte @var{expressions}}
2657 * Comm:: @code{.comm @var{symbol} , @var{length} }
2658 * Data:: @code{.data @var{subsection}}
2659 @ifset COFF
2660 * Def:: @code{.def @var{name}}
2661 @end ifset
2662 @ifset aout-bout
2663 * Desc:: @code{.desc @var{symbol}, @var{abs-expression}}
2664 @end ifset
2665 @ifset COFF
2666 * Dim:: @code{.dim}
2667 @end ifset
2668
2669 * Double:: @code{.double @var{flonums}}
2670 * Eject:: @code{.eject}
2671 * Else:: @code{.else}
2672 @ifset COFF
2673 * Endef:: @code{.endef}
2674 @end ifset
2675
2676 * Endif:: @code{.endif}
2677 * Equ:: @code{.equ @var{symbol}, @var{expression}}
2678 * Extern:: @code{.extern}
2679 @ifclear no-file-dir
2680 * File:: @code{.file @var{string}}
2681 @end ifclear
2682
2683 * Fill:: @code{.fill @var{repeat} , @var{size} , @var{value}}
2684 * Float:: @code{.float @var{flonums}}
2685 * Global:: @code{.global @var{symbol}}, @code{.globl @var{symbol}}
2686 * hword:: @code{.hword @var{expressions}}
2687 * Ident:: @code{.ident}
2688 * If:: @code{.if @var{absolute expression}}
2689 * Include:: @code{.include "@var{file}"}
2690 * Int:: @code{.int @var{expressions}}
2691 * Lcomm:: @code{.lcomm @var{symbol} , @var{length}}
2692 * Lflags:: @code{.lflags}
2693 @ifclear no-line-dir
2694 * Line:: @code{.line @var{line-number}}
2695 @end ifclear
2696
2697 * Ln:: @code{.ln @var{line-number}}
2698 * List:: @code{.list}
2699 * Long:: @code{.long @var{expressions}}
2700 @ignore
2701 * Lsym:: @code{.lsym @var{symbol}, @var{expression}}
2702 @end ignore
2703
2704 * Nolist:: @code{.nolist}
2705 * Octa:: @code{.octa @var{bignums}}
2706 * Org:: @code{.org @var{new-lc} , @var{fill}}
2707 * Psize:: @code{.psize @var{lines}, @var{columns}}
2708 * Quad:: @code{.quad @var{bignums}}
2709 * Sbttl:: @code{.sbttl "@var{subheading}"}
2710 @ifset COFF
2711 * Scl:: @code{.scl @var{class}}
2712 @end ifset
2713 @ifset COFF
2714 * Section:: @code{.section @var{name}, @var{subsection}}
2715 @end ifset
2716
2717 * Set:: @code{.set @var{symbol}, @var{expression}}
2718 * Short:: @code{.short @var{expressions}}
2719 * Single:: @code{.single @var{flonums}}
2720 @ifset COFF
2721 * Size:: @code{.size}
2722 @end ifset
2723
2724 * Space:: @code{.space @var{size} , @var{fill}}
2725 @ifset have-stabs
2726 * Stab:: @code{.stabd, .stabn, .stabs}
2727 @end ifset
2728
2729 * String:: @code{.string "@var{str}"}
2730 @ifset COFF
2731 * Tag:: @code{.tag @var{structname}}
2732 @end ifset
2733
2734 * Text:: @code{.text @var{subsection}}
2735 * Title:: @code{.title "@var{heading}"}
2736 @ifset COFF
2737 * Type:: @code{.type @var{int}}
2738 * Val:: @code{.val @var{addr}}
2739 @end ifset
2740
2741 * Word:: @code{.word @var{expressions}}
2742 * Deprecated:: Deprecated Directives
2743 @end menu
2744
2745 @node Abort
2746 @section @code{.abort}
2747
2748 @cindex @code{abort} directive
2749 @cindex stopping the assembly
2750 This directive stops the assembly immediately. It is for
2751 compatibility with other assemblers. The original idea was that the
2752 assembly language source would be piped into the assembler. If the sender
2753 of the source quit, it could use this directive tells @code{@value{AS}} to
2754 quit also. One day @code{.abort} will not be supported.
2755
2756 @ifset COFF
2757 @node ABORT
2758 @section @code{.ABORT}
2759
2760 @cindex @code{ABORT} directive
2761 When producing COFF output, @code{@value{AS}} accepts this directive as a
2762 synonym for @samp{.abort}.
2763
2764 @ifset BOUT
2765 When producing @code{b.out} output, @code{@value{AS}} accepts this directive,
2766 but ignores it.
2767 @end ifset
2768 @end ifset
2769
2770 @node Align
2771 @section @code{.align @var{abs-expr} , @var{abs-expr}}
2772
2773 @cindex padding the location counter
2774 @cindex @code{align} directive
2775 Pad the location counter (in the current subsection) to a particular
2776 storage boundary. The first expression (which must be absolute) is the
2777 number of low-order zero bits the location counter must have after
2778 advancement. For example @samp{.align 3} advances the location
2779 counter until it a multiple of 8. If the location counter is already a
2780 multiple of 8, no change is needed.
2781
2782 @ifset HPPA
2783 For the HPPA, the first expression (which must be absolute) is the
2784 alignment request in bytes. For example @samp{.align 8} advances
2785 the location counter until it is a multiple of 8. If the location counter
2786 is already a multiple of 8, no change is needed.
2787 @end ifset
2788
2789 The second expression (also absolute) gives the value to be stored in
2790 the padding bytes. It (and the comma) may be omitted. If it is
2791 omitted, the padding bytes are zero.
2792
2793 @node App-File
2794 @section @code{.app-file @var{string}}
2795
2796 @cindex logical file name
2797 @cindex file name, logical
2798 @cindex @code{app-file} directive
2799 @code{.app-file}
2800 @ifclear no-file-dir
2801 (which may also be spelled @samp{.file})
2802 @end ifclear
2803 tells @code{@value{AS}} that we are about to start a new
2804 logical file. @var{string} is the new file name. In general, the
2805 filename is recognized whether or not it is surrounded by quotes @samp{"};
2806 but if you wish to specify an empty file name is permitted,
2807 you must give the quotes--@code{""}. This statement may go away in
2808 future: it is only recognized to be compatible with old @code{@value{AS}}
2809 programs.@refill
2810
2811 @node Ascii
2812 @section @code{.ascii "@var{string}"}@dots{}
2813
2814 @cindex @code{ascii} directive
2815 @cindex string literals
2816 @code{.ascii} expects zero or more string literals (@pxref{Strings})
2817 separated by commas. It assembles each string (with no automatic
2818 trailing zero byte) into consecutive addresses.
2819
2820 @node Asciz
2821 @section @code{.asciz "@var{string}"}@dots{}
2822
2823 @cindex @code{asciz} directive
2824 @cindex zero-terminated strings
2825 @cindex null-terminated strings
2826 @code{.asciz} is just like @code{.ascii}, but each string is followed by
2827 a zero byte. The ``z'' in @samp{.asciz} stands for ``zero''.
2828
2829 @node Byte
2830 @section @code{.byte @var{expressions}}
2831
2832 @cindex @code{byte} directive
2833 @cindex integers, one byte
2834 @code{.byte} expects zero or more expressions, separated by commas.
2835 Each expression is assembled into the next byte.
2836
2837 @node Comm
2838 @section @code{.comm @var{symbol} , @var{length} }
2839
2840 @cindex @code{comm} directive
2841 @cindex symbol, common
2842 @code{.comm} declares a named common area in the bss section. Normally
2843 @code{@value{LD}} reserves memory addresses for it during linking, so no partial
2844 program defines the location of the symbol. Use @code{.comm} to tell
2845 @code{@value{LD}} that it must be at least @var{length} bytes long. @code{@value{LD}}
2846 allocates space for each @code{.comm} symbol that is at least as
2847 long as the longest @code{.comm} request in any of the partial programs
2848 linked. @var{length} is an absolute expression.
2849
2850 @ifset HPPA
2851 The syntax for @code{.comm} differs slightly on the HPPA. The syntax is
2852 @samp{@var{symbol} .comm, @var{length}}; @var{symbol} is optional.
2853 @end ifset
2854
2855 @node Data
2856 @section @code{.data @var{subsection}}
2857
2858 @cindex @code{data} directive
2859 @code{.data} tells @code{@value{AS}} to assemble the following statements onto the
2860 end of the data subsection numbered @var{subsection} (which is an
2861 absolute expression). If @var{subsection} is omitted, it defaults
2862 to zero.
2863
2864 @ifset COFF
2865 @node Def
2866 @section @code{.def @var{name}}
2867
2868 @cindex @code{def} directive
2869 @cindex COFF symbols, debugging
2870 @cindex debugging COFF symbols
2871 Begin defining debugging information for a symbol @var{name}; the
2872 definition extends until the @code{.endef} directive is encountered.
2873 @ifset BOUT
2874
2875 This directive is only observed when @code{@value{AS}} is configured for COFF
2876 format output; when producing @code{b.out}, @samp{.def} is recognized,
2877 but ignored.
2878 @end ifset
2879 @end ifset
2880
2881 @ifset aout-bout
2882 @node Desc
2883 @section @code{.desc @var{symbol}, @var{abs-expression}}
2884
2885 @cindex @code{desc} directive
2886 @cindex COFF symbol descriptor
2887 @cindex symbol descriptor, COFF
2888 This directive sets the descriptor of the symbol (@pxref{Symbol Attributes})
2889 to the low 16 bits of an absolute expression.
2890
2891 @ifset COFF
2892 The @samp{.desc} directive is not available when @code{@value{AS}} is
2893 configured for COFF output; it is only for @code{a.out} or @code{b.out}
2894 object format. For the sake of compatibility, @code{@value{AS}} accepts
2895 it, but produces no output, when configured for COFF.
2896 @end ifset
2897 @end ifset
2898
2899 @ifset COFF
2900 @node Dim
2901 @section @code{.dim}
2902
2903 @cindex @code{dim} directive
2904 @cindex COFF auxiliary symbol information
2905 @cindex auxiliary symbol information, COFF
2906 This directive is generated by compilers to include auxiliary debugging
2907 information in the symbol table. It is only permitted inside
2908 @code{.def}/@code{.endef} pairs.
2909 @ifset BOUT
2910
2911 @samp{.dim} is only meaningful when generating COFF format output; when
2912 @code{@value{AS}} is generating @code{b.out}, it accepts this directive but
2913 ignores it.
2914 @end ifset
2915 @end ifset
2916
2917 @node Double
2918 @section @code{.double @var{flonums}}
2919
2920 @cindex @code{double} directive
2921 @cindex floating point numbers (double)
2922 @code{.double} expects zero or more flonums, separated by commas. It
2923 assembles floating point numbers.
2924 @ifset GENERIC
2925 The exact kind of floating point numbers emitted depends on how
2926 @code{@value{AS}} is configured. @xref{Machine Dependencies}.
2927 @end ifset
2928 @ifclear GENERIC
2929 @ifset IEEEFLOAT
2930 On the @value{TARGET} family @samp{.double} emits 64-bit floating-point numbers
2931 in @sc{ieee} format.
2932 @end ifset
2933 @end ifclear
2934
2935 @node Eject
2936 @section @code{.eject}
2937
2938 @cindex @code{eject} directive
2939 @cindex new page, in listings
2940 @cindex page, in listings
2941 @cindex listing control: new page
2942 Force a page break at this point, when generating assembly listings.
2943
2944 @node Else
2945 @section @code{.else}
2946
2947 @cindex @code{else} directive
2948 @code{.else} is part of the @code{@value{AS}} support for conditional
2949 assembly; @pxref{If,,@code{.if}}. It marks the beginning of a section
2950 of code to be assembled if the condition for the preceding @code{.if}
2951 was false.
2952
2953 @ignore
2954 @node End, Endef, Else, Pseudo Ops
2955 @section @code{.end}
2956
2957 @cindex @code{end} directive
2958 This doesn't do anything---but isn't an s_ignore, so I suspect it's
2959 meant to do something eventually (which is why it isn't documented here
2960 as "for compatibility with blah").
2961 @end ignore
2962
2963 @ifset COFF
2964 @node Endef
2965 @section @code{.endef}
2966
2967 @cindex @code{endef} directive
2968 This directive flags the end of a symbol definition begun with
2969 @code{.def}.
2970 @ifset BOUT
2971
2972 @samp{.endef} is only meaningful when generating COFF format output; if
2973 @code{@value{AS}} is configured to generate @code{b.out}, it accepts this
2974 directive but ignores it.
2975 @end ifset
2976 @end ifset
2977
2978 @node Endif
2979 @section @code{.endif}
2980
2981 @cindex @code{endif} directive
2982 @code{.endif} is part of the @code{@value{AS}} support for conditional assembly;
2983 it marks the end of a block of code that is only assembled
2984 conditionally. @xref{If,,@code{.if}}.
2985
2986 @node Equ
2987 @section @code{.equ @var{symbol}, @var{expression}}
2988
2989 @cindex @code{equ} directive
2990 @cindex assigning values to symbols
2991 @cindex symbols, assigning values to
2992 This directive sets the value of @var{symbol} to @var{expression}.
2993 It is synonymous with @samp{.set}; @pxref{Set,,@code{.set}}.
2994
2995 @ifset HPPA
2996 The syntax for @code{equ} on the HPPA is
2997 @samp{@var{symbol} .equ @var{expression}}.
2998 @end ifset
2999
3000 @node Extern
3001 @section @code{.extern}
3002
3003 @cindex @code{extern} directive
3004 @code{.extern} is accepted in the source program---for compatibility
3005 with other assemblers---but it is ignored. @code{@value{AS}} treats
3006 all undefined symbols as external.
3007
3008 @ifclear no-file-dir
3009 @node File
3010 @section @code{.file @var{string}}
3011
3012 @cindex @code{file} directive
3013 @cindex logical file name
3014 @cindex file name, logical
3015 @code{.file} (which may also be spelled @samp{.app-file}) tells
3016 @code{@value{AS}} that we are about to start a new logical file.
3017 @var{string} is the new file name. In general, the filename is
3018 recognized whether or not it is surrounded by quotes @samp{"}; but if
3019 you wish to specify an empty file name, you must give the
3020 quotes--@code{""}. This statement may go away in future: it is only
3021 recognized to be compatible with old @code{@value{AS}} programs.
3022 @ifset A29K
3023 In some configurations of @code{@value{AS}}, @code{.file} has already been
3024 removed to avoid conflicts with other assemblers. @xref{Machine Dependencies}.
3025 @end ifset
3026 @end ifclear
3027
3028 @node Fill
3029 @section @code{.fill @var{repeat} , @var{size} , @var{value}}
3030
3031 @cindex @code{fill} directive
3032 @cindex writing patterns in memory
3033 @cindex patterns, writing in memory
3034 @var{result}, @var{size} and @var{value} are absolute expressions.
3035 This emits @var{repeat} copies of @var{size} bytes. @var{Repeat}
3036 may be zero or more. @var{Size} may be zero or more, but if it is
3037 more than 8, then it is deemed to have the value 8, compatible with
3038 other people's assemblers. The contents of each @var{repeat} bytes
3039 is taken from an 8-byte number. The highest order 4 bytes are
3040 zero. The lowest order 4 bytes are @var{value} rendered in the
3041 byte-order of an integer on the computer @code{@value{AS}} is assembling for.
3042 Each @var{size} bytes in a repetition is taken from the lowest order
3043 @var{size} bytes of this number. Again, this bizarre behavior is
3044 compatible with other people's assemblers.
3045
3046 @var{size} and @var{value} are optional.
3047 If the second comma and @var{value} are absent, @var{value} is
3048 assumed zero. If the first comma and following tokens are absent,
3049 @var{size} is assumed to be 1.
3050
3051 @node Float
3052 @section @code{.float @var{flonums}}
3053
3054 @cindex floating point numbers (single)
3055 @cindex @code{float} directive
3056 This directive assembles zero or more flonums, separated by commas. It
3057 has the same effect as @code{.single}.
3058 @ifset GENERIC
3059 The exact kind of floating point numbers emitted depends on how
3060 @code{@value{AS}} is configured.
3061 @xref{Machine Dependencies}.
3062 @end ifset
3063 @ifclear GENERIC
3064 @ifset IEEEFLOAT
3065 On the @value{TARGET} family, @code{.float} emits 32-bit floating point numbers
3066 in @sc{ieee} format.
3067 @end ifset
3068 @end ifclear
3069
3070 @node Global
3071 @section @code{.global @var{symbol}}, @code{.globl @var{symbol}}
3072
3073 @cindex @code{global} directive
3074 @cindex symbol, making visible to linker
3075 @code{.global} makes the symbol visible to @code{@value{LD}}. If you define
3076 @var{symbol} in your partial program, its value is made available to
3077 other partial programs that are linked with it. Otherwise,
3078 @var{symbol} takes its attributes from a symbol of the same name
3079 from another file linked into the same program.
3080
3081 Both spellings (@samp{.globl} and @samp{.global}) are accepted, for
3082 compatibility with other assemblers.
3083
3084 @ifset HPPA
3085 On the HPPA, @code{.global} is not always enough to make it accessible to other
3086 partial programs. You may need the HPPA-only @code{.EXPORT} directive as well.
3087 @xref{HPPA Directives,, HPPA Assembler Directives}.
3088 @end ifset
3089
3090 @node hword
3091 @section @code{.hword @var{expressions}}
3092
3093 @cindex @code{hword} directive
3094 @cindex integers, 16-bit
3095 @cindex numbers, 16-bit
3096 @cindex sixteen bit integers
3097 This expects zero or more @var{expressions}, and emits
3098 a 16 bit number for each.
3099
3100 @ifset GENERIC
3101 This directive is a synonym for @samp{.short}; depending on the target
3102 architecture, it may also be a synonym for @samp{.word}.
3103 @end ifset
3104 @ifclear GENERIC
3105 @ifset W32
3106 This directive is a synonym for @samp{.short}.
3107 @end ifset
3108 @ifset W16
3109 This directive is a synonym for both @samp{.short} and @samp{.word}.
3110 @end ifset
3111 @end ifclear
3112
3113 @node Ident
3114 @section @code{.ident}
3115
3116 @cindex @code{ident} directive
3117 This directive is used by some assemblers to place tags in object files.
3118 @code{@value{AS}} simply accepts the directive for source-file
3119 compatibility with such assemblers, but does not actually emit anything
3120 for it.
3121
3122 @node If
3123 @section @code{.if @var{absolute expression}}
3124
3125 @cindex conditional assembly
3126 @cindex @code{if} directive
3127 @code{.if} marks the beginning of a section of code which is only
3128 considered part of the source program being assembled if the argument
3129 (which must be an @var{absolute expression}) is non-zero. The end of
3130 the conditional section of code must be marked by @code{.endif}
3131 (@pxref{Endif,,@code{.endif}}); optionally, you may include code for the
3132 alternative condition, flagged by @code{.else} (@pxref{Else,,@code{.else}}.
3133
3134 The following variants of @code{.if} are also supported:
3135 @table @code
3136 @item .ifdef @var{symbol}
3137 @cindex @code{ifdef} directive
3138 Assembles the following section of code if the specified @var{symbol}
3139 has been defined.
3140
3141 @ignore
3142 @item .ifeqs
3143 @cindex @code{ifeqs} directive
3144 Not yet implemented.
3145 @end ignore
3146
3147 @item .ifndef @var{symbol}
3148 @itemx ifnotdef @var{symbol}
3149 @cindex @code{ifndef} directive
3150 @cindex @code{ifnotdef} directive
3151 Assembles the following section of code if the specified @var{symbol}
3152 has not been defined. Both spelling variants are equivalent.
3153
3154 @ignore
3155 @item ifnes
3156 Not yet implemented.
3157 @end ignore
3158 @end table
3159
3160 @node Include
3161 @section @code{.include "@var{file}"}
3162
3163 @cindex @code{include} directive
3164 @cindex supporting files, including
3165 @cindex files, including
3166 This directive provides a way to include supporting files at specified
3167 points in your source program. The code from @var{file} is assembled as
3168 if it followed the point of the @code{.include}; when the end of the
3169 included file is reached, assembly of the original file continues. You
3170 can control the search paths used with the @samp{-I} command-line option
3171 (@pxref{Invoking,,Command-Line Options}). Quotation marks are required
3172 around @var{file}.
3173
3174 @node Int
3175 @section @code{.int @var{expressions}}
3176
3177 @cindex @code{int} directive
3178 @cindex integers, 32-bit
3179 Expect zero or more @var{expressions}, of any section, separated by commas.
3180 For each expression, emit a number that, at run time, is the value of that
3181 expression. The byte order and bit size of the number depends on what kind
3182 of target the assembly is for.
3183
3184 @ifclear GENERIC
3185 @ifset H8
3186 On the H8/500 and most forms of the H8/300, @code{.int} emits 16-bit
3187 integers. On the H8/300H and the Hitachi SH, however, @code{.int} emits
3188 32-bit integers.
3189 @end ifset
3190 @end ifclear
3191
3192 @node Lcomm
3193 @section @code{.lcomm @var{symbol} , @var{length}}
3194
3195 @cindex @code{lcomm} directive
3196 @cindex local common symbols
3197 @cindex symbols, local common
3198 Reserve @var{length} (an absolute expression) bytes for a local common
3199 denoted by @var{symbol}. The section and value of @var{symbol} are
3200 those of the new local common. The addresses are allocated in the bss
3201 section, so that at run-time the bytes start off zeroed. @var{Symbol}
3202 is not declared global (@pxref{Global,,@code{.global}}), so is normally
3203 not visible to @code{@value{LD}}.
3204
3205 @ifset HPPA
3206 The syntax for @code{.lcomm} differs slightly on the HPPA. The syntax is
3207 @samp{@var{symbol} .lcomm, @var{length}}; @var{symbol} is optional.
3208 @end ifset
3209
3210 @node Lflags
3211 @section @code{.lflags}
3212
3213 @cindex @code{lflags} directive (ignored)
3214 @code{@value{AS}} accepts this directive, for compatibility with other
3215 assemblers, but ignores it.
3216
3217 @ifclear no-line-dir
3218 @node Line
3219 @section @code{.line @var{line-number}}
3220
3221 @cindex @code{line} directive
3222 @end ifclear
3223 @ifset no-line-dir
3224 @node Ln
3225 @section @code{.ln @var{line-number}}
3226
3227 @cindex @code{ln} directive
3228 @end ifset
3229 @cindex logical line number
3230 @ifset aout-bout
3231 Change the logical line number. @var{line-number} must be an absolute
3232 expression. The next line has that logical line number. Therefore any other
3233 statements on the current line (after a statement separator character) are
3234 reported as on logical line number @var{line-number} @minus{} 1. One day
3235 @code{@value{AS}} will no longer support this directive: it is recognized only
3236 for compatibility with existing assembler programs.
3237
3238 @ifset GENERIC
3239 @ifset A29K
3240 @emph{Warning:} In the AMD29K configuration of @value{AS}, this command is
3241 not available; use the synonym @code{.ln} in that context.
3242 @end ifset
3243 @end ifset
3244 @end ifset
3245
3246 @ifclear no-line-dir
3247 Even though this is a directive associated with the @code{a.out} or
3248 @code{b.out} object-code formats, @code{@value{AS}} still recognizes it
3249 when producing COFF output, and treats @samp{.line} as though it
3250 were the COFF @samp{.ln} @emph{if} it is found outside a
3251 @code{.def}/@code{.endef} pair.
3252
3253 Inside a @code{.def}, @samp{.line} is, instead, one of the directives
3254 used by compilers to generate auxiliary symbol information for
3255 debugging.
3256 @end ifclear
3257
3258 @node Ln
3259 @section @code{.ln @var{line-number}}
3260
3261 @cindex @code{ln} directive
3262 @ifclear no-line-dir
3263 @samp{.ln} is a synonym for @samp{.line}.
3264 @end ifclear
3265 @ifset no-line-dir
3266 Tell @code{@value{AS}} to change the logical line number. @var{line-number}
3267 must be an absolute expression. The next line has that logical
3268 line number, so any other statements on the current line (after a
3269 statement separator character @code{;}) are reported as on logical
3270 line number @var{line-number} @minus{} 1.
3271 @ifset BOUT
3272
3273 This directive is accepted, but ignored, when @code{@value{AS}} is
3274 configured for @code{b.out}; its effect is only associated with COFF
3275 output format.
3276 @end ifset
3277 @end ifset
3278
3279 @node List
3280 @section @code{.list}
3281
3282 @cindex @code{list} directive
3283 @cindex listing control, turning on
3284 Control (in conjunction with the @code{.nolist} directive) whether or
3285 not assembly listings are generated. These two directives maintain an
3286 internal counter (which is zero initially). @code{.list} increments the
3287 counter, and @code{.nolist} decrements it. Assembly listings are
3288 generated whenever the counter is greater than zero.
3289
3290 By default, listings are disabled. When you enable them (with the
3291 @samp{-a} command line option; @pxref{Invoking,,Command-Line Options}),
3292 the initial value of the listing counter is one.
3293
3294 @node Long
3295 @section @code{.long @var{expressions}}
3296
3297 @cindex @code{long} directive
3298 @code{.long} is the same as @samp{.int}, @pxref{Int,,@code{.int}}.
3299
3300 @ignore
3301 @c no one seems to know what this is for or whether this description is
3302 @c what it really ought to do
3303 @node Lsym
3304 @section @code{.lsym @var{symbol}, @var{expression}}
3305
3306 @cindex @code{lsym} directive
3307 @cindex symbol, not referenced in assembly
3308 @code{.lsym} creates a new symbol named @var{symbol}, but does not put it in
3309 the hash table, ensuring it cannot be referenced by name during the
3310 rest of the assembly. This sets the attributes of the symbol to be
3311 the same as the expression value:
3312 @smallexample
3313 @var{other} = @var{descriptor} = 0
3314 @var{type} = @r{(section of @var{expression})}
3315 @var{value} = @var{expression}
3316 @end smallexample
3317 @noindent
3318 The new symbol is not flagged as external.
3319 @end ignore
3320
3321 @node Nolist
3322 @section @code{.nolist}
3323
3324 @cindex @code{nolist} directive
3325 @cindex listing control, turning off
3326 Control (in conjunction with the @code{.list} directive) whether or
3327 not assembly listings are generated. These two directives maintain an
3328 internal counter (which is zero initially). @code{.list} increments the
3329 counter, and @code{.nolist} decrements it. Assembly listings are
3330 generated whenever the counter is greater than zero.
3331
3332 @node Octa
3333 @section @code{.octa @var{bignums}}
3334
3335 @c FIXME: double size emitted for "octa" on i960, others? Or warn?
3336 @cindex @code{octa} directive
3337 @cindex integer, 16-byte
3338 @cindex sixteen byte integer
3339 This directive expects zero or more bignums, separated by commas. For each
3340 bignum, it emits a 16-byte integer.
3341
3342 The term ``octa'' comes from contexts in which a ``word'' is two bytes;
3343 hence @emph{octa}-word for 16 bytes.
3344
3345 @node Org
3346 @section @code{.org @var{new-lc} , @var{fill}}
3347
3348 @cindex @code{org} directive
3349 @cindex location counter, advancing
3350 @cindex advancing location counter
3351 @cindex current address, advancing
3352 Advance the location counter of the current section to
3353 @var{new-lc}. @var{new-lc} is either an absolute expression or an
3354 expression with the same section as the current subsection. That is,
3355 you can't use @code{.org} to cross sections: if @var{new-lc} has the
3356 wrong section, the @code{.org} directive is ignored. To be compatible
3357 with former assemblers, if the section of @var{new-lc} is absolute,
3358 @code{@value{AS}} issues a warning, then pretends the section of @var{new-lc}
3359 is the same as the current subsection.
3360
3361 @code{.org} may only increase the location counter, or leave it
3362 unchanged; you cannot use @code{.org} to move the location counter
3363 backwards.
3364
3365 @c double negative used below "not undefined" because this is a specific
3366 @c reference to "undefined" (as SEG_UNKNOWN is called in this manual)
3367 @c section. pesch@cygnus.com 18feb91
3368 Because @code{@value{AS}} tries to assemble programs in one pass, @var{new-lc}
3369 may not be undefined. If you really detest this restriction we eagerly await
3370 a chance to share your improved assembler.
3371
3372 Beware that the origin is relative to the start of the section, not
3373 to the start of the subsection. This is compatible with other
3374 people's assemblers.
3375
3376 When the location counter (of the current subsection) is advanced, the
3377 intervening bytes are filled with @var{fill} which should be an
3378 absolute expression. If the comma and @var{fill} are omitted,
3379 @var{fill} defaults to zero.
3380
3381 @node Psize
3382 @section @code{.psize @var{lines} , @var{columns}}
3383
3384 @cindex @code{psize} directive
3385 @cindex listing control: paper size
3386 @cindex paper size, for listings
3387 Use this directive to declare the number of lines---and, optionally, the
3388 number of columns---to use for each page, when generating listings.
3389
3390 If you do not use @code{.psize}, listings use a default line-count
3391 of 60. You may omit the comma and @var{columns} specification; the
3392 default width is 200 columns.
3393
3394 @code{@value{AS}} generates formfeeds whenever the specified number of
3395 lines is exceeded (or whenever you explicitly request one, using
3396 @code{.eject}).
3397
3398 If you specify @var{lines} as @code{0}, no formfeeds are generated save
3399 those explicitly specified with @code{.eject}.
3400
3401 @node Quad
3402 @section @code{.quad @var{bignums}}
3403
3404 @cindex @code{quad} directive
3405 @code{.quad} expects zero or more bignums, separated by commas. For
3406 each bignum, it emits
3407 @ifclear bignum-16
3408 an 8-byte integer. If the bignum won't fit in 8 bytes, it prints a
3409 warning message; and just takes the lowest order 8 bytes of the bignum.
3410 @cindex eight-byte integer
3411 @cindex integer, 8-byte
3412
3413 The term ``quad'' comes from contexts in which a ``word'' is two bytes;
3414 hence @emph{quad}-word for 8 bytes.
3415 @end ifclear
3416 @ifset bignum-16
3417 a 16-byte integer. If the bignum won't fit in 16 bytes, it prints a
3418 warning message; and just takes the lowest order 16 bytes of the bignum.
3419 @cindex sixteen-byte integer
3420 @cindex integer, 16-byte
3421 @end ifset
3422
3423 @node Sbttl
3424 @section @code{.sbttl "@var{subheading}"}
3425
3426 @cindex @code{sbttl} directive
3427 @cindex subtitles for listings
3428 @cindex listing control: subtitle
3429 Use @var{subheading} as the title (third line, immediately after the
3430 title line) when generating assembly listings.
3431
3432 This directive affects subsequent pages, as well as the current page if
3433 it appears within ten lines of the top of a page.
3434
3435 @ifset COFF
3436 @node Scl
3437 @section @code{.scl @var{class}}
3438
3439 @cindex @code{scl} directive
3440 @cindex symbol storage class (COFF)
3441 @cindex COFF symbol storage class
3442 Set the storage-class value for a symbol. This directive may only be
3443 used inside a @code{.def}/@code{.endef} pair. Storage class may flag
3444 whether a symbol is static or external, or it may record further
3445 symbolic debugging information.
3446 @ifset BOUT
3447
3448 The @samp{.scl} directive is primarily associated with COFF output; when
3449 configured to generate @code{b.out} output format, @code{@value{AS}}
3450 accepts this directive but ignores it.
3451 @end ifset
3452 @end ifset
3453
3454 @ifset COFF
3455 @node Section
3456 @section @code{.section @var{name}, @var{subsection}}
3457
3458 @cindex @code{section} directive
3459 @cindex named section (COFF)
3460 @cindex COFF named section
3461 Assemble the following code into end of subsection numbered
3462 @var{subsection} in the COFF named section @var{name}. If you omit
3463 @var{subsection}, @code{@value{AS}} uses subsection number zero.
3464 @samp{.section .text} is equivalent to the @code{.text} directive;
3465 @samp{.section .data} is equivalent to the @code{.data} directive.
3466 @ifset GENERIC
3467 This directive is only supported for targets that actually support arbitrarily
3468 named sections; on @code{a.out} targets, for example, it is not accepted, even
3469 with a standard @code{a.out} section name as its parameter.
3470 @end ifset
3471 @end ifset
3472
3473 @node Set
3474 @section @code{.set @var{symbol}, @var{expression}}
3475
3476 @cindex @code{set} directive
3477 @cindex symbol value, setting
3478 Set the value of @var{symbol} to @var{expression}. This
3479 changes @var{symbol}'s value and type to conform to
3480 @var{expression}. If @var{symbol} was flagged as external, it remains
3481 flagged. (@xref{Symbol Attributes}.)
3482
3483 You may @code{.set} a symbol many times in the same assembly.
3484
3485 If you @code{.set} a global symbol, the value stored in the object
3486 file is the last value stored into it.
3487
3488 @ifset HPPA
3489 The syntax for @code{set} on the HPPA is
3490 @samp{@var{symbol} .set @var{expression}}.
3491 @end ifset
3492
3493 @node Short
3494 @section @code{.short @var{expressions}}
3495
3496 @cindex @code{short} directive
3497 @ifset GENERIC
3498 @code{.short} is normally the same as @samp{.word}.
3499 @xref{Word,,@code{.word}}.
3500
3501 In some configurations, however, @code{.short} and @code{.word} generate
3502 numbers of different lengths; @pxref{Machine Dependencies}.
3503 @end ifset
3504 @ifclear GENERIC
3505 @ifset W16
3506 @code{.short} is the same as @samp{.word}. @xref{Word,,@code{.word}}.
3507 @end ifset
3508 @ifset W32
3509 This expects zero or more @var{expressions}, and emits
3510 a 16 bit number for each.
3511 @end ifset
3512 @end ifclear
3513
3514 @node Single
3515 @section @code{.single @var{flonums}}
3516
3517 @cindex @code{single} directive
3518 @cindex floating point numbers (single)
3519 This directive assembles zero or more flonums, separated by commas. It
3520 has the same effect as @code{.float}.
3521 @ifset GENERIC
3522 The exact kind of floating point numbers emitted depends on how
3523 @code{@value{AS}} is configured. @xref{Machine Dependencies}.
3524 @end ifset
3525 @ifclear GENERIC
3526 @ifset IEEEFLOAT
3527 On the @value{TARGET} family, @code{.single} emits 32-bit floating point
3528 numbers in @sc{ieee} format.
3529 @end ifset
3530 @end ifclear
3531
3532 @ifset COFF
3533 @node Size
3534 @section @code{.size}
3535
3536 @cindex @code{size} directive
3537 This directive is generated by compilers to include auxiliary debugging
3538 information in the symbol table. It is only permitted inside
3539 @code{.def}/@code{.endef} pairs.
3540 @ifset BOUT
3541
3542 @samp{.size} is only meaningful when generating COFF format output; when
3543 @code{@value{AS}} is generating @code{b.out}, it accepts this directive but
3544 ignores it.
3545 @end ifset
3546 @end ifset
3547
3548 @ifclear no-space-dir
3549 @node Space
3550 @section @code{.space @var{size} , @var{fill}}
3551
3552 @cindex @code{space} directive
3553 @cindex filling memory
3554 This directive emits @var{size} bytes, each of value @var{fill}. Both
3555 @var{size} and @var{fill} are absolute expressions. If the comma
3556 and @var{fill} are omitted, @var{fill} is assumed to be zero.
3557
3558 @ifset HPPA
3559 @quotation
3560 @emph{Warning:} @code{.space} has a completely different meaning for HPPA
3561 targets; use @code{.block} as a substitute. See @cite{HP9000 Series 800
3562 Assembly Language Reference Manual} (HP 92432-90001) for the meaning of the
3563 @code{.space} directive. @xref{HPPA Directives,,HPPA Assembler Directives},
3564 for a summary.
3565 @end quotation
3566 @end ifset
3567 @end ifclear
3568
3569 @ifset A29K
3570 @ifclear GENERIC
3571 @node Space
3572 @section @code{.space}
3573 @cindex @code{space} directive
3574 @end ifclear
3575 On the AMD 29K, this directive is ignored; it is accepted for
3576 compatibility with other AMD 29K assemblers.
3577
3578 @quotation
3579 @emph{Warning:} In most versions of the @sc{gnu} assembler, the directive
3580 @code{.space} has the effect of @code{.block} @xref{Machine Dependencies}.
3581 @end quotation
3582 @end ifset
3583
3584 @ifset have-stabs
3585 @node Stab
3586 @section @code{.stabd, .stabn, .stabs}
3587
3588 @cindex symbolic debuggers, information for
3589 @cindex @code{stab@var{x}} directives
3590 There are three directives that begin @samp{.stab}.
3591 All emit symbols (@pxref{Symbols}), for use by symbolic debuggers.
3592 The symbols are not entered in the @code{@value{AS}} hash table: they
3593 cannot be referenced elsewhere in the source file.
3594 Up to five fields are required:
3595
3596 @table @var
3597 @item string
3598 This is the symbol's name. It may contain any character except
3599 @samp{\000}, so is more general than ordinary symbol names. Some
3600 debuggers used to code arbitrarily complex structures into symbol names
3601 using this field.
3602
3603 @item type
3604 An absolute expression. The symbol's type is set to the low 8 bits of
3605 this expression. Any bit pattern is permitted, but @code{@value{LD}}
3606 and debuggers choke on silly bit patterns.
3607
3608 @item other
3609 An absolute expression. The symbol's ``other'' attribute is set to the
3610 low 8 bits of this expression.
3611
3612 @item desc
3613 An absolute expression. The symbol's descriptor is set to the low 16
3614 bits of this expression.
3615
3616 @item value
3617 An absolute expression which becomes the symbol's value.
3618 @end table
3619
3620 If a warning is detected while reading a @code{.stabd}, @code{.stabn},
3621 or @code{.stabs} statement, the symbol has probably already been created;
3622 you get a half-formed symbol in your object file. This is
3623 compatible with earlier assemblers!
3624
3625 @table @code
3626 @cindex @code{stabd} directive
3627 @item .stabd @var{type} , @var{other} , @var{desc}
3628
3629 The ``name'' of the symbol generated is not even an empty string.
3630 It is a null pointer, for compatibility. Older assemblers used a
3631 null pointer so they didn't waste space in object files with empty
3632 strings.
3633
3634 The symbol's value is set to the location counter,
3635 relocatably. When your program is linked, the value of this symbol
3636 is the address of the location counter when the @code{.stabd} was
3637 assembled.
3638
3639 @item .stabn @var{type} , @var{other} , @var{desc} , @var{value}
3640 @cindex @code{stabn} directive
3641 The name of the symbol is set to the empty string @code{""}.
3642
3643 @item .stabs @var{string} , @var{type} , @var{other} , @var{desc} , @var{value}
3644 @cindex @code{stabs} directive
3645 All five fields are specified.
3646 @end table
3647 @end ifset
3648 @c end have-stabs
3649
3650 @node String
3651 @section @code{.string} "@var{str}"
3652
3653 @cindex string, copying to object file
3654 @cindex @code{string} directive
3655
3656 Copy the characters in @var{str} to the object file. You may specify more than
3657 one string to copy, separated by commas. Unless otherwise specified for a
3658 particular machine, the assembler marks the end of each string with a 0 byte.
3659 You can use any of the escape sequences described in @ref{Strings,,Strings}.
3660
3661 @ifset COFF
3662 @node Tag
3663 @section @code{.tag @var{structname}}
3664
3665 @cindex COFF structure debugging
3666 @cindex structure debugging, COFF
3667 @cindex @code{tag} directive
3668 This directive is generated by compilers to include auxiliary debugging
3669 information in the symbol table. It is only permitted inside
3670 @code{.def}/@code{.endef} pairs. Tags are used to link structure
3671 definitions in the symbol table with instances of those structures.
3672 @ifset BOUT
3673
3674 @samp{.tag} is only used when generating COFF format output; when
3675 @code{@value{AS}} is generating @code{b.out}, it accepts this directive but
3676 ignores it.
3677 @end ifset
3678 @end ifset
3679
3680 @node Text
3681 @section @code{.text @var{subsection}}
3682
3683 @cindex @code{text} directive
3684 Tells @code{@value{AS}} to assemble the following statements onto the end of
3685 the text subsection numbered @var{subsection}, which is an absolute
3686 expression. If @var{subsection} is omitted, subsection number zero
3687 is used.
3688
3689 @node Title
3690 @section @code{.title "@var{heading}"}
3691
3692 @cindex @code{title} directive
3693 @cindex listing control: title line
3694 Use @var{heading} as the title (second line, immediately after the
3695 source file name and pagenumber) when generating assembly listings.
3696
3697 This directive affects subsequent pages, as well as the current page if
3698 it appears within ten lines of the top of a page.
3699
3700 @ifset COFF
3701 @node Type
3702 @section @code{.type @var{int}}
3703
3704 @cindex COFF symbol type
3705 @cindex symbol type, COFF
3706 @cindex @code{type} directive
3707 This directive, permitted only within @code{.def}/@code{.endef} pairs,
3708 records the integer @var{int} as the type attribute of a symbol table entry.
3709 @ifset BOUT
3710
3711 @samp{.type} is associated only with COFF format output; when
3712 @code{@value{AS}} is configured for @code{b.out} output, it accepts this
3713 directive but ignores it.
3714 @end ifset
3715 @end ifset
3716
3717 @ifset COFF
3718 @node Val
3719 @section @code{.val @var{addr}}
3720
3721 @cindex @code{val} directive
3722 @cindex COFF value attribute
3723 @cindex value attribute, COFF
3724 This directive, permitted only within @code{.def}/@code{.endef} pairs,
3725 records the address @var{addr} as the value attribute of a symbol table
3726 entry.
3727 @ifset BOUT
3728
3729 @samp{.val} is used only for COFF output; when @code{@value{AS}} is
3730 configured for @code{b.out}, it accepts this directive but ignores it.
3731 @end ifset
3732 @end ifset
3733
3734 @node Word
3735 @section @code{.word @var{expressions}}
3736
3737 @cindex @code{word} directive
3738 This directive expects zero or more @var{expressions}, of any section,
3739 separated by commas.
3740 @ifclear GENERIC
3741 @ifset W32
3742 For each expression, @code{@value{AS}} emits a 32-bit number.
3743 @end ifset
3744 @ifset W16
3745 For each expression, @code{@value{AS}} emits a 16-bit number.
3746 @end ifset
3747 @end ifclear
3748 @ifset GENERIC
3749
3750 The size of the number emitted, and its byte order,
3751 depend on what target computer the assembly is for.
3752 @end ifset
3753
3754 @c on amd29k, i960, sparc the "special treatment to support compilers" doesn't
3755 @c happen---32-bit addressability, period; no long/short jumps.
3756 @ifset DIFF-TBL-KLUGE
3757 @cindex difference tables altered
3758 @cindex altered difference tables
3759 @quotation
3760 @emph{Warning: Special Treatment to support Compilers}
3761 @end quotation
3762
3763 @ifset GENERIC
3764 Machines with a 32-bit address space, but that do less than 32-bit
3765 addressing, require the following special treatment. If the machine of
3766 interest to you does 32-bit addressing (or doesn't require it;
3767 @pxref{Machine Dependencies}), you can ignore this issue.
3768
3769 @end ifset
3770 In order to assemble compiler output into something that works,
3771 @code{@value{AS}} occasionlly does strange things to @samp{.word} directives.
3772 Directives of the form @samp{.word sym1-sym2} are often emitted by
3773 compilers as part of jump tables. Therefore, when @code{@value{AS}} assembles a
3774 directive of the form @samp{.word sym1-sym2}, and the difference between
3775 @code{sym1} and @code{sym2} does not fit in 16 bits, @code{@value{AS}}
3776 creates a @dfn{secondary jump table}, immediately before the next label.
3777 This secondary jump table is preceded by a short-jump to the
3778 first byte after the secondary table. This short-jump prevents the flow
3779 of control from accidentally falling into the new table. Inside the
3780 table is a long-jump to @code{sym2}. The original @samp{.word}
3781 contains @code{sym1} minus the address of the long-jump to
3782 @code{sym2}.
3783
3784 If there were several occurrences of @samp{.word sym1-sym2} before the
3785 secondary jump table, all of them are adjusted. If there was a
3786 @samp{.word sym3-sym4}, that also did not fit in sixteen bits, a
3787 long-jump to @code{sym4} is included in the secondary jump table,
3788 and the @code{.word} directives are adjusted to contain @code{sym3}
3789 minus the address of the long-jump to @code{sym4}; and so on, for as many
3790 entries in the original jump table as necessary.
3791
3792 @ifset INTERNALS
3793 @emph{This feature may be disabled by compiling @code{@value{AS}} with the
3794 @samp{-DWORKING_DOT_WORD} option.} This feature is likely to confuse
3795 assembly language programmers.
3796 @end ifset
3797 @end ifset
3798 @c end DIFF-TBL-KLUGE
3799
3800 @node Deprecated
3801 @section Deprecated Directives
3802
3803 @cindex deprecated directives
3804 @cindex obsolescent directives
3805 One day these directives won't work.
3806 They are included for compatibility with older assemblers.
3807 @table @t
3808 @item .abort
3809 @item .app-file
3810 @item .line
3811 @end table
3812
3813 @ifset GENERIC
3814 @node Machine Dependencies
3815 @chapter Machine Dependent Features
3816
3817 @cindex machine dependencies
3818 The machine instruction sets are (almost by definition) different on
3819 each machine where @code{@value{AS}} runs. Floating point representations
3820 vary as well, and @code{@value{AS}} often supports a few additional
3821 directives or command-line options for compatibility with other
3822 assemblers on a particular platform. Finally, some versions of
3823 @code{@value{AS}} support special pseudo-instructions for branch
3824 optimization.
3825
3826 This chapter discusses most of these differences, though it does not
3827 include details on any machine's instruction set. For details on that
3828 subject, see the hardware manufacturer's manual.
3829
3830 @menu
3831 @ifset VAX
3832 * Vax-Dependent:: VAX Dependent Features
3833 @end ifset
3834 @ifset A29K
3835 * AMD29K-Dependent:: AMD 29K Dependent Features
3836 @end ifset
3837 @ifset H8/300
3838 * H8/300-Dependent:: Hitachi H8/300 Dependent Features
3839 @end ifset
3840 @ifset H8/500
3841 * H8/500-Dependent:: Hitachi H8/500 Dependent Features
3842 @end ifset
3843 @ifset HPPA
3844 * HPPA-Dependent:: HPPA Dependent Features
3845 @end ifset
3846 @ifset SH
3847 * SH-Dependent:: Hitachi SH Dependent Features
3848 @end ifset
3849 @ifset I960
3850 * i960-Dependent:: Intel 80960 Dependent Features
3851 @end ifset
3852 @ifset M680X0
3853 * M68K-Dependent:: M680x0 Dependent Features
3854 @end ifset
3855 @ifset SPARC
3856 * Sparc-Dependent:: SPARC Dependent Features
3857 @end ifset
3858 @ifset Z8000
3859 * Z8000-Dependent:: Z8000 Dependent Features
3860 @end ifset
3861 @ifset MIPS
3862 * MIPS-Dependent:: MIPS Dependent Features
3863 @end ifset
3864 @ifset I80386
3865 * i386-Dependent:: 80386 Dependent Features
3866 @end ifset
3867 @end menu
3868
3869 @lowersections
3870 @end ifset
3871
3872 @c The following major nodes are *sections* in the GENERIC version, *chapters*
3873 @c in single-cpu versions. This is mainly achieved by @lowersections. There is a
3874 @c peculiarity: to preserve cross-references, there must be a node called
3875 @c "Machine Dependencies". Hence the conditional nodenames in each
3876 @c major node below. Node defaulting in makeinfo requires adjacency of
3877 @c node and sectioning commands; hence the repetition of @chapter BLAH
3878 @c in both conditional blocks.
3879 @c
3880 @ifset VAX
3881 @ifset GENERIC
3882 @node Vax-Dependent
3883 @chapter VAX Dependent Features
3884 @cindex VAX support
3885
3886 @end ifset
3887 @ifclear GENERIC
3888 @node Machine Dependencies
3889 @chapter VAX Dependent Features
3890 @cindex VAX support
3891
3892 @end ifclear
3893
3894 @menu
3895 * Vax-Opts:: VAX Command-Line Options
3896 * VAX-float:: VAX Floating Point
3897 * VAX-directives:: Vax Machine Directives
3898 * VAX-opcodes:: VAX Opcodes
3899 * VAX-branch:: VAX Branch Improvement
3900 * VAX-operands:: VAX Operands
3901 * VAX-no:: Not Supported on VAX
3902 @end menu
3903
3904
3905 @node Vax-Opts
3906 @section VAX Command-Line Options
3907
3908 @cindex command-line options ignored, VAX
3909 @cindex VAX command-line options ignored
3910 The Vax version of @code{@value{AS}} accepts any of the following options,
3911 gives a warning message that the option was ignored and proceeds.
3912 These options are for compatibility with scripts designed for other
3913 people's assemblers.
3914
3915 @table @code
3916 @item @code{-D} (Debug)
3917 @itemx @code{-S} (Symbol Table)
3918 @itemx @code{-T} (Token Trace)
3919 @cindex @code{-D}, ignored on VAX
3920 @cindex @code{-S}, ignored on VAX
3921 @cindex @code{-T}, ignored on VAX
3922 These are obsolete options used to debug old assemblers.
3923
3924 @item @code{-d} (Displacement size for JUMPs)
3925 @cindex @code{-d}, VAX option
3926 This option expects a number following the @samp{-d}. Like options
3927 that expect filenames, the number may immediately follow the
3928 @samp{-d} (old standard) or constitute the whole of the command line
3929 argument that follows @samp{-d} (@sc{gnu} standard).
3930
3931 @item @code{-V} (Virtualize Interpass Temporary File)
3932 @cindex @code{-V}, redundant on VAX
3933 Some other assemblers use a temporary file. This option
3934 commanded them to keep the information in active memory rather
3935 than in a disk file. @code{@value{AS}} always does this, so this
3936 option is redundant.
3937
3938 @item @code{-J} (JUMPify Longer Branches)
3939 @cindex @code{-J}, ignored on VAX
3940 Many 32-bit computers permit a variety of branch instructions
3941 to do the same job. Some of these instructions are short (and
3942 fast) but have a limited range; others are long (and slow) but
3943 can branch anywhere in virtual memory. Often there are 3
3944 flavors of branch: short, medium and long. Some other
3945 assemblers would emit short and medium branches, unless told by
3946 this option to emit short and long branches.
3947
3948 @item @code{-t} (Temporary File Directory)
3949 @cindex @code{-t}, ignored on VAX
3950 Some other assemblers may use a temporary file, and this option
3951 takes a filename being the directory to site the temporary
3952 file. Since @code{@value{AS}} does not use a temporary disk file, this
3953 option makes no difference. @samp{-t} needs exactly one
3954 filename.
3955 @end table
3956
3957 @cindex VMS (VAX) options
3958 @cindex options for VAX/VMS
3959 @cindex VAX/VMS options
3960 @cindex @code{-h} option, VAX/VMS
3961 @cindex @code{-+} option, VAX/VMS
3962 @cindex Vax-11 C compatibility
3963 @cindex symbols with lowercase, VAX/VMS
3964 @c FIXME! look into "I think" below, correct if needed, delete.
3965 The Vax version of the assembler accepts two options when
3966 compiled for VMS. They are @samp{-h}, and @samp{-+}. The
3967 @samp{-h} option prevents @code{@value{AS}} from modifying the
3968 symbol-table entries for symbols that contain lowercase
3969 characters (I think). The @samp{-+} option causes @code{@value{AS}} to
3970 print warning messages if the FILENAME part of the object file,
3971 or any symbol name is larger than 31 characters. The @samp{-+}
3972 option also inserts some code following the @samp{_main}
3973 symbol so that the object file is compatible with Vax-11
3974 "C".
3975
3976 @node VAX-float
3977 @section VAX Floating Point
3978
3979 @cindex VAX floating point
3980 @cindex floating point, VAX
3981 Conversion of flonums to floating point is correct, and
3982 compatible with previous assemblers. Rounding is
3983 towards zero if the remainder is exactly half the least significant bit.
3984
3985 @code{D}, @code{F}, @code{G} and @code{H} floating point formats
3986 are understood.
3987
3988 Immediate floating literals (@emph{e.g.} @samp{S`$6.9})
3989 are rendered correctly. Again, rounding is towards zero in the
3990 boundary case.
3991
3992 @cindex @code{float} directive, VAX
3993 @cindex @code{double} directive, VAX
3994 The @code{.float} directive produces @code{f} format numbers.
3995 The @code{.double} directive produces @code{d} format numbers.
3996
3997 @node VAX-directives
3998 @section Vax Machine Directives
3999
4000 @cindex machine directives, VAX
4001 @cindex VAX machine directives
4002 The Vax version of the assembler supports four directives for
4003 generating Vax floating point constants. They are described in the
4004 table below.
4005
4006 @cindex wide floating point directives, VAX
4007 @table @code
4008 @item .dfloat
4009 @cindex @code{dfloat} directive, VAX
4010 This expects zero or more flonums, separated by commas, and
4011 assembles Vax @code{d} format 64-bit floating point constants.
4012
4013 @item .ffloat
4014 @cindex @code{ffloat} directive, VAX
4015 This expects zero or more flonums, separated by commas, and
4016 assembles Vax @code{f} format 32-bit floating point constants.
4017
4018 @item .gfloat
4019 @cindex @code{gfloat} directive, VAX
4020 This expects zero or more flonums, separated by commas, and
4021 assembles Vax @code{g} format 64-bit floating point constants.
4022
4023 @item .hfloat
4024 @cindex @code{hfloat} directive, VAX
4025 This expects zero or more flonums, separated by commas, and
4026 assembles Vax @code{h} format 128-bit floating point constants.
4027
4028 @end table
4029
4030 @node VAX-opcodes
4031 @section VAX Opcodes
4032
4033 @cindex VAX opcode mnemonics
4034 @cindex opcode mnemonics, VAX
4035 @cindex mnemonics for opcodes, VAX
4036 All DEC mnemonics are supported. Beware that @code{case@dots{}}
4037 instructions have exactly 3 operands. The dispatch table that
4038 follows the @code{case@dots{}} instruction should be made with
4039 @code{.word} statements. This is compatible with all unix
4040 assemblers we know of.
4041
4042 @node VAX-branch
4043 @section VAX Branch Improvement
4044
4045 @cindex VAX branch improvement
4046 @cindex branch improvement, VAX
4047 @cindex pseudo-ops for branch, VAX
4048 Certain pseudo opcodes are permitted. They are for branch
4049 instructions. They expand to the shortest branch instruction that
4050 reaches the target. Generally these mnemonics are made by
4051 substituting @samp{j} for @samp{b} at the start of a DEC mnemonic.
4052 This feature is included both for compatibility and to help
4053 compilers. If you do not need this feature, avoid these
4054 opcodes. Here are the mnemonics, and the code they can expand into.
4055
4056 @table @code
4057 @item jbsb
4058 @samp{Jsb} is already an instruction mnemonic, so we chose @samp{jbsb}.
4059 @table @asis
4060 @item (byte displacement)
4061 @kbd{bsbb @dots{}}
4062 @item (word displacement)
4063 @kbd{bsbw @dots{}}
4064 @item (long displacement)
4065 @kbd{jsb @dots{}}
4066 @end table
4067 @item jbr
4068 @itemx jr
4069 Unconditional branch.
4070 @table @asis
4071 @item (byte displacement)
4072 @kbd{brb @dots{}}
4073 @item (word displacement)
4074 @kbd{brw @dots{}}
4075 @item (long displacement)
4076 @kbd{jmp @dots{}}
4077 @end table
4078 @item j@var{COND}
4079 @var{COND} may be any one of the conditional branches
4080 @code{neq}, @code{nequ}, @code{eql}, @code{eqlu}, @code{gtr},
4081 @code{geq}, @code{lss}, @code{gtru}, @code{lequ}, @code{vc}, @code{vs},
4082 @code{gequ}, @code{cc}, @code{lssu}, @code{cs}.
4083 @var{COND} may also be one of the bit tests
4084 @code{bs}, @code{bc}, @code{bss}, @code{bcs}, @code{bsc}, @code{bcc},
4085 @code{bssi}, @code{bcci}, @code{lbs}, @code{lbc}.
4086 @var{NOTCOND} is the opposite condition to @var{COND}.
4087 @table @asis
4088 @item (byte displacement)
4089 @kbd{b@var{COND} @dots{}}
4090 @item (word displacement)
4091 @kbd{b@var{NOTCOND} foo ; brw @dots{} ; foo:}
4092 @item (long displacement)
4093 @kbd{b@var{NOTCOND} foo ; jmp @dots{} ; foo:}
4094 @end table
4095 @item jacb@var{X}
4096 @var{X} may be one of @code{b d f g h l w}.
4097 @table @asis
4098 @item (word displacement)
4099 @kbd{@var{OPCODE} @dots{}}
4100 @item (long displacement)
4101 @example
4102 @var{OPCODE} @dots{}, foo ;
4103 brb bar ;
4104 foo: jmp @dots{} ;
4105 bar:
4106 @end example
4107 @end table
4108 @item jaob@var{YYY}
4109 @var{YYY} may be one of @code{lss leq}.
4110 @item jsob@var{ZZZ}
4111 @var{ZZZ} may be one of @code{geq gtr}.
4112 @table @asis
4113 @item (byte displacement)
4114 @kbd{@var{OPCODE} @dots{}}
4115 @item (word displacement)
4116 @example
4117 @var{OPCODE} @dots{}, foo ;
4118 brb bar ;
4119 foo: brw @var{destination} ;
4120 bar:
4121 @end example
4122 @item (long displacement)
4123 @example
4124 @var{OPCODE} @dots{}, foo ;
4125 brb bar ;
4126 foo: jmp @var{destination} ;
4127 bar:
4128 @end example
4129 @end table
4130 @item aobleq
4131 @itemx aoblss
4132 @itemx sobgeq
4133 @itemx sobgtr
4134 @table @asis
4135 @item (byte displacement)
4136 @kbd{@var{OPCODE} @dots{}}
4137 @item (word displacement)
4138 @example
4139 @var{OPCODE} @dots{}, foo ;
4140 brb bar ;
4141 foo: brw @var{destination} ;
4142 bar:
4143 @end example
4144 @item (long displacement)
4145 @example
4146 @var{OPCODE} @dots{}, foo ;
4147 brb bar ;
4148 foo: jmp @var{destination} ;
4149 bar:
4150 @end example
4151 @end table
4152 @end table
4153
4154 @node VAX-operands
4155 @section VAX Operands
4156
4157 @cindex VAX operand notation
4158 @cindex operand notation, VAX
4159 @cindex immediate character, VAX
4160 @cindex VAX immediate character
4161 The immediate character is @samp{$} for Unix compatibility, not
4162 @samp{#} as DEC writes it.
4163
4164 @cindex indirect character, VAX
4165 @cindex VAX indirect character
4166 The indirect character is @samp{*} for Unix compatibility, not
4167 @samp{@@} as DEC writes it.
4168
4169 @cindex displacement sizing character, VAX
4170 @cindex VAX displacement sizing character
4171 The displacement sizing character is @samp{`} (an accent grave) for
4172 Unix compatibility, not @samp{^} as DEC writes it. The letter
4173 preceding @samp{`} may have either case. @samp{G} is not
4174 understood, but all other letters (@code{b i l s w}) are understood.
4175
4176 @cindex register names, VAX
4177 @cindex VAX register names
4178 Register names understood are @code{r0 r1 r2 @dots{} r15 ap fp sp
4179 pc}. Upper and lower case letters are equivalent.
4180
4181 For instance
4182 @smallexample
4183 tstb *w`$4(r5)
4184 @end smallexample
4185
4186 Any expression is permitted in an operand. Operands are comma
4187 separated.
4188
4189 @c There is some bug to do with recognizing expressions
4190 @c in operands, but I forget what it is. It is
4191 @c a syntax clash because () is used as an address mode
4192 @c and to encapsulate sub-expressions.
4193
4194 @node VAX-no
4195 @section Not Supported on VAX
4196
4197 @cindex VAX bitfields not supported
4198 @cindex bitfields, not supported on VAX
4199 Vax bit fields can not be assembled with @code{@value{AS}}. Someone
4200 can add the required code if they really need it.
4201
4202 @end ifset
4203 @ifset A29K
4204 @ifset GENERIC
4205 @page
4206 @node AMD29K-Dependent
4207 @chapter AMD 29K Dependent Features
4208 @end ifset
4209 @ifclear GENERIC
4210 @node Machine Dependencies
4211 @chapter AMD 29K Dependent Features
4212 @end ifclear
4213
4214 @cindex AMD 29K support
4215 @cindex 29K support
4216 @menu
4217 * AMD29K Options:: Options
4218 * AMD29K Syntax:: Syntax
4219 * AMD29K Floating Point:: Floating Point
4220 * AMD29K Directives:: AMD 29K Machine Directives
4221 * AMD29K Opcodes:: Opcodes
4222 @end menu
4223
4224 @node AMD29K Options
4225 @section Options
4226 @cindex AMD 29K options (none)
4227 @cindex options for AMD29K (none)
4228 @code{@value{AS}} has no additional command-line options for the AMD
4229 29K family.
4230
4231 @node AMD29K Syntax
4232 @section Syntax
4233 @menu
4234 * AMD29K-Chars:: Special Characters
4235 * AMD29K-Regs:: Register Names
4236 @end menu
4237
4238 @node AMD29K-Chars
4239 @subsection Special Characters
4240
4241 @cindex line comment character, AMD 29K
4242 @cindex AMD 29K line comment character
4243 @samp{;} is the line comment character.
4244
4245 @cindex line separator, AMD 29K
4246 @cindex AMD 29K line separator
4247 @cindex statement separator, AMD 29K
4248 @cindex AMD 29K statement separator
4249 @samp{@@} can be used instead of a newline to separate statements.
4250
4251 @cindex identifiers, AMD 29K
4252 @cindex AMD 29K identifiers
4253 The character @samp{?} is permitted in identifiers (but may not begin
4254 an identifier).
4255
4256 @node AMD29K-Regs
4257 @subsection Register Names
4258
4259 @cindex AMD 29K register names
4260 @cindex register names, AMD 29K
4261 General-purpose registers are represented by predefined symbols of the
4262 form @samp{GR@var{nnn}} (for global registers) or @samp{LR@var{nnn}}
4263 (for local registers), where @var{nnn} represents a number between
4264 @code{0} and @code{127}, written with no leading zeros. The leading
4265 letters may be in either upper or lower case; for example, @samp{gr13}
4266 and @samp{LR7} are both valid register names.
4267
4268 You may also refer to general-purpose registers by specifying the
4269 register number as the result of an expression (prefixed with @samp{%%}
4270 to flag the expression as a register number):
4271 @smallexample
4272 %%@var{expression}
4273 @end smallexample
4274 @noindent
4275 ---where @var{expression} must be an absolute expression evaluating to a
4276 number between @code{0} and @code{255}. The range [0, 127] refers to
4277 global registers, and the range [128, 255] to local registers.
4278
4279 @cindex special purpose registers, AMD 29K
4280 @cindex AMD 29K special purpose registers
4281 @cindex protected registers, AMD 29K
4282 @cindex AMD 29K protected registers
4283 In addition, @code{@value{AS}} understands the following protected
4284 special-purpose register names for the AMD 29K family:
4285
4286 @smallexample
4287 vab chd pc0
4288 ops chc pc1
4289 cps rbp pc2
4290 cfg tmc mmu
4291 cha tmr lru
4292 @end smallexample
4293
4294 These unprotected special-purpose register names are also recognized:
4295 @smallexample
4296 ipc alu fpe
4297 ipa bp inte
4298 ipb fc fps
4299 q cr exop
4300 @end smallexample
4301
4302 @node AMD29K Floating Point
4303 @section Floating Point
4304
4305 @cindex floating point, AMD 29K (@sc{ieee})
4306 @cindex AMD 29K floating point (@sc{ieee})
4307 The AMD 29K family uses @sc{ieee} floating-point numbers.
4308
4309 @node AMD29K Directives
4310 @section AMD 29K Machine Directives
4311
4312 @cindex machine directives, AMD 29K
4313 @cindex AMD 29K machine directives
4314 @table @code
4315 @item .block @var{size} , @var{fill}
4316 @cindex @code{block} directive, AMD 29K
4317 This directive emits @var{size} bytes, each of value @var{fill}. Both
4318 @var{size} and @var{fill} are absolute expressions. If the comma
4319 and @var{fill} are omitted, @var{fill} is assumed to be zero.
4320
4321 In other versions of the @sc{gnu} assembler, this directive is called
4322 @samp{.space}.
4323 @end table
4324
4325 @table @code
4326 @item .cputype
4327 @cindex @code{cputype} directive, AMD 29K
4328 This directive is ignored; it is accepted for compatibility with other
4329 AMD 29K assemblers.
4330
4331 @item .file
4332 @cindex @code{file} directive, AMD 29K
4333 This directive is ignored; it is accepted for compatibility with other
4334 AMD 29K assemblers.
4335
4336 @quotation
4337 @emph{Warning:} in other versions of the @sc{gnu} assembler, @code{.file} is
4338 used for the directive called @code{.app-file} in the AMD 29K support.
4339 @end quotation
4340
4341 @item .line
4342 @cindex @code{line} directive, AMD 29K
4343 This directive is ignored; it is accepted for compatibility with other
4344 AMD 29K assemblers.
4345
4346 @ignore
4347 @c since we're ignoring .lsym...
4348 @item .reg @var{symbol}, @var{expression}
4349 @cindex @code{reg} directive, AMD 29K
4350 @code{.reg} has the same effect as @code{.lsym}; @pxref{Lsym,,@code{.lsym}}.
4351 @end ignore
4352
4353 @item .sect
4354 @cindex @code{sect} directive, AMD 29K
4355 This directive is ignored; it is accepted for compatibility with other
4356 AMD 29K assemblers.
4357
4358 @item .use @var{section name}
4359 @cindex @code{use} directive, AMD 29K
4360 Establishes the section and subsection for the following code;
4361 @var{section name} may be one of @code{.text}, @code{.data},
4362 @code{.data1}, or @code{.lit}. With one of the first three @var{section
4363 name} options, @samp{.use} is equivalent to the machine directive
4364 @var{section name}; the remaining case, @samp{.use .lit}, is the same as
4365 @samp{.data 200}.
4366 @end table
4367
4368 @node AMD29K Opcodes
4369 @section Opcodes
4370
4371 @cindex AMD 29K opcodes
4372 @cindex opcodes for AMD 29K
4373 @code{@value{AS}} implements all the standard AMD 29K opcodes. No
4374 additional pseudo-instructions are needed on this family.
4375
4376 For information on the 29K machine instruction set, see @cite{Am29000
4377 User's Manual}, Advanced Micro Devices, Inc.
4378
4379 @end ifset
4380 @ifset Hitachi-all
4381 @ifclear GENERIC
4382 @node Machine Dependencies
4383 @chapter Machine Dependent Features
4384
4385 The machine instruction sets are different on each Hitachi chip family,
4386 and there are also some syntax differences among the families. This
4387 chapter describes the specific @code{@value{AS}} features for each
4388 family.
4389
4390 @menu
4391 * H8/300-Dependent:: Hitachi H8/300 Dependent Features
4392 * H8/500-Dependent:: Hitachi H8/500 Dependent Features
4393 * SH-Dependent:: Hitachi SH Dependent Features
4394 @end menu
4395 @lowersections
4396 @end ifclear
4397 @end ifset
4398
4399 @ifset H8/300
4400 @ifset GENERIC
4401 @page
4402 @end ifset
4403 @node H8/300-Dependent
4404 @chapter H8/300 Dependent Features
4405
4406 @cindex H8/300 support
4407 @menu
4408 * H8/300 Options:: Options
4409 * H8/300 Syntax:: Syntax
4410 * H8/300 Floating Point:: Floating Point
4411 * H8/300 Directives:: H8/300 Machine Directives
4412 * H8/300 Opcodes:: Opcodes
4413 @end menu
4414
4415 @node H8/300 Options
4416 @section Options
4417
4418 @cindex H8/300 options (none)
4419 @cindex options, H8/300 (none)
4420 @code{@value{AS}} has no additional command-line options for the Hitachi
4421 H8/300 family.
4422
4423 @node H8/300 Syntax
4424 @section Syntax
4425 @menu
4426 * H8/300-Chars:: Special Characters
4427 * H8/300-Regs:: Register Names
4428 * H8/300-Addressing:: Addressing Modes
4429 @end menu
4430
4431 @node H8/300-Chars
4432 @subsection Special Characters
4433
4434 @cindex line comment character, H8/300
4435 @cindex H8/300 line comment character
4436 @samp{;} is the line comment character.
4437
4438 @cindex line separator, H8/300
4439 @cindex statement separator, H8/300
4440 @cindex H8/300 line separator
4441 @samp{$} can be used instead of a newline to separate statements.
4442 Therefore @emph{you may not use @samp{$} in symbol names} on the H8/300.
4443
4444 @node H8/300-Regs
4445 @subsection Register Names
4446
4447 @cindex H8/300 registers
4448 @cindex register names, H8/300
4449 You can use predefined symbols of the form @samp{r@var{n}h} and
4450 @samp{r@var{n}l} to refer to the H8/300 registers as sixteen 8-bit
4451 general-purpose registers. @var{n} is a digit from @samp{0} to
4452 @samp{7}); for instance, both @samp{r0h} and @samp{r7l} are valid
4453 register names.
4454
4455 You can also use the eight predefined symbols @samp{r@var{n}} to refer
4456 to the H8/300 registers as 16-bit registers (you must use this form for
4457 addressing).
4458
4459 On the H8/300H, you can also use the eight predefined symbols
4460 @samp{er@var{n}} (@samp{er0} @dots{} @samp{er7}) to refer to the 32-bit
4461 general purpose registers.
4462
4463 The two control registers are called @code{pc} (program counter; a
4464 16-bit register, except on the H8/300H where it is 24 bits) and
4465 @code{ccr} (condition code register; an 8-bit register). @code{r7} is
4466 used as the stack pointer, and can also be called @code{sp}.
4467
4468 @node H8/300-Addressing
4469 @subsection Addressing Modes
4470
4471 @cindex addressing modes, H8/300
4472 @cindex H8/300 addressing modes
4473 @value{AS} understands the following addressing modes for the H8/300:
4474 @table @code
4475 @item r@var{n}
4476 Register direct
4477
4478 @item @@r@var{n}
4479 Register indirect
4480
4481 @item @@(@var{d}, r@var{n})
4482 @itemx @@(@var{d}:16, r@var{n})
4483 @itemx @@(@var{d}:24, r@var{n})
4484 Register indirect: 16-bit or 24-bit displacement @var{d} from register
4485 @var{n}. (24-bit displacements are only meaningful on the H8/300H.)
4486
4487 @item @@r@var{n}+
4488 Register indirect with post-increment
4489
4490 @item @@-r@var{n}
4491 Register indirect with pre-decrement
4492
4493 @item @code{@@}@var{aa}
4494 @itemx @code{@@}@var{aa}:8
4495 @itemx @code{@@}@var{aa}:16
4496 @itemx @code{@@}@var{aa}:24
4497 Absolute address @code{aa}. (The address size @samp{:24} only makes
4498 sense on the H8/300H.)
4499
4500 @item #@var{xx}
4501 @itemx #@var{xx}:8
4502 @itemx #@var{xx}:16
4503 @itemx #@var{xx}:32
4504 Immediate data @var{xx}. You may specify the @samp{:8}, @samp{:16}, or
4505 @samp{:32} for clarity, if you wish; but @code{@value{AS}} neither
4506 requires this nor uses it---the data size required is taken from
4507 context.
4508
4509 @item @code{@@}@code{@@}@var{aa}
4510 @itemx @code{@@}@code{@@}@var{aa}:8
4511 Memory indirect. You may specify the @samp{:8} for clarity, if you
4512 wish; but @code{@value{AS}} neither requires this nor uses it.
4513 @end table
4514
4515 @node H8/300 Floating Point
4516 @section Floating Point
4517
4518 @cindex floating point, H8/300 (@sc{ieee})
4519 @cindex H8/300 floating point (@sc{ieee})
4520 The H8/300 family has no hardware floating point, but the @code{.float}
4521 directive generates @sc{ieee} floating-point numbers for compatibility
4522 with other development tools.
4523
4524 @page
4525 @node H8/300 Directives
4526 @section H8/300 Machine Directives
4527
4528 @cindex H8/300 machine directives (none)
4529 @cindex machine directives, H8/300 (none)
4530 @cindex @code{word} directive, H8/300
4531 @cindex @code{int} directive, H8/300
4532 @code{@value{AS}} has only one machine-dependent directive for the
4533 H8/300:
4534
4535 @table @code
4536 @cindex H8/300H, assembling for
4537 @item .h8300h
4538 Recognize and emit additional instructions for the H8/300H variant, and
4539 also make @code{.int} emit 32-bit numbers rather than the usual (16-bit)
4540 for the H8/300 family.
4541 @end table
4542
4543 On the H8/300 family (including the H8/300H) @samp{.word} directives
4544 generate 16-bit numbers.
4545
4546 @node H8/300 Opcodes
4547 @section Opcodes
4548
4549 @cindex H8/300 opcode summary
4550 @cindex opcode summary, H8/300
4551 @cindex mnemonics, H8/300
4552 @cindex instruction summary, H8/300
4553 For detailed information on the H8/300 machine instruction set, see
4554 @cite{H8/300 Series Programming Manual} (Hitachi ADE--602--025). For
4555 information specific to the H8/300H, see @cite{H8/300H Series
4556 Programming Manual} (Hitachi).
4557
4558 @code{@value{AS}} implements all the standard H8/300 opcodes. No additional
4559 pseudo-instructions are needed on this family.
4560
4561 @ifset SMALL
4562 @c this table, due to the multi-col faking and hardcoded order, looks silly
4563 @c except in smallbook. See comments below "@set SMALL" near top of this file.
4564
4565 The following table summarizes the H8/300 opcodes, and their arguments.
4566 Entries marked @samp{*} are opcodes used only on the H8/300H.
4567
4568 @smallexample
4569 @c Using @group seems to use the normal baselineskip, not the smallexample
4570 @c baselineskip; looks approx doublespaced.
4571 @i{Legend:}
4572 Rs @r{source register}
4573 Rd @r{destination register}
4574 abs @r{absolute address}
4575 imm @r{immediate data}
4576 disp:N @r{N-bit displacement from a register}
4577 pcrel:N @r{N-bit displacement relative to program counter}
4578
4579 add.b #imm,rd * andc #imm,ccr
4580 add.b rs,rd band #imm,rd
4581 add.w rs,rd band #imm,@@rd
4582 * add.w #imm,rd band #imm,@@abs:8
4583 * add.l rs,rd bra pcrel:8
4584 * add.l #imm,rd * bra pcrel:16
4585 adds #imm,rd bt pcrel:8
4586 addx #imm,rd * bt pcrel:16
4587 addx rs,rd brn pcrel:8
4588 and.b #imm,rd * brn pcrel:16
4589 and.b rs,rd bf pcrel:8
4590 * and.w rs,rd * bf pcrel:16
4591 * and.w #imm,rd bhi pcrel:8
4592 * and.l #imm,rd * bhi pcrel:16
4593 * and.l rs,rd bls pcrel:8
4594 @page
4595 * bls pcrel:16 bld #imm,rd
4596 bcc pcrel:8 bld #imm,@@rd
4597 * bcc pcrel:16 bld #imm,@@abs:8
4598 bhs pcrel:8 bnot #imm,rd
4599 * bhs pcrel:16 bnot #imm,@@rd
4600 bcs pcrel:8 bnot #imm,@@abs:8
4601 * bcs pcrel:16 bnot rs,rd
4602 blo pcrel:8 bnot rs,@@rd
4603 * blo pcrel:16 bnot rs,@@abs:8
4604 bne pcrel:8 bor #imm,rd
4605 * bne pcrel:16 bor #imm,@@rd
4606 beq pcrel:8 bor #imm,@@abs:8
4607 * beq pcrel:16 bset #imm,rd
4608 bvc pcrel:8 bset #imm,@@rd
4609 * bvc pcrel:16 bset #imm,@@abs:8
4610 bvs pcrel:8 bset rs,rd
4611 * bvs pcrel:16 bset rs,@@rd
4612 bpl pcrel:8 bset rs,@@abs:8
4613 * bpl pcrel:16 bsr pcrel:8
4614 bmi pcrel:8 bsr pcrel:16
4615 * bmi pcrel:16 bst #imm,rd
4616 bge pcrel:8 bst #imm,@@rd
4617 * bge pcrel:16 bst #imm,@@abs:8
4618 blt pcrel:8 btst #imm,rd
4619 * blt pcrel:16 btst #imm,@@rd
4620 bgt pcrel:8 btst #imm,@@abs:8
4621 * bgt pcrel:16 btst rs,rd
4622 ble pcrel:8 btst rs,@@rd
4623 * ble pcrel:16 btst rs,@@abs:8
4624 bclr #imm,rd bxor #imm,rd
4625 bclr #imm,@@rd bxor #imm,@@rd
4626 bclr #imm,@@abs:8 bxor #imm,@@abs:8
4627 bclr rs,rd cmp.b #imm,rd
4628 bclr rs,@@rd cmp.b rs,rd
4629 bclr rs,@@abs:8 cmp.w rs,rd
4630 biand #imm,rd cmp.w rs,rd
4631 biand #imm,@@rd * cmp.w #imm,rd
4632 biand #imm,@@abs:8 * cmp.l #imm,rd
4633 bild #imm,rd * cmp.l rs,rd
4634 bild #imm,@@rd daa rs
4635 bild #imm,@@abs:8 das rs
4636 bior #imm,rd dec.b rs
4637 bior #imm,@@rd * dec.w #imm,rd
4638 bior #imm,@@abs:8 * dec.l #imm,rd
4639 bist #imm,rd divxu.b rs,rd
4640 bist #imm,@@rd * divxu.w rs,rd
4641 bist #imm,@@abs:8 * divxs.b rs,rd
4642 bixor #imm,rd * divxs.w rs,rd
4643 bixor #imm,@@rd eepmov
4644 bixor #imm,@@abs:8 * eepmovw
4645 @page
4646 * exts.w rd mov.w rs,@@abs:16
4647 * exts.l rd * mov.l #imm,rd
4648 * extu.w rd * mov.l rs,rd
4649 * extu.l rd * mov.l @@rs,rd
4650 inc rs * mov.l @@(disp:16,rs),rd
4651 * inc.w #imm,rd * mov.l @@(disp:24,rs),rd
4652 * inc.l #imm,rd * mov.l @@rs+,rd
4653 jmp @@rs * mov.l @@abs:16,rd
4654 jmp abs * mov.l @@abs:24,rd
4655 jmp @@@@abs:8 * mov.l rs,@@rd
4656 jsr @@rs * mov.l rs,@@(disp:16,rd)
4657 jsr abs * mov.l rs,@@(disp:24,rd)
4658 jsr @@@@abs:8 * mov.l rs,@@-rd
4659 ldc #imm,ccr * mov.l rs,@@abs:16
4660 ldc rs,ccr * mov.l rs,@@abs:24
4661 * ldc @@abs:16,ccr movfpe @@abs:16,rd
4662 * ldc @@abs:24,ccr movtpe rs,@@abs:16
4663 * ldc @@(disp:16,rs),ccr mulxu.b rs,rd
4664 * ldc @@(disp:24,rs),ccr * mulxu.w rs,rd
4665 * ldc @@rs+,ccr * mulxs.b rs,rd
4666 * ldc @@rs,ccr * mulxs.w rs,rd
4667 * mov.b @@(disp:24,rs),rd neg.b rs
4668 * mov.b rs,@@(disp:24,rd) * neg.w rs
4669 mov.b @@abs:16,rd * neg.l rs
4670 mov.b rs,rd nop
4671 mov.b @@abs:8,rd not.b rs
4672 mov.b rs,@@abs:8 * not.w rs
4673 mov.b rs,rd * not.l rs
4674 mov.b #imm,rd or.b #imm,rd
4675 mov.b @@rs,rd or.b rs,rd
4676 mov.b @@(disp:16,rs),rd * or.w #imm,rd
4677 mov.b @@rs+,rd * or.w rs,rd
4678 mov.b @@abs:8,rd * or.l #imm,rd
4679 mov.b rs,@@rd * or.l rs,rd
4680 mov.b rs,@@(disp:16,rd) orc #imm,ccr
4681 mov.b rs,@@-rd pop.w rs
4682 mov.b rs,@@abs:8 * pop.l rs
4683 mov.w rs,@@rd push.w rs
4684 * mov.w @@(disp:24,rs),rd * push.l rs
4685 * mov.w rs,@@(disp:24,rd) rotl.b rs
4686 * mov.w @@abs:24,rd * rotl.w rs
4687 * mov.w rs,@@abs:24 * rotl.l rs
4688 mov.w rs,rd rotr.b rs
4689 mov.w #imm,rd * rotr.w rs
4690 mov.w @@rs,rd * rotr.l rs
4691 mov.w @@(disp:16,rs),rd rotxl.b rs
4692 mov.w @@rs+,rd * rotxl.w rs
4693 mov.w @@abs:16,rd * rotxl.l rs
4694 mov.w rs,@@(disp:16,rd) rotxr.b rs
4695 mov.w rs,@@-rd * rotxr.w rs
4696 @page
4697 * rotxr.l rs * stc ccr,@@(disp:24,rd)
4698 bpt * stc ccr,@@-rd
4699 rte * stc ccr,@@abs:16
4700 rts * stc ccr,@@abs:24
4701 shal.b rs sub.b rs,rd
4702 * shal.w rs sub.w rs,rd
4703 * shal.l rs * sub.w #imm,rd
4704 shar.b rs * sub.l rs,rd
4705 * shar.w rs * sub.l #imm,rd
4706 * shar.l rs subs #imm,rd
4707 shll.b rs subx #imm,rd
4708 * shll.w rs subx rs,rd
4709 * shll.l rs * trapa #imm
4710 shlr.b rs xor #imm,rd
4711 * shlr.w rs xor rs,rd
4712 * shlr.l rs * xor.w #imm,rd
4713 sleep * xor.w rs,rd
4714 stc ccr,rd * xor.l #imm,rd
4715 * stc ccr,@@rs * xor.l rs,rd
4716 * stc ccr,@@(disp:16,rd) xorc #imm,ccr
4717 @end smallexample
4718 @end ifset
4719
4720 @cindex size suffixes, H8/300
4721 @cindex H8/300 size suffixes
4722 Four H8/300 instructions (@code{add}, @code{cmp}, @code{mov},
4723 @code{sub}) are defined with variants using the suffixes @samp{.b},
4724 @samp{.w}, and @samp{.l} to specify the size of a memory operand.
4725 @code{@value{AS}} supports these suffixes, but does not require them;
4726 since one of the operands is always a register, @code{@value{AS}} can
4727 deduce the correct size.
4728
4729 For example, since @code{r0} refers to a 16-bit register,
4730 @example
4731 mov r0,@@foo
4732 @exdent is equivalent to
4733 mov.w r0,@@foo
4734 @end example
4735
4736 If you use the size suffixes, @code{@value{AS}} issues a warning when
4737 the suffix and the register size do not match.
4738 @end ifset
4739
4740 @ifset H8/500
4741 @page
4742 @node H8/500-Dependent
4743 @chapter H8/500 Dependent Features
4744
4745 @cindex H8/500 support
4746 @menu
4747 * H8/500 Options:: Options
4748 * H8/500 Syntax:: Syntax
4749 * H8/500 Floating Point:: Floating Point
4750 * H8/500 Directives:: H8/500 Machine Directives
4751 * H8/500 Opcodes:: Opcodes
4752 @end menu
4753
4754 @node H8/500 Options
4755 @section Options
4756
4757 @cindex H8/500 options (none)
4758 @cindex options, H8/500 (none)
4759 @code{@value{AS}} has no additional command-line options for the Hitachi
4760 H8/500 family.
4761
4762 @node H8/500 Syntax
4763 @section Syntax
4764
4765 @menu
4766 * H8/500-Chars:: Special Characters
4767 * H8/500-Regs:: Register Names
4768 * H8/500-Addressing:: Addressing Modes
4769 @end menu
4770
4771 @node H8/500-Chars
4772 @subsection Special Characters
4773
4774 @cindex line comment character, H8/500
4775 @cindex H8/500 line comment character
4776 @samp{!} is the line comment character.
4777
4778 @cindex line separator, H8/500
4779 @cindex statement separator, H8/500
4780 @cindex H8/500 line separator
4781 @samp{;} can be used instead of a newline to separate statements.
4782
4783 @cindex symbol names, @samp{$} in
4784 @cindex @code{$} in symbol names
4785 Since @samp{$} has no special meaning, you may use it in symbol names.
4786
4787 @node H8/500-Regs
4788 @subsection Register Names
4789
4790 @cindex H8/500 registers
4791 @cindex registers, H8/500
4792 You can use the predefined symbols @samp{r0}, @samp{r1}, @samp{r2},
4793 @samp{r3}, @samp{r4}, @samp{r5}, @samp{r6}, and @samp{r7} to refer to
4794 the H8/500 registers.
4795
4796 The H8/500 also has these control registers:
4797
4798 @table @code
4799 @item cp
4800 code pointer
4801
4802 @item dp
4803 data pointer
4804
4805 @item bp
4806 base pointer
4807
4808 @item tp
4809 stack top pointer
4810
4811 @item ep
4812 extra pointer
4813
4814 @item sr
4815 status register
4816
4817 @item ccr
4818 condition code register
4819 @end table
4820
4821 All registers are 16 bits long. To represent 32 bit numbers, use two
4822 adjacent registers; for distant memory addresses, use one of the segment
4823 pointers (@code{cp} for the program counter; @code{dp} for
4824 @code{r0}--@code{r3}; @code{ep} for @code{r4} and @code{r5}; and
4825 @code{tp} for @code{r6} and @code{r7}.
4826
4827 @node H8/500-Addressing
4828 @subsection Addressing Modes
4829
4830 @cindex addressing modes, H8/500
4831 @cindex H8/500 addressing modes
4832 @value{AS} understands the following addressing modes for the H8/500:
4833 @table @code
4834 @item R@var{n}
4835 Register direct
4836
4837 @item @@R@var{n}
4838 Register indirect
4839
4840 @item @@(d:8, R@var{n})
4841 Register indirect with 8 bit signed displacement
4842
4843 @item @@(d:16, R@var{n})
4844 Register indirect with 16 bit signed displacement
4845
4846 @item @@-R@var{n}
4847 Register indirect with pre-decrement
4848
4849 @item @@R@var{n}+
4850 Register indirect with post-increment
4851
4852 @item @@@var{aa}:8
4853 8 bit absolute address
4854
4855 @item @@@var{aa}:16
4856 16 bit absolute address
4857
4858 @item #@var{xx}:8
4859 8 bit immediate
4860
4861 @item #@var{xx}:16
4862 16 bit immediate
4863 @end table
4864
4865 @node H8/500 Floating Point
4866 @section Floating Point
4867
4868 @cindex floating point, H8/500 (@sc{ieee})
4869 @cindex H8/500 floating point (@sc{ieee})
4870 The H8/500 family uses @sc{ieee} floating-point numbers.
4871
4872 @node H8/500 Directives
4873 @section H8/500 Machine Directives
4874
4875 @cindex H8/500 machine directives (none)
4876 @cindex machine directives, H8/500 (none)
4877 @cindex @code{word} directive, H8/500
4878 @cindex @code{int} directive, H8/500
4879 @code{@value{AS}} has no machine-dependent directives for the H8/500.
4880 However, on this platform the @samp{.int} and @samp{.word} directives
4881 generate 16-bit numbers.
4882
4883 @node H8/500 Opcodes
4884 @section Opcodes
4885
4886 @cindex H8/500 opcode summary
4887 @cindex opcode summary, H8/500
4888 @cindex mnemonics, H8/500
4889 @cindex instruction summary, H8/500
4890 For detailed information on the H8/500 machine instruction set, see
4891 @cite{H8/500 Series Programming Manual} (Hitachi M21T001).
4892
4893 @code{@value{AS}} implements all the standard H8/500 opcodes. No additional
4894 pseudo-instructions are needed on this family.
4895
4896 @ifset SMALL
4897 @c this table, due to the multi-col faking and hardcoded order, looks silly
4898 @c except in smallbook. See comments below "@set SMALL" near top of this file.
4899
4900 The following table summarizes H8/500 opcodes and their operands:
4901
4902 @c Use @group if it ever works, instead of @page
4903 @page
4904 @smallexample
4905 @i{Legend:}
4906 abs8 @r{8-bit absolute address}
4907 abs16 @r{16-bit absolute address}
4908 abs24 @r{24-bit absolute address}
4909 crb @r{@code{ccr}, @code{br}, @code{ep}, @code{dp}, @code{tp}, @code{dp}}
4910 disp8 @r{8-bit displacement}
4911 ea @r{@code{rn}, @code{@@rn}, @code{@@(d:8, rn)}, @code{@@(d:16, rn)},}
4912 @r{@code{@@-rn}, @code{@@rn+}, @code{@@aa:8}, @code{@@aa:16},}
4913 @r{@code{#xx:8}, @code{#xx:16}}
4914 ea_mem @r{@code{@@rn}, @code{@@(d:8, rn)}, @code{@@(d:16, rn)},}
4915 @r{@code{@@-rn}, @code{@@rn+}, @code{@@aa:8}, @code{@@aa:16}}
4916 ea_noimm @r{@code{rn}, @code{@@rn}, @code{@@(d:8, rn)}, @code{@@(d:16, rn)},}
4917 @r{@code{@@-rn}, @code{@@rn+}, @code{@@aa:8}, @code{@@aa:16}}
4918 fp r6
4919 imm4 @r{4-bit immediate data}
4920 imm8 @r{8-bit immediate data}
4921 imm16 @r{16-bit immediate data}
4922 pcrel8 @r{8-bit offset from program counter}
4923 pcrel16 @r{16-bit offset from program counter}
4924 qim @r{@code{-2}, @code{-1}, @code{1}, @code{2}}
4925 rd @r{any register}
4926 rs @r{a register distinct from rd}
4927 rlist @r{comma-separated list of registers in parentheses;}
4928 @r{register ranges @code{rd-rs} are allowed}
4929 sp @r{stack pointer (@code{r7})}
4930 sr @r{status register}
4931 sz @r{size; @samp{.b} or @samp{.w}. If omitted, default @samp{.w}}
4932
4933 ldc[.b] ea,crb bcc[.w] pcrel16
4934 ldc[.w] ea,sr bcc[.b] pcrel8
4935 add[:q] sz qim,ea_noimm bhs[.w] pcrel16
4936 add[:g] sz ea,rd bhs[.b] pcrel8
4937 adds sz ea,rd bcs[.w] pcrel16
4938 addx sz ea,rd bcs[.b] pcrel8
4939 and sz ea,rd blo[.w] pcrel16
4940 andc[.b] imm8,crb blo[.b] pcrel8
4941 andc[.w] imm16,sr bne[.w] pcrel16
4942 bpt bne[.b] pcrel8
4943 bra[.w] pcrel16 beq[.w] pcrel16
4944 bra[.b] pcrel8 beq[.b] pcrel8
4945 bt[.w] pcrel16 bvc[.w] pcrel16
4946 bt[.b] pcrel8 bvc[.b] pcrel8
4947 brn[.w] pcrel16 bvs[.w] pcrel16
4948 brn[.b] pcrel8 bvs[.b] pcrel8
4949 bf[.w] pcrel16 bpl[.w] pcrel16
4950 bf[.b] pcrel8 bpl[.b] pcrel8
4951 bhi[.w] pcrel16 bmi[.w] pcrel16
4952 bhi[.b] pcrel8 bmi[.b] pcrel8
4953 bls[.w] pcrel16 bge[.w] pcrel16
4954 bls[.b] pcrel8 bge[.b] pcrel8
4955 @page
4956 blt[.w] pcrel16 mov[:g][.b] imm8,ea_mem
4957 blt[.b] pcrel8 mov[:g][.w] imm16,ea_mem
4958 bgt[.w] pcrel16 movfpe[.b] ea,rd
4959 bgt[.b] pcrel8 movtpe[.b] rs,ea_noimm
4960 ble[.w] pcrel16 mulxu sz ea,rd
4961 ble[.b] pcrel8 neg sz ea
4962 bclr sz imm4,ea_noimm nop
4963 bclr sz rs,ea_noimm not sz ea
4964 bnot sz imm4,ea_noimm or sz ea,rd
4965 bnot sz rs,ea_noimm orc[.b] imm8,crb
4966 bset sz imm4,ea_noimm orc[.w] imm16,sr
4967 bset sz rs,ea_noimm pjmp abs24
4968 bsr[.b] pcrel8 pjmp @@rd
4969 bsr[.w] pcrel16 pjsr abs24
4970 btst sz imm4,ea_noimm pjsr @@rd
4971 btst sz rs,ea_noimm prtd imm8
4972 clr sz ea prtd imm16
4973 cmp[:e][.b] imm8,rd prts
4974 cmp[:i][.w] imm16,rd rotl sz ea
4975 cmp[:g].b imm8,ea_noimm rotr sz ea
4976 cmp[:g][.w] imm16,ea_noimm rotxl sz ea
4977 Cmp[:g] sz ea,rd rotxr sz ea
4978 dadd rs,rd rtd imm8
4979 divxu sz ea,rd rtd imm16
4980 dsub rs,rd rts
4981 exts[.b] rd scb/f rs,pcrel8
4982 extu[.b] rd scb/ne rs,pcrel8
4983 jmp @@rd scb/eq rs,pcrel8
4984 jmp @@(imm8,rd) shal sz ea
4985 jmp @@(imm16,rd) shar sz ea
4986 jmp abs16 shll sz ea
4987 jsr @@rd shlr sz ea
4988 jsr @@(imm8,rd) sleep
4989 jsr @@(imm16,rd) stc[.b] crb,ea_noimm
4990 jsr abs16 stc[.w] sr,ea_noimm
4991 ldm @@sp+,(rlist) stm (rlist),@@-sp
4992 link fp,imm8 sub sz ea,rd
4993 link fp,imm16 subs sz ea,rd
4994 mov[:e][.b] imm8,rd subx sz ea,rd
4995 mov[:i][.w] imm16,rd swap[.b] rd
4996 mov[:l][.w] abs8,rd tas[.b] ea
4997 mov[:l].b abs8,rd trapa imm4
4998 mov[:s][.w] rs,abs8 trap/vs
4999 mov[:s].b rs,abs8 tst sz ea
5000 mov[:f][.w] @@(disp8,fp),rd unlk fp
5001 mov[:f][.w] rs,@@(disp8,fp) xch[.w] rs,rd
5002 mov[:f].b @@(disp8,fp),rd xor sz ea,rd
5003 mov[:f].b rs,@@(disp8,fp) xorc.b imm8,crb
5004 mov[:g] sz rs,ea_mem xorc.w imm16,sr
5005 mov[:g] sz ea,rd
5006 @end smallexample
5007 @end ifset
5008 @end ifset
5009
5010 @ifset HPPA
5011 @page
5012 @node HPPA-Dependent
5013 @chapter HPPA Dependent Features
5014
5015 @cindex support
5016 @menu
5017 * HPPA Notes:: Notes
5018 * HPPA Options:: Options
5019 * HPPA Syntax:: Syntax
5020 * HPPA Floating Point:: Floating Point
5021 * HPPA Directives:: HPPA Machine Directives
5022 * HPPA Opcodes:: Opcodes
5023 @end menu
5024
5025 @node HPPA Notes
5026 @section Notes
5027 As a back end for @sc{gnu} @sc{cc} @code{@value{AS}} has been throughly tested and should
5028 work extremely well. We have tested it only minimally on hand written assembly
5029 code and no one has tested it much on the assembly output from the HP
5030 compilers.
5031
5032 The format of the debugging sections has changed since the original
5033 @code{@value{AS}} port (version 1.3X) was released; therefore,
5034 you must rebuild all HPPA objects and libraries with the new
5035 assembler so that you can debug the final executable.
5036
5037 The HPPA @code{@value{AS}} port generates a small subset of the relocations
5038 available in the SOM and ELF object file formats. Additional relocation
5039 support will be added as it becomes necessary.
5040
5041 @node HPPA Options
5042 @section Options
5043 @code{@value{AS}} has no machine-dependent command-line options for the HPPA.
5044
5045 @cindex HPPA Syntax
5046 @node HPPA Syntax
5047 @section Syntax
5048 The assembler syntax closely follows the HPPA instruction set
5049 reference manual; assembler directives and general syntax closely follow the
5050 HPPA assembly language reference manual, with a few noteworthy differences.
5051
5052 First, a colon may immediately follow a label definition. This is
5053 simply for compatibility with how most assembly language programmers
5054 write code.
5055
5056 Some obscure expression parsing problems may affect hand written code which
5057 uses the @code{spop} instructions, or code which makes significant
5058 use of the @code{!} line separator.
5059
5060 @code{@value{AS}} is much less forgiving about missing arguments and other
5061 similar oversights than the HP assembler. @code{@value{AS}} notifies you
5062 of missing arguments as syntax errors; this is regarded as a feature, not a
5063 bug.
5064
5065 Finally, @code{@value{AS}} allows you to use an external symbol without
5066 explicitly importing the symbol. @emph{Warning:} in the future this will be
5067 an error for HPPA targets.
5068
5069 Special characters for HPPA targets include:
5070
5071 @samp{;} is the line comment character.
5072
5073 @samp{!} can be used instead of a newline to separate statements.
5074
5075 Since @samp{$} has no special meaning, you may use it in symbol names.
5076
5077 @node HPPA Floating Point
5078 @section Floating Point
5079 @cindex floating point, HPPA (@sc{ieee})
5080 @cindex HPPA floating point (@sc{ieee})
5081 The HPPA family uses @sc{ieee} floating-point numbers.
5082
5083 @node HPPA Directives
5084 @section HPPA Assembler Directives
5085
5086 @code{@value{AS}} for the HPPA supports many additional directives for
5087 compatibility with the native assembler. This section describes them only
5088 briefly. For detailed information on HPPA-specific assembler directives, see
5089 @cite{HP9000 Series 800 Assembly Language Reference Manual} (HP 92432-90001).
5090
5091 @cindex HPPA directives not supported
5092 @code{@value{AS}} does @emph{not} support the following assembler directives
5093 described in the HP manual:
5094
5095 @example
5096 .endm .liston
5097 .enter .locct
5098 .leave .macro
5099 .listoff
5100 @end example
5101
5102 @cindex @code{.param} on HPPA
5103 Beyond those implemented for compatibility, @code{@value{AS}} supports one
5104 additional assembler directive for the HPPA: @code{.param}. It conveys
5105 register argument locations for static functions. Its syntax closely follows
5106 the @code{.export} directive.
5107
5108 @cindex HPPA-only directives
5109 These are the additional directives in @code{@value{AS}} for the HPPA:
5110
5111 @table @code
5112 @item .block @var{n}
5113 @itemx .blockz @var{n}
5114 Reserve @var{n} bytes of storage, and initialize them to zero.
5115
5116 @item .call
5117 Mark the beginning of a procedure call. Only the special case with @emph{no
5118 arguments} is allowed.
5119
5120 @item .callinfo [ @var{param}=@var{value}, @dots{} ] [ @var{flag}, @dots{} ]
5121 Specify a number of parameters and flags that define the environment for a
5122 procedure.
5123
5124 @var{param} may be any of @samp{frame} (frame size), @samp{entry_gr} (end of
5125 general register range), @samp{entry_fr} (end of float register range),
5126 @samp{entry_sr} (end of space register range).
5127
5128 The values for @var{flag} are @samp{calls} or @samp{caller} (proc has
5129 subroutines), @samp{no_calls} (proc does not call subroutines), @samp{save_rp}
5130 (preserve return pointer), @samp{save_sp} (proc preserves stack pointer),
5131 @samp{no_unwind} (do not unwind this proc), @samp{hpux_int} (proc is interrupt
5132 routine).
5133
5134 @item .code
5135 Assemble into the standard section called @samp{$TEXT$}, subsection
5136 @samp{$CODE$}.
5137
5138 @ifset SOM
5139 @item .copyright "@var{string}"
5140 In the SOM object format, insert @var{string} into the object code, marked as a
5141 copyright string.
5142 @end ifset
5143
5144 @ifset ELF
5145 @item .copyright "@var{string}"
5146 In the ELF object format, insert @var{string} into the object code, marked as a
5147 version string.
5148 @end ifset
5149
5150 @item .enter
5151 Not yet supported; the assembler rejects programs containing this directive.
5152
5153 @item .entry
5154 Mark the beginning of a procedure.
5155
5156 @item .exit
5157 Mark the end of a procedure.
5158
5159 @item .export @var{name} [ ,@var{typ} ] [ ,@var{param}=@var{r} ]
5160 Make a procedure @var{name} available to callers. @var{typ}, if present, must
5161 be one of @samp{absolute}, @samp{code} (ELF only, not SOM), @samp{data},
5162 @samp{entry}, @samp{data}, @samp{entry}, @samp{millicode}, @samp{plabel},
5163 @samp{pri_prog}, or @samp{sec_prog}.
5164
5165 @var{param}, if present, provides either relocation information for the
5166 procedure arguments and result, or a privilege level. @var{param} may be
5167 @samp{argw@var{n}} (where @var{n} ranges from @code{0} to @code{3}, and
5168 indicates one of four one-word arguments); @samp{rtnval} (the procedure's
5169 result); or @samp{priv_lev} (privilege level). For arguments or the result,
5170 @var{r} specifies how to relocate, and must be one of @samp{no} (not
5171 relocatable), @samp{gr} (argument is in general register), @samp{fr} (in
5172 floating point register), or @samp{fu} (upper half of float register).
5173 For @samp{priv_lev}, @var{r} is an integer.
5174
5175 @item .half @var{n}
5176 Define a two-byte integer constant @var{n}; synonym for the portable
5177 @code{@value{AS}} directive @code{.short}.
5178
5179 @item .import @var{name} [ ,@var{typ} ]
5180 Converse of @code{.export}; make a procedure available to call. The arguments
5181 use the same conventions as the first two arguments for @code{.export}.
5182
5183 @item .label @var{name}
5184 Define @var{name} as a label for the current assembly location.
5185
5186 @item .leave
5187 Not yet supported; the assembler rejects programs containing this directive.
5188
5189 @item .origin @var{lc}
5190 Advance location counter to @var{lc}. Synonym for the @code{@value{as}}
5191 portable directive @code{.org}.
5192
5193 @item .param @var{name} [ ,@var{typ} ] [ ,@var{param}=@var{r} ]
5194 @c Not in HP manual; GNU HPPA extension
5195 Similar to @code{.export}, but used for static procedures.
5196
5197 @item .proc
5198 Use preceding the first statement of a procedure.
5199
5200 @item .procend
5201 Use following the last statement of a procedure.
5202
5203 @item @var{label} .reg @var{expr}
5204 @c ?? Not in HP manual (Jan 1988 vn)
5205 Synonym for @code{.equ}; define @var{label} with the absolute expression
5206 @var{expr} as its value.
5207
5208 @item .space @var{secname} [ ,@var{params} ]
5209 Switch to section @var{secname}, creating a new section by that name if
5210 necessary. You may only use @var{params} when creating a new section, not
5211 when switching to an existing one. @var{secname} may identify a section by
5212 number rather than by name.
5213
5214 If specified, the list @var{params} declares attributes of the section,
5215 identified by keywords. The keywords recognized are @samp{spnum=@var{exp}}
5216 (identify this section by the number @var{exp}, an absolute expression),
5217 @samp{sort=@var{exp}} (order sections according to this sort key when linking;
5218 @var{exp} is an absolute expression), @samp{unloadable} (section contains no
5219 loadable data), @samp{notdefined} (this section defined elsewhere), and
5220 @samp{private} (data in this section not available to other programs).
5221
5222 @item .spnum @var{secnam}
5223 @c ?? Not in HP manual (Jan 1988)
5224 Allocate four bytes of storage, and initialize them with the section number of
5225 the section named @var{secnam}. (You can define the section number with the
5226 HPPA @code{.space} directive.)
5227
5228 @item .string "@var{str}"
5229 @cindex @code{string} directive on HPPA
5230 Copy the characters in the string @var{str} to the object file.
5231 @xref{Strings,,Strings}, for information on escape sequences you can use in
5232 @code{@value{AS}} strings.
5233
5234 @emph{Warning!} The HPPA version of @code{.string} differs from the
5235 usual @code{@value{AS}} definition: it does @emph{not} write a zero byte
5236 after copying @var{str}.
5237
5238 @item .stringz "@var{str}"
5239 Like @code{.string}, but appends a zero byte after copying @var{str} to object
5240 file.
5241
5242 @item .subspa @var{name} [ ,@var{params} ]
5243 Similar to @code{.space}, but selects a subsection @var{name} within the
5244 current section. You may only specify @var{params} when you create a
5245 subsection (in the first instance of @code{.subspa} for this @var{name}).
5246
5247 If specified, the list @var{params} declares attributes of the subsection,
5248 identified by keywords. The keywords recognized are @samp{quad=@var{expr}}
5249 (``quadrant'' for this subsection), @samp{align=@var{expr}} (alignment for
5250 beginning of this subsection; a power of two), @samp{access=@var{expr}} (value
5251 for ``access rights'' field), @samp{sort=@var{expr}} (sorting order for this
5252 subspace in link), @samp{code_only} (subsection contains only code),
5253 @samp{unloadable} (subsection cannot be loaded into memory), @samp{common}
5254 (subsection is common block), @samp{dup_comm} (initialized data may have
5255 duplicate names), or @samp{zero} (subsection is all zeros, do not write in
5256 object file).
5257
5258 @item .version "@var{str}"
5259 Write @var{str} as version identifier in object code.
5260 @end table
5261
5262 @node HPPA Opcodes
5263 @section Opcodes
5264 For detailed information on the HPPA machine instruction set, see
5265 @cite{PA-RISC Architecture and Instruction Set Reference Manual}
5266 (HP 09740-90039).
5267 @end ifset
5268
5269 @ifset SH
5270 @page
5271 @node SH-Dependent
5272 @chapter Hitachi SH Dependent Features
5273
5274 @cindex SH support
5275 @menu
5276 * SH Options:: Options
5277 * SH Syntax:: Syntax
5278 * SH Floating Point:: Floating Point
5279 * SH Directives:: SH Machine Directives
5280 * SH Opcodes:: Opcodes
5281 @end menu
5282
5283 @node SH Options
5284 @section Options
5285
5286 @cindex SH options (none)
5287 @cindex options, SH (none)
5288 @code{@value{AS}} has no additional command-line options for the Hitachi
5289 SH family.
5290
5291 @node SH Syntax
5292 @section Syntax
5293
5294 @menu
5295 * SH-Chars:: Special Characters
5296 * SH-Regs:: Register Names
5297 * SH-Addressing:: Addressing Modes
5298 @end menu
5299
5300 @node SH-Chars
5301 @subsection Special Characters
5302
5303 @cindex line comment character, SH
5304 @cindex SH line comment character
5305 @samp{!} is the line comment character.
5306
5307 @cindex line separator, SH
5308 @cindex statement separator, SH
5309 @cindex SH line separator
5310 You can use @samp{;} instead of a newline to separate statements.
5311
5312 @cindex symbol names, @samp{$} in
5313 @cindex @code{$} in symbol names
5314 Since @samp{$} has no special meaning, you may use it in symbol names.
5315
5316 @node SH-Regs
5317 @subsection Register Names
5318
5319 @cindex SH registers
5320 @cindex registers, SH
5321 You can use the predefined symbols @samp{r0}, @samp{r1}, @samp{r2},
5322 @samp{r3}, @samp{r4}, @samp{r5}, @samp{r6}, @samp{r7}, @samp{r8},
5323 @samp{r9}, @samp{r10}, @samp{r11}, @samp{r12}, @samp{r13}, @samp{r14},
5324 and @samp{r15} to refer to the SH registers.
5325
5326 The SH also has these control registers:
5327
5328 @table @code
5329 @item pr
5330 procedure register (holds return address)
5331
5332 @item pc
5333 program counter
5334
5335 @item mach
5336 @itemx macl
5337 high and low multiply accumulator registers
5338
5339 @item sr
5340 status register
5341
5342 @item gbr
5343 global base register
5344
5345 @item vbr
5346 vector base register (for interrupt vectors)
5347 @end table
5348
5349 @node SH-Addressing
5350 @subsection Addressing Modes
5351
5352 @cindex addressing modes, SH
5353 @cindex SH addressing modes
5354 @code{@value{AS}} understands the following addressing modes for the SH.
5355 @code{R@var{n}} in the following refers to any of the numbered
5356 registers, but @emph{not} the control registers.
5357
5358 @table @code
5359 @item R@var{n}
5360 Register direct
5361
5362 @item @@R@var{n}
5363 Register indirect
5364
5365 @item @@-R@var{n}
5366 Register indirect with pre-decrement
5367
5368 @item @@R@var{n}+
5369 Register indirect with post-increment
5370
5371 @item @@(@var{disp}, R@var{n})
5372 Register indirect with displacement
5373
5374 @item @@(R0, R@var{n})
5375 Register indexed
5376
5377 @item @@(@var{disp}, GBR)
5378 @code{GBR} offset
5379
5380 @item @@(R0, GBR)
5381 GBR indexed
5382
5383 @item @var{addr}
5384 @itemx @@(@var{disp}, PC)
5385 PC relative address (for branch or for addressing memory). The
5386 @code{@value{AS}} implementation allows you to use the simpler form
5387 @var{addr} anywhere a PC relative address is called for; the alternate
5388 form is supported for compatibility with other assemblers.
5389
5390 @item #@var{imm}
5391 Immediate data
5392 @end table
5393
5394 @node SH Floating Point
5395 @section Floating Point
5396
5397 @cindex floating point, SH (@sc{ieee})
5398 @cindex SH floating point (@sc{ieee})
5399 The SH family uses @sc{ieee} floating-point numbers.
5400
5401 @node SH Directives
5402 @section SH Machine Directives
5403
5404 @cindex SH machine directives (none)
5405 @cindex machine directives, SH (none)
5406 @cindex @code{word} directive, SH
5407 @cindex @code{int} directive, SH
5408 @code{@value{AS}} has no machine-dependent directives for the SH.
5409
5410 @node SH Opcodes
5411 @section Opcodes
5412
5413 @cindex SH opcode summary
5414 @cindex opcode summary, SH
5415 @cindex mnemonics, SH
5416 @cindex instruction summary, SH
5417 For detailed information on the SH machine instruction set, see
5418 @cite{SH-Microcomputer User's Manual} (Hitachi Micro Systems, Inc.).
5419
5420 @code{@value{AS}} implements all the standard SH opcodes. No additional
5421 pseudo-instructions are needed on this family. Note, however, that
5422 because @code{@value{AS}} supports a simpler form of PC-relative
5423 addressing, you may simply write (for example)
5424
5425 @example
5426 mov.l bar,r0
5427 @end example
5428
5429 @noindent
5430 where other assemblers might require an explicit displacement to
5431 @code{bar} from the program counter:
5432
5433 @example
5434 mov.l @@(@var{disp}, PC)
5435 @end example
5436
5437 @ifset SMALL
5438 @c this table, due to the multi-col faking and hardcoded order, looks silly
5439 @c except in smallbook. See comments below "@set SMALL" near top of this file.
5440
5441 Here is a summary of SH opcodes:
5442
5443 @page
5444 @smallexample
5445 @i{Legend:}
5446 Rn @r{a numbered register}
5447 Rm @r{another numbered register}
5448 #imm @r{immediate data}
5449 disp @r{displacement}
5450 disp8 @r{8-bit displacement}
5451 disp12 @r{12-bit displacement}
5452
5453 add #imm,Rn lds.l @@Rn+,PR
5454 add Rm,Rn mac.w @@Rm+,@@Rn+
5455 addc Rm,Rn mov #imm,Rn
5456 addv Rm,Rn mov Rm,Rn
5457 and #imm,R0 mov.b Rm,@@(R0,Rn)
5458 and Rm,Rn mov.b Rm,@@-Rn
5459 and.b #imm,@@(R0,GBR) mov.b Rm,@@Rn
5460 bf disp8 mov.b @@(disp,Rm),R0
5461 bra disp12 mov.b @@(disp,GBR),R0
5462 bsr disp12 mov.b @@(R0,Rm),Rn
5463 bt disp8 mov.b @@Rm+,Rn
5464 clrmac mov.b @@Rm,Rn
5465 clrt mov.b R0,@@(disp,Rm)
5466 cmp/eq #imm,R0 mov.b R0,@@(disp,GBR)
5467 cmp/eq Rm,Rn mov.l Rm,@@(disp,Rn)
5468 cmp/ge Rm,Rn mov.l Rm,@@(R0,Rn)
5469 cmp/gt Rm,Rn mov.l Rm,@@-Rn
5470 cmp/hi Rm,Rn mov.l Rm,@@Rn
5471 cmp/hs Rm,Rn mov.l @@(disp,Rn),Rm
5472 cmp/pl Rn mov.l @@(disp,GBR),R0
5473 cmp/pz Rn mov.l @@(disp,PC),Rn
5474 cmp/str Rm,Rn mov.l @@(R0,Rm),Rn
5475 div0s Rm,Rn mov.l @@Rm+,Rn
5476 div0u mov.l @@Rm,Rn
5477 div1 Rm,Rn mov.l R0,@@(disp,GBR)
5478 exts.b Rm,Rn mov.w Rm,@@(R0,Rn)
5479 exts.w Rm,Rn mov.w Rm,@@-Rn
5480 extu.b Rm,Rn mov.w Rm,@@Rn
5481 extu.w Rm,Rn mov.w @@(disp,Rm),R0
5482 jmp @@Rn mov.w @@(disp,GBR),R0
5483 jsr @@Rn mov.w @@(disp,PC),Rn
5484 ldc Rn,GBR mov.w @@(R0,Rm),Rn
5485 ldc Rn,SR mov.w @@Rm+,Rn
5486 ldc Rn,VBR mov.w @@Rm,Rn
5487 ldc.l @@Rn+,GBR mov.w R0,@@(disp,Rm)
5488 ldc.l @@Rn+,SR mov.w R0,@@(disp,GBR)
5489 ldc.l @@Rn+,VBR mova @@(disp,PC),R0
5490 lds Rn,MACH movt Rn
5491 lds Rn,MACL muls Rm,Rn
5492 lds Rn,PR mulu Rm,Rn
5493 lds.l @@Rn+,MACH neg Rm,Rn
5494 lds.l @@Rn+,MACL negc Rm,Rn
5495 @page
5496 nop stc VBR,Rn
5497 not Rm,Rn stc.l GBR,@@-Rn
5498 or #imm,R0 stc.l SR,@@-Rn
5499 or Rm,Rn stc.l VBR,@@-Rn
5500 or.b #imm,@@(R0,GBR) sts MACH,Rn
5501 rotcl Rn sts MACL,Rn
5502 rotcr Rn sts PR,Rn
5503 rotl Rn sts.l MACH,@@-Rn
5504 rotr Rn sts.l MACL,@@-Rn
5505 rte sts.l PR,@@-Rn
5506 rts sub Rm,Rn
5507 sett subc Rm,Rn
5508 shal Rn subv Rm,Rn
5509 shar Rn swap.b Rm,Rn
5510 shll Rn swap.w Rm,Rn
5511 shll16 Rn tas.b @@Rn
5512 shll2 Rn trapa #imm
5513 shll8 Rn tst #imm,R0
5514 shlr Rn tst Rm,Rn
5515 shlr16 Rn tst.b #imm,@@(R0,GBR)
5516 shlr2 Rn xor #imm,R0
5517 shlr8 Rn xor Rm,Rn
5518 sleep xor.b #imm,@@(R0,GBR)
5519 stc GBR,Rn xtrct Rm,Rn
5520 stc SR,Rn
5521 @end smallexample
5522 @end ifset
5523
5524 @ifset Hitachi-all
5525 @ifclear GENERIC
5526 @raisesections
5527 @end ifclear
5528 @end ifset
5529
5530 @end ifset
5531 @ifset I960
5532 @ifset GENERIC
5533 @page
5534 @node i960-Dependent
5535 @chapter Intel 80960 Dependent Features
5536 @end ifset
5537 @ifclear GENERIC
5538 @node Machine Dependencies
5539 @chapter Intel 80960 Dependent Features
5540 @end ifclear
5541
5542 @cindex i960 support
5543 @menu
5544 * Options-i960:: i960 Command-line Options
5545 * Floating Point-i960:: Floating Point
5546 * Directives-i960:: i960 Machine Directives
5547 * Opcodes for i960:: i960 Opcodes
5548 @end menu
5549
5550 @c FIXME! Add Syntax sec with discussion of bitfields here, at least so
5551 @c long as they're not turned on for other machines than 960.
5552
5553 @node Options-i960
5554
5555 @section i960 Command-line Options
5556
5557 @cindex i960 options
5558 @cindex options, i960
5559 @table @code
5560
5561 @item -ACA | -ACA_A | -ACB | -ACC | -AKA | -AKB | -AKC | -AMC
5562 @cindex i960 architecture options
5563 @cindex architecture options, i960
5564 @cindex @code{-A} options, i960
5565 Select the 80960 architecture. Instructions or features not supported
5566 by the selected architecture cause fatal errors.
5567
5568 @samp{-ACA} is equivalent to @samp{-ACA_A}; @samp{-AKC} is equivalent to
5569 @samp{-AMC}. Synonyms are provided for compatibility with other tools.
5570
5571 If you do not specify any of these options, @code{@value{AS}} generates code
5572 for any instruction or feature that is supported by @emph{some} version of the
5573 960 (even if this means mixing architectures!). In principle,
5574 @code{@value{AS}} attempts to deduce the minimal sufficient processor type if
5575 none is specified; depending on the object code format, the processor type may
5576 be recorded in the object file. If it is critical that the @code{@value{AS}}
5577 output match a specific architecture, specify that architecture explicitly.
5578
5579 @item -b
5580 @cindex @code{-b} option, i960
5581 @cindex branch recording, i960
5582 @cindex i960 branch recording
5583 Add code to collect information about conditional branches taken, for
5584 later optimization using branch prediction bits. (The conditional branch
5585 instructions have branch prediction bits in the CA, CB, and CC
5586 architectures.) If @var{BR} represents a conditional branch instruction,
5587 the following represents the code generated by the assembler when
5588 @samp{-b} is specified:
5589
5590 @smallexample
5591 call @var{increment routine}
5592 .word 0 # pre-counter
5593 Label: @var{BR}
5594 call @var{increment routine}
5595 .word 0 # post-counter
5596 @end smallexample
5597
5598 The counter following a branch records the number of times that branch
5599 was @emph{not} taken; the differenc between the two counters is the
5600 number of times the branch @emph{was} taken.
5601
5602 @cindex @code{gbr960}, i960 postprocessor
5603 @cindex branch statistics table, i960
5604 A table of every such @code{Label} is also generated, so that the
5605 external postprocessor @code{gbr960} (supplied by Intel) can locate all
5606 the counters. This table is always labelled @samp{__BRANCH_TABLE__};
5607 this is a local symbol to permit collecting statistics for many separate
5608 object files. The table is word aligned, and begins with a two-word
5609 header. The first word, initialized to 0, is used in maintaining linked
5610 lists of branch tables. The second word is a count of the number of
5611 entries in the table, which follow immediately: each is a word, pointing
5612 to one of the labels illustrated above.
5613
5614 @c TEXI2ROFF-KILL
5615 @ifinfo
5616 @c END TEXI2ROFF-KILL
5617 @example
5618 +------------+------------+------------+ ... +------------+
5619 | | | | | |
5620 | *NEXT | COUNT: N | *BRLAB 1 | | *BRLAB N |
5621 | | | | | |
5622 +------------+------------+------------+ ... +------------+
5623
5624 __BRANCH_TABLE__ layout
5625 @end example
5626 @c TEXI2ROFF-KILL
5627 @end ifinfo
5628 @need 2000
5629 @tex
5630 \vskip 1pc
5631 \line{\leftskip=0pt\hskip\tableindent
5632 \boxit{2cm}{\tt *NEXT}\boxit{2cm}{\tt COUNT: \it N}\boxit{2cm}{\tt
5633 *BRLAB 1}\ibox{1cm}{\quad\dots}\boxit{2cm}{\tt *BRLAB \it N}\hfil}
5634 \centerline{\it {\tt \_\_BRANCH\_TABLE\_\_} layout}
5635 @end tex
5636 @c END TEXI2ROFF-KILL
5637
5638 The first word of the header is used to locate multiple branch tables,
5639 since each object file may contain one. Normally the links are
5640 maintained with a call to an initialization routine, placed at the
5641 beginning of each function in the file. The @sc{gnu} C compiler
5642 generates these calls automatically when you give it a @samp{-b} option.
5643 For further details, see the documentation of @samp{gbr960}.
5644
5645 @item -no-relax
5646 @cindex @code{-no-relax} option, i960
5647 Normally, Compare-and-Branch instructions with targets that require
5648 displacements greater than 13 bits (or that have external targets) are
5649 replaced with the corresponding compare (or @samp{chkbit}) and branch
5650 instructions. You can use the @samp{-no-relax} option to specify that
5651 @code{@value{AS}} should generate errors instead, if the target displacement
5652 is larger than 13 bits.
5653
5654 This option does not affect the Compare-and-Jump instructions; the code
5655 emitted for them is @emph{always} adjusted when necessary (depending on
5656 displacement size), regardless of whether you use @samp{-no-relax}.
5657 @end table
5658
5659 @node Floating Point-i960
5660 @section Floating Point
5661
5662 @cindex floating point, i960 (@sc{ieee})
5663 @cindex i960 floating point (@sc{ieee})
5664 @code{@value{AS}} generates @sc{ieee} floating-point numbers for the directives
5665 @samp{.float}, @samp{.double}, @samp{.extended}, and @samp{.single}.
5666
5667 @node Directives-i960
5668 @section i960 Machine Directives
5669
5670 @cindex machine directives, i960
5671 @cindex i960 machine directives
5672
5673 @table @code
5674 @cindex @code{bss} directive, i960
5675 @item .bss @var{symbol}, @var{length}, @var{align}
5676 Reserve @var{length} bytes in the bss section for a local @var{symbol},
5677 aligned to the power of two specified by @var{align}. @var{length} and
5678 @var{align} must be positive absolute expressions. This directive
5679 differs from @samp{.lcomm} only in that it permits you to specify
5680 an alignment. @xref{Lcomm,,@code{.lcomm}}.
5681 @end table
5682
5683 @table @code
5684 @item .extended @var{flonums}
5685 @cindex @code{extended} directive, i960
5686 @code{.extended} expects zero or more flonums, separated by commas; for
5687 each flonum, @samp{.extended} emits an @sc{ieee} extended-format (80-bit)
5688 floating-point number.
5689
5690 @item .leafproc @var{call-lab}, @var{bal-lab}
5691 @cindex @code{leafproc} directive, i960
5692 You can use the @samp{.leafproc} directive in conjunction with the
5693 optimized @code{callj} instruction to enable faster calls of leaf
5694 procedures. If a procedure is known to call no other procedures, you
5695 may define an entry point that skips procedure prolog code (and that does
5696 not depend on system-supplied saved context), and declare it as the
5697 @var{bal-lab} using @samp{.leafproc}. If the procedure also has an
5698 entry point that goes through the normal prolog, you can specify that
5699 entry point as @var{call-lab}.
5700
5701 A @samp{.leafproc} declaration is meant for use in conjunction with the
5702 optimized call instruction @samp{callj}; the directive records the data
5703 needed later to choose between converting the @samp{callj} into a
5704 @code{bal} or a @code{call}.
5705
5706 @var{call-lab} is optional; if only one argument is present, or if the
5707 two arguments are identical, the single argument is assumed to be the
5708 @code{bal} entry point.
5709
5710 @item .sysproc @var{name}, @var{index}
5711 @cindex @code{sysproc} directive, i960
5712 The @samp{.sysproc} directive defines a name for a system procedure.
5713 After you define it using @samp{.sysproc}, you can use @var{name} to
5714 refer to the system procedure identified by @var{index} when calling
5715 procedures with the optimized call instruction @samp{callj}.
5716
5717 Both arguments are required; @var{index} must be between 0 and 31
5718 (inclusive).
5719 @end table
5720
5721 @node Opcodes for i960
5722 @section i960 Opcodes
5723
5724 @cindex opcodes, i960
5725 @cindex i960 opcodes
5726 All Intel 960 machine instructions are supported;
5727 @pxref{Options-i960,,i960 Command-line Options} for a discussion of
5728 selecting the instruction subset for a particular 960
5729 architecture.@refill
5730
5731 Some opcodes are processed beyond simply emitting a single corresponding
5732 instruction: @samp{callj}, and Compare-and-Branch or Compare-and-Jump
5733 instructions with target displacements larger than 13 bits.
5734
5735 @menu
5736 * callj-i960:: @code{callj}
5737 * Compare-and-branch-i960:: Compare-and-Branch
5738 @end menu
5739
5740 @node callj-i960
5741 @subsection @code{callj}
5742
5743 @cindex @code{callj}, i960 pseudo-opcode
5744 @cindex i960 @code{callj} pseudo-opcode
5745 You can write @code{callj} to have the assembler or the linker determine
5746 the most appropriate form of subroutine call: @samp{call},
5747 @samp{bal}, or @samp{calls}. If the assembly source contains
5748 enough information---a @samp{.leafproc} or @samp{.sysproc} directive
5749 defining the operand---then @code{@value{AS}} translates the
5750 @code{callj}; if not, it simply emits the @code{callj}, leaving it
5751 for the linker to resolve.
5752
5753 @node Compare-and-branch-i960
5754 @subsection Compare-and-Branch
5755
5756 @cindex i960 compare/branch instructions
5757 @cindex compare/branch instructions, i960
5758 The 960 architectures provide combined Compare-and-Branch instructions
5759 that permit you to store the branch target in the lower 13 bits of the
5760 instruction word itself. However, if you specify a branch target far
5761 enough away that its address won't fit in 13 bits, the assembler can
5762 either issue an error, or convert your Compare-and-Branch instruction
5763 into separate instructions to do the compare and the branch.
5764
5765 @cindex compare and jump expansions, i960
5766 @cindex i960 compare and jump expansions
5767 Whether @code{@value{AS}} gives an error or expands the instruction depends
5768 on two choices you can make: whether you use the @samp{-no-relax} option,
5769 and whether you use a ``Compare and Branch'' instruction or a ``Compare
5770 and Jump'' instruction. The ``Jump'' instructions are @emph{always}
5771 expanded if necessary; the ``Branch'' instructions are expanded when
5772 necessary @emph{unless} you specify @code{-no-relax}---in which case
5773 @code{@value{AS}} gives an error instead.
5774
5775 These are the Compare-and-Branch instructions, their ``Jump'' variants,
5776 and the instruction pairs they may expand into:
5777
5778 @c TEXI2ROFF-KILL
5779 @ifinfo
5780 @c END TEXI2ROFF-KILL
5781 @example
5782 Compare and
5783 Branch Jump Expanded to
5784 ------ ------ ------------
5785 bbc chkbit; bno
5786 bbs chkbit; bo
5787 cmpibe cmpije cmpi; be
5788 cmpibg cmpijg cmpi; bg
5789 cmpibge cmpijge cmpi; bge
5790 cmpibl cmpijl cmpi; bl
5791 cmpible cmpijle cmpi; ble
5792 cmpibno cmpijno cmpi; bno
5793 cmpibne cmpijne cmpi; bne
5794 cmpibo cmpijo cmpi; bo
5795 cmpobe cmpoje cmpo; be
5796 cmpobg cmpojg cmpo; bg
5797 cmpobge cmpojge cmpo; bge
5798 cmpobl cmpojl cmpo; bl
5799 cmpoble cmpojle cmpo; ble
5800 cmpobne cmpojne cmpo; bne
5801 @end example
5802 @c TEXI2ROFF-KILL
5803 @end ifinfo
5804 @tex
5805 \hskip\tableindent
5806 \halign{\hfil {\tt #}\quad&\hfil {\tt #}\qquad&{\tt #}\hfil\cr
5807 \omit{\hfil\it Compare and\hfil}\span\omit&\cr
5808 {\it Branch}&{\it Jump}&{\it Expanded to}\cr
5809 bbc& & chkbit; bno\cr
5810 bbs& & chkbit; bo\cr
5811 cmpibe& cmpije& cmpi; be\cr
5812 cmpibg& cmpijg& cmpi; bg\cr
5813 cmpibge& cmpijge& cmpi; bge\cr
5814 cmpibl& cmpijl& cmpi; bl\cr
5815 cmpible& cmpijle& cmpi; ble\cr
5816 cmpibno& cmpijno& cmpi; bno\cr
5817 cmpibne& cmpijne& cmpi; bne\cr
5818 cmpibo& cmpijo& cmpi; bo\cr
5819 cmpobe& cmpoje& cmpo; be\cr
5820 cmpobg& cmpojg& cmpo; bg\cr
5821 cmpobge& cmpojge& cmpo; bge\cr
5822 cmpobl& cmpojl& cmpo; bl\cr
5823 cmpoble& cmpojle& cmpo; ble\cr
5824 cmpobne& cmpojne& cmpo; bne\cr}
5825 @end tex
5826 @c END TEXI2ROFF-KILL
5827 @end ifset
5828
5829 @ifset M680X0
5830 @ifset GENERIC
5831 @page
5832 @node M68K-Dependent
5833 @chapter M680x0 Dependent Features
5834 @end ifset
5835 @ifclear GENERIC
5836 @node Machine Dependencies
5837 @chapter M680x0 Dependent Features
5838 @end ifclear
5839
5840 @cindex M680x0 support
5841 @menu
5842 * M68K-Opts:: M680x0 Options
5843 * M68K-Syntax:: Syntax
5844 * M68K-Moto-Syntax:: Motorola Syntax
5845 * M68K-Float:: Floating Point
5846 * M68K-Directives:: 680x0 Machine Directives
5847 * M68K-opcodes:: Opcodes
5848 @end menu
5849
5850 @node M68K-Opts
5851 @section M680x0 Options
5852
5853 @cindex options, M680x0
5854 @cindex M680x0 options
5855 The Motorola 680x0 version of @code{@value{AS}} has two machine dependent options.
5856 One shortens undefined references from 32 to 16 bits, while the
5857 other is used to tell @code{@value{AS}} what kind of machine it is
5858 assembling for.
5859
5860 @cindex @code{-l} option, M680x0
5861 You can use the @samp{-l} option to shorten the size of references to undefined
5862 symbols. If you do not use the @samp{-l} option, references to undefined
5863 symbols are wide enough for a full @code{long} (32 bits). (Since
5864 @code{@value{AS}} cannot know where these symbols end up, @code{@value{AS}} can
5865 only allocate space for the linker to fill in later. Since @code{@value{AS}}
5866 does not know how far away these symbols are, it allocates as much space as it
5867 can.) If you use this option, the references are only one word wide (16 bits).
5868 This may be useful if you want the object file to be as small as possible, and
5869 you know that the relevant symbols are always less than 17 bits away.
5870
5871 @cindex @code{-m68000} and related options
5872 @cindex architecture options, M680x0
5873 @cindex M680x0 architecture options
5874 The 680x0 version of @code{@value{AS}} is most frequently used to assemble
5875 programs for the Motorola MC68020 microprocessor. Occasionally it is
5876 used to assemble programs for the mostly similar, but slightly different
5877 MC68000 or MC68010 microprocessors. You can give @code{@value{AS}} the options
5878 @samp{-m68000}, @samp{-mc68000}, @samp{-m68010}, @samp{-mc68010},
5879 @samp{-m68020}, and @samp{-mc68020} to tell it what processor is the
5880 target.
5881
5882 @node M68K-Syntax
5883 @section Syntax
5884
5885 @cindex @sc{mit}
5886 This syntax for the Motorola 680x0 was developed at @sc{mit}.
5887
5888 @cindex M680x0 syntax
5889 @cindex syntax, M680x0
5890 @cindex M680x0 size modifiers
5891 @cindex size modifiers, M680x0
5892 The 680x0 version of @code{@value{AS}} uses syntax compatible with the Sun
5893 assembler. Intervening periods are ignored; for example, @samp{movl} is
5894 equivalent to @samp{move.l}.
5895
5896 @ifset INTERNALS
5897 If @code{@value{AS}} is compiled with SUN_ASM_SYNTAX defined, it
5898 also allows Sun-style local labels of the form @samp{1$} through
5899 @samp{$9}.
5900 @end ifset
5901
5902 In the following table @dfn{apc} stands for any of the address
5903 registers (@samp{a0} through @samp{a7}), nothing, (@samp{}), the
5904 Program Counter (@samp{pc}), or the zero-address relative to the
5905 program counter (@samp{zpc}).
5906
5907 @cindex M680x0 addressing modes
5908 @cindex addressing modes, M680x0
5909 The following addressing modes are understood:
5910 @table @dfn
5911 @item Immediate
5912 @samp{#@var{digits}}
5913
5914 @item Data Register
5915 @samp{d0} through @samp{d7}
5916
5917 @item Address Register
5918 @samp{a0} through @samp{a7}@*
5919 @samp{a7} is also known as @samp{sp}, i.e. the Stack Pointer. @code{a6}
5920 is also known as @samp{fp}, the Frame Pointer.
5921
5922 @item Address Register Indirect
5923 @samp{a0@@} through @samp{a7@@}
5924
5925 @item Address Register Postincrement
5926 @samp{a0@@+} through @samp{a7@@+}
5927
5928 @item Address Register Predecrement
5929 @samp{a0@@-} through @samp{a7@@-}
5930
5931 @item Indirect Plus Offset
5932 @samp{@var{apc}@@(@var{digits})}
5933
5934 @item Index
5935 @samp{@var{apc}@@(@var{digits},@var{register}:@var{size}:@var{scale})}
5936
5937 or @samp{@var{apc}@@(@var{register}:@var{size}:@var{scale})}
5938
5939 @item Postindex
5940 @samp{@var{apc}@@(@var{digits})@@(@var{digits},@var{register}:@var{size}:@var{scale})}
5941
5942 or @samp{@var{apc}@@(@var{digits})@@(@var{register}:@var{size}:@var{scale})}
5943
5944 @item Preindex
5945 @samp{@var{apc}@@(@var{digits},@var{register}:@var{size}:@var{scale})@@(@var{digits})}
5946
5947 or @samp{@var{apc}@@(@var{register}:@var{size}:@var{scale})@@(@var{digits})}
5948
5949 @item Memory Indirect
5950 @samp{@var{apc}@@(@var{digits})@@(@var{digits})}
5951
5952 @item Absolute
5953 @samp{@var{symbol}}, or @samp{@var{digits}}
5954 @ignore
5955 @c pesch@cygnus.com: gnu, rich concur the following needs careful
5956 @c research before documenting.
5957 , or either of the above followed
5958 by @samp{:b}, @samp{:w}, or @samp{:l}.
5959 @end ignore
5960 @end table
5961
5962 For some configurations, especially those where the compiler normally
5963 does not prepend an underscore to the names of user variables, the
5964 assembler requires a @samp{%} before any use of a register name. This
5965 is intended to let the assembler distinguish between user variables and
5966 registers named @samp{a0} through @samp{a7}, and so on. The @samp{%} is
5967 always accepted, but is only required for some configurations, notably
5968 @samp{m68k-coff}.
5969
5970 @node M68K-Moto-Syntax
5971 @section Motorola Syntax
5972
5973 @cindex Motorola syntax for the 680x0
5974 @cindex alternate syntax for the 680x0
5975
5976 The standard Motorola syntax for this chip differs from the syntax
5977 already discussed (@pxref{M68K-Syntax,,Syntax}). @code{@value{AS}} can
5978 accept some forms of Motorola syntax for operands, even if @sc{mit} syntax is
5979 used for other operands in the same instruction. The
5980 two kinds of syntax are fully compatible; our support for Motorola syntax is
5981 simply incomplete at present.
5982 @ignore
5983 @c FIXME! I can't figure out what this means. Surely the "always" is in some
5984 @c restricted context, for instance. It's not necessary for the preceding text
5985 @c to explain this, so just ignore it for now; re-enable someday when someone
5986 @c has time to explain it better.
5987 , because the Motorola syntax never uses
5988 the @samp{@@} character and the @sc{mit} syntax always does, except in
5989 cases where the syntaxes are identical.
5990 @end ignore
5991
5992 @cindex M680x0 syntax
5993 @cindex syntax, M680x0
5994 In particular, you may write or generate M68K assembler with the
5995 following conventions:
5996
5997 (In the following table @dfn{apc} stands for any of the address
5998 registers (@samp{a0} through @samp{a7}), nothing, (@samp{}), the
5999 Program Counter (@samp{pc}), or the zero-address relative to the
6000 program counter (@samp{zpc}).)
6001
6002 @cindex M680x0 addressing modes
6003 @cindex addressing modes, M680x0
6004 The following additional addressing modes are understood:
6005 @table @dfn
6006 @item Address Register Indirect
6007 @samp{a0} through @samp{a7}@*
6008 @samp{a7} is also known as @samp{sp}, i.e. the Stack Pointer. @code{a6}
6009 is also known as @samp{fp}, the Frame Pointer.
6010
6011 @item Address Register Postincrement
6012 @samp{(a0)+} through @samp{(a7)+}
6013
6014 @item Address Register Predecrement
6015 @samp{-(a0)} through @samp{-(a7)}
6016
6017 @item Indirect Plus Offset
6018 @samp{@var{digits}(@var{apc})}
6019
6020 @item Index
6021 @samp{@var{digits}(@var{apc},(@var{register}.@var{size}*@var{scale}))}@*
6022 or @samp{(@var{apc},@var{register}.@var{size}*@var{scale})}@*
6023 In either case, @var{size} and @var{scale} are optional
6024 (@var{scale} defaults to @samp{1}, @var{size} defaults to @samp{l}).
6025 @var{scale} can be @samp{1}, @samp{2}, @samp{4}, or @samp{8}.
6026 @var{size} can be @samp{w} or @samp{l}. @var{scale} is only supported
6027 on the 68020 and greater.
6028 @end table
6029
6030 Other, more complex addressing modes permitted in Motorola syntax are not
6031 handled.
6032
6033 @node M68K-Float
6034 @section Floating Point
6035
6036 @cindex floating point, M680x0
6037 @cindex M680x0 floating point
6038 @c FIXME is this "not too well tested" crud STILL true?
6039 The floating point code is not too well tested, and may have
6040 subtle bugs in it.
6041
6042 Packed decimal (P) format floating literals are not supported.
6043 Feel free to add the code!
6044
6045 The floating point formats generated by directives are these.
6046
6047 @table @code
6048 @item .float
6049 @cindex @code{float} directive, M680x0
6050 @code{Single} precision floating point constants.
6051
6052 @item .double
6053 @cindex @code{double} directive, M680x0
6054 @code{Double} precision floating point constants.
6055 @end table
6056
6057 There is no directive to produce regions of memory holding
6058 extended precision numbers, however they can be used as
6059 immediate operands to floating-point instructions. Adding a
6060 directive to create extended precision numbers would not be
6061 hard, but it has not yet seemed necessary.
6062
6063 @node M68K-Directives
6064 @section 680x0 Machine Directives
6065
6066 @cindex M680x0 directives
6067 @cindex directives, M680x0
6068 In order to be compatible with the Sun assembler the 680x0 assembler
6069 understands the following directives.
6070
6071 @table @code
6072 @item .data1
6073 @cindex @code{data1} directive, M680x0
6074 This directive is identical to a @code{.data 1} directive.
6075
6076 @item .data2
6077 @cindex @code{data2} directive, M680x0
6078 This directive is identical to a @code{.data 2} directive.
6079
6080 @item .even
6081 @cindex @code{even} directive, M680x0
6082 This directive is identical to a @code{.align 1} directive.
6083 @c Is this true? does it work???
6084
6085 @item .skip
6086 @cindex @code{skip} directive, M680x0
6087 This directive is identical to a @code{.space} directive.
6088 @end table
6089
6090 @need 2000
6091 @node M68K-opcodes
6092 @section Opcodes
6093
6094 @cindex M680x0 opcodes
6095 @cindex opcodes, M680x0
6096 @cindex instruction set, M680x0
6097 @c pesch@cygnus.com: I don't see any point in the following
6098 @c paragraph. Bugs are bugs; how does saying this
6099 @c help anyone?
6100 @ignore
6101 Danger: Several bugs have been found in the opcode table (and
6102 fixed). More bugs may exist. Be careful when using obscure
6103 instructions.
6104 @end ignore
6105
6106 @menu
6107 * M68K-Branch:: Branch Improvement
6108 * M68K-Chars:: Special Characters
6109 @end menu
6110
6111 @node M68K-Branch
6112 @subsection Branch Improvement
6113
6114 @cindex pseudo-opcodes, M680x0
6115 @cindex M680x0 pseudo-opcodes
6116 @cindex branch improvement, M680x0
6117 @cindex M680x0 branch improvement
6118 Certain pseudo opcodes are permitted for branch instructions.
6119 They expand to the shortest branch instruction that reach the
6120 target. Generally these mnemonics are made by substituting @samp{j} for
6121 @samp{b} at the start of a Motorola mnemonic.
6122
6123 The following table summarizes the pseudo-operations. A @code{*} flags
6124 cases that are more fully described after the table:
6125
6126 @smallexample
6127 Displacement
6128 +-------------------------------------------------
6129 | 68020 68000/10
6130 Pseudo-Op |BYTE WORD LONG LONG non-PC relative
6131 +-------------------------------------------------
6132 jbsr |bsrs bsr bsrl jsr jsr
6133 jra |bras bra bral jmp jmp
6134 * jXX |bXXs bXX bXXl bNXs;jmpl bNXs;jmp
6135 * dbXX |dbXX dbXX dbXX; bra; jmpl
6136 * fjXX |fbXXw fbXXw fbXXl fbNXw;jmp
6137
6138 XX: condition
6139 NX: negative of condition XX
6140
6141 @end smallexample
6142 @center @code{*}---see full description below
6143
6144 @table @code
6145 @item jbsr
6146 @itemx jra
6147 These are the simplest jump pseudo-operations; they always map to one
6148 particular machine instruction, depending on the displacement to the
6149 branch target.
6150
6151 @item j@var{XX}
6152 Here, @samp{j@var{XX}} stands for an entire family of pseudo-operations,
6153 where @var{XX} is a conditional branch or condition-code test. The full
6154 list of pseudo-ops in this family is:
6155 @smallexample
6156 jhi jls jcc jcs jne jeq jvc
6157 jvs jpl jmi jge jlt jgt jle
6158 @end smallexample
6159
6160 For the cases of non-PC relative displacements and long displacements on
6161 the 68000 or 68010, @code{@value{AS}} issues a longer code fragment in terms of
6162 @var{NX}, the opposite condition to @var{XX}. For example, for the
6163 non-PC relative case:
6164 @smallexample
6165 j@var{XX} foo
6166 @end smallexample
6167 gives
6168 @smallexample
6169 b@var{NX}s oof
6170 jmp foo
6171 oof:
6172 @end smallexample
6173
6174 @item db@var{XX}
6175 The full family of pseudo-operations covered here is
6176 @smallexample
6177 dbhi dbls dbcc dbcs dbne dbeq dbvc
6178 dbvs dbpl dbmi dbge dblt dbgt dble
6179 dbf dbra dbt
6180 @end smallexample
6181
6182 Other than for word and byte displacements, when the source reads
6183 @samp{db@var{XX} foo}, @code{@value{AS}} emits
6184 @smallexample
6185 db@var{XX} oo1
6186 bra oo2
6187 oo1:jmpl foo
6188 oo2:
6189 @end smallexample
6190
6191 @item fj@var{XX}
6192 This family includes
6193 @smallexample
6194 fjne fjeq fjge fjlt fjgt fjle fjf
6195 fjt fjgl fjgle fjnge fjngl fjngle fjngt
6196 fjnle fjnlt fjoge fjogl fjogt fjole fjolt
6197 fjor fjseq fjsf fjsne fjst fjueq fjuge
6198 fjugt fjule fjult fjun
6199 @end smallexample
6200
6201 For branch targets that are not PC relative, @code{@value{AS}} emits
6202 @smallexample
6203 fb@var{NX} oof
6204 jmp foo
6205 oof:
6206 @end smallexample
6207 when it encounters @samp{fj@var{XX} foo}.
6208
6209 @end table
6210
6211 @node M68K-Chars
6212 @subsection Special Characters
6213
6214 @cindex special characters, M680x0
6215 @cindex M680x0 immediate character
6216 @cindex immediate character, M680x0
6217 @cindex M680x0 line comment character
6218 @cindex line comment character, M680x0
6219 @cindex comments, M680x0
6220 The immediate character is @samp{#} for Sun compatibility. The
6221 line-comment character is @samp{|}. If a @samp{#} appears at the
6222 beginning of a line, it is treated as a comment unless it looks like
6223 @samp{# line file}, in which case it is treated normally.
6224
6225 @end ifset
6226 @ignore
6227 @c FIXME! Stop ignoring when filled in.
6228 @node 32x32
6229 @chapter 32x32
6230
6231 @section Options
6232 The 32x32 version of @code{@value{AS}} accepts a @samp{-m32032} option to
6233 specify thiat it is compiling for a 32032 processor, or a
6234 @samp{-m32532} to specify that it is compiling for a 32532 option.
6235 The default (if neither is specified) is chosen when the assembler
6236 is compiled.
6237
6238 @section Syntax
6239 I don't know anything about the 32x32 syntax assembled by
6240 @code{@value{AS}}. Someone who undersands the processor (I've never seen
6241 one) and the possible syntaxes should write this section.
6242
6243 @section Floating Point
6244 The 32x32 uses @sc{ieee} floating point numbers, but @code{@value{AS}}
6245 only creates single or double precision values. I don't know if the
6246 32x32 understands extended precision numbers.
6247
6248 @section 32x32 Machine Directives
6249 The 32x32 has no machine dependent directives.
6250
6251 @end ignore
6252 @ifset SPARC
6253 @ifset GENERIC
6254 @page
6255 @node Sparc-Dependent
6256 @chapter SPARC Dependent Features
6257 @end ifset
6258 @ifclear GENERIC
6259 @node Machine Dependencies
6260 @chapter SPARC Dependent Features
6261 @end ifclear
6262
6263 @cindex SPARC support
6264 @menu
6265 * Sparc-Opts:: Options
6266 * Sparc-Float:: Floating Point
6267 * Sparc-Directives:: Sparc Machine Directives
6268 @end menu
6269
6270 @node Sparc-Opts
6271 @section Options
6272
6273 @cindex options for SPARC
6274 @cindex SPARC options
6275 @cindex architectures, SPARC
6276 @cindex SPARC architectures
6277 The SPARC chip family includes several successive levels (or other
6278 variants) of chip, using the same core instruction set, but including
6279 a few additional instructions at each level.
6280
6281 By default, @code{@value{AS}} assumes the core instruction set (SPARC
6282 v6), but ``bumps'' the architecture level as needed: it switches to
6283 successively higher architectures as it encounters instructions that
6284 only exist in the higher levels.
6285
6286 @table @code
6287 @item -Av6 | -Av7 | -Av8 | -Asparclite
6288 @kindex -Av6
6289 @kindex Av7
6290 @kindex -Av8
6291 @kindex -Asparclite
6292 Use one of the @samp{-A} options to select one of the SPARC
6293 architectures explicitly. If you select an architecture explicitly,
6294 @code{@value{AS}} reports a fatal error if it encounters an instruction
6295 or feature requiring a higher level.
6296
6297 @item -bump
6298 Permit the assembler to ``bump'' the architecture level as required, but
6299 warn whenever it is necessary to switch to another level.
6300 @end table
6301
6302 @ignore
6303 @c FIXME: (sparc) Fill in "syntax" section!
6304 @c subsection syntax
6305 I don't know anything about Sparc syntax. Someone who does
6306 will have to write this section.
6307 @end ignore
6308
6309 @node Sparc-Float
6310 @section Floating Point
6311
6312 @cindex floating point, SPARC (@sc{ieee})
6313 @cindex SPARC floating point (@sc{ieee})
6314 The Sparc uses @sc{ieee} floating-point numbers.
6315
6316 @node Sparc-Directives
6317 @section Sparc Machine Directives
6318
6319 @cindex SPARC machine directives
6320 @cindex machine directives, SPARC
6321 The Sparc version of @code{@value{AS}} supports the following additional
6322 machine directives:
6323
6324 @table @code
6325 @item .common
6326 @cindex @code{common} directive, SPARC
6327 This must be followed by a symbol name, a positive number, and
6328 @code{"bss"}. This behaves somewhat like @code{.comm}, but the
6329 syntax is different.
6330
6331 @item .half
6332 @cindex @code{half} directive, SPARC
6333 This is functionally identical to @code{.short}.
6334
6335 @item .proc
6336 @cindex @code{proc} directive, SPARC
6337 This directive is ignored. Any text following it on the same
6338 line is also ignored.
6339
6340 @item .reserve
6341 @cindex @code{reserve} directive, SPARC
6342 This must be followed by a symbol name, a positive number, and
6343 @code{"bss"}. This behaves somewhat like @code{.lcomm}, but the
6344 syntax is different.
6345
6346 @item .seg
6347 @cindex @code{seg} directive, SPARC
6348 This must be followed by @code{"text"}, @code{"data"}, or
6349 @code{"data1"}. It behaves like @code{.text}, @code{.data}, or
6350 @code{.data 1}.
6351
6352 @item .skip
6353 @cindex @code{skip} directive, SPARC
6354 This is functionally identical to the @code{.space} directive.
6355
6356 @item .word
6357 @cindex @code{word} directive, SPARC
6358 On the Sparc, the .word directive produces 32 bit values,
6359 instead of the 16 bit values it produces on many other machines.
6360 @end table
6361
6362 @end ifset
6363 @ifset I80386
6364 @ifset GENERIC
6365 @page
6366 @node i386-Dependent
6367 @chapter 80386 Dependent Features
6368 @end ifset
6369 @ifclear GENERIC
6370 @node Machine Dependencies
6371 @chapter 80386 Dependent Features
6372 @end ifclear
6373
6374 @cindex i386 support
6375 @cindex i80306 support
6376 @menu
6377 * i386-Options:: Options
6378 * i386-Syntax:: AT&T Syntax versus Intel Syntax
6379 * i386-Opcodes:: Opcode Naming
6380 * i386-Regs:: Register Naming
6381 * i386-prefixes:: Opcode Prefixes
6382 * i386-Memory:: Memory References
6383 * i386-jumps:: Handling of Jump Instructions
6384 * i386-Float:: Floating Point
6385 * i386-Notes:: Notes
6386 @end menu
6387
6388 @node i386-Options
6389 @section Options
6390
6391 @cindex options for i386 (none)
6392 @cindex i386 options (none)
6393 The 80386 has no machine dependent options.
6394
6395 @node i386-Syntax
6396 @section AT&T Syntax versus Intel Syntax
6397
6398 @cindex i386 syntax compatibility
6399 @cindex syntax compatibility, i386
6400 In order to maintain compatibility with the output of @code{@value{GCC}},
6401 @code{@value{AS}} supports AT&T System V/386 assembler syntax. This is quite
6402 different from Intel syntax. We mention these differences because
6403 almost all 80386 documents used only Intel syntax. Notable differences
6404 between the two syntaxes are:
6405
6406 @itemize @bullet
6407 @item
6408 @cindex immediate operands, i386
6409 @cindex i386 immediate operands
6410 @cindex register operands, i386
6411 @cindex i386 register operands
6412 @cindex jump/call operands, i386
6413 @cindex i386 jump/call operands
6414 @cindex operand delimiters, i386
6415 AT&T immediate operands are preceded by @samp{$}; Intel immediate
6416 operands are undelimited (Intel @samp{push 4} is AT&T @samp{pushl $4}).
6417 AT&T register operands are preceded by @samp{%}; Intel register operands
6418 are undelimited. AT&T absolute (as opposed to PC relative) jump/call
6419 operands are prefixed by @samp{*}; they are undelimited in Intel syntax.
6420
6421 @item
6422 @cindex i386 source, destination operands
6423 @cindex source, destination operands; i386
6424 AT&T and Intel syntax use the opposite order for source and destination
6425 operands. Intel @samp{add eax, 4} is @samp{addl $4, %eax}. The
6426 @samp{source, dest} convention is maintained for compatibility with
6427 previous Unix assemblers.
6428
6429 @item
6430 @cindex opcode suffixes, i386
6431 @cindex sizes operands, i386
6432 @cindex i386 size suffixes
6433 In AT&T syntax the size of memory operands is determined from the last
6434 character of the opcode name. Opcode suffixes of @samp{b}, @samp{w},
6435 and @samp{l} specify byte (8-bit), word (16-bit), and long (32-bit)
6436 memory references. Intel syntax accomplishes this by prefixes memory
6437 operands (@emph{not} the opcodes themselves) with @samp{byte ptr},
6438 @samp{word ptr}, and @samp{dword ptr}. Thus, Intel @samp{mov al, byte
6439 ptr @var{foo}} is @samp{movb @var{foo}, %al} in AT&T syntax.
6440
6441 @item
6442 @cindex return instructions, i386
6443 @cindex i386 jump, call, return
6444 Immediate form long jumps and calls are
6445 @samp{lcall/ljmp $@var{section}, $@var{offset}} in AT&T syntax; the
6446 Intel syntax is
6447 @samp{call/jmp far @var{section}:@var{offset}}. Also, the far return
6448 instruction
6449 is @samp{lret $@var{stack-adjust}} in AT&T syntax; Intel syntax is
6450 @samp{ret far @var{stack-adjust}}.
6451
6452 @item
6453 @cindex sections, i386
6454 @cindex i386 sections
6455 The AT&T assembler does not provide support for multiple section
6456 programs. Unix style systems expect all programs to be single sections.
6457 @end itemize
6458
6459 @node i386-Opcodes
6460 @section Opcode Naming
6461
6462 @cindex i386 opcode naming
6463 @cindex opcode naming, i386
6464 Opcode names are suffixed with one character modifiers which specify the
6465 size of operands. The letters @samp{b}, @samp{w}, and @samp{l} specify
6466 byte, word, and long operands. If no suffix is specified by an
6467 instruction and it contains no memory operands then @code{@value{AS}} tries to
6468 fill in the missing suffix based on the destination register operand
6469 (the last one by convention). Thus, @samp{mov %ax, %bx} is equivalent
6470 to @samp{movw %ax, %bx}; also, @samp{mov $1, %bx} is equivalent to
6471 @samp{movw $1, %bx}. Note that this is incompatible with the AT&T Unix
6472 assembler which assumes that a missing opcode suffix implies long
6473 operand size. (This incompatibility does not affect compiler output
6474 since compilers always explicitly specify the opcode suffix.)
6475
6476 Almost all opcodes have the same names in AT&T and Intel format. There
6477 are a few exceptions. The sign extend and zero extend instructions need
6478 two sizes to specify them. They need a size to sign/zero extend
6479 @emph{from} and a size to zero extend @emph{to}. This is accomplished
6480 by using two opcode suffixes in AT&T syntax. Base names for sign extend
6481 and zero extend are @samp{movs@dots{}} and @samp{movz@dots{}} in AT&T
6482 syntax (@samp{movsx} and @samp{movzx} in Intel syntax). The opcode
6483 suffixes are tacked on to this base name, the @emph{from} suffix before
6484 the @emph{to} suffix. Thus, @samp{movsbl %al, %edx} is AT&T syntax for
6485 ``move sign extend @emph{from} %al @emph{to} %edx.'' Possible suffixes,
6486 thus, are @samp{bl} (from byte to long), @samp{bw} (from byte to word),
6487 and @samp{wl} (from word to long).
6488
6489 @cindex conversion instructions, i386
6490 @cindex i386 conversion instructions
6491 The Intel-syntax conversion instructions
6492
6493 @itemize @bullet
6494 @item
6495 @samp{cbw} --- sign-extend byte in @samp{%al} to word in @samp{%ax},
6496
6497 @item
6498 @samp{cwde} --- sign-extend word in @samp{%ax} to long in @samp{%eax},
6499
6500 @item
6501 @samp{cwd} --- sign-extend word in @samp{%ax} to long in @samp{%dx:%ax},
6502
6503 @item
6504 @samp{cdq} --- sign-extend dword in @samp{%eax} to quad in @samp{%edx:%eax},
6505 @end itemize
6506
6507 @noindent
6508 are called @samp{cbtw}, @samp{cwtl}, @samp{cwtd}, and @samp{cltd} in
6509 AT&T naming. @code{@value{AS}} accepts either naming for these instructions.
6510
6511 @cindex jump instructions, i386
6512 @cindex call instructions, i386
6513 Far call/jump instructions are @samp{lcall} and @samp{ljmp} in
6514 AT&T syntax, but are @samp{call far} and @samp{jump far} in Intel
6515 convention.
6516
6517 @node i386-Regs
6518 @section Register Naming
6519
6520 @cindex i386 registers
6521 @cindex registers, i386
6522 Register operands are always prefixes with @samp{%}. The 80386 registers
6523 consist of
6524
6525 @itemize @bullet
6526 @item
6527 the 8 32-bit registers @samp{%eax} (the accumulator), @samp{%ebx},
6528 @samp{%ecx}, @samp{%edx}, @samp{%edi}, @samp{%esi}, @samp{%ebp} (the
6529 frame pointer), and @samp{%esp} (the stack pointer).
6530
6531 @item
6532 the 8 16-bit low-ends of these: @samp{%ax}, @samp{%bx}, @samp{%cx},
6533 @samp{%dx}, @samp{%di}, @samp{%si}, @samp{%bp}, and @samp{%sp}.
6534
6535 @item
6536 the 8 8-bit registers: @samp{%ah}, @samp{%al}, @samp{%bh},
6537 @samp{%bl}, @samp{%ch}, @samp{%cl}, @samp{%dh}, and @samp{%dl} (These
6538 are the high-bytes and low-bytes of @samp{%ax}, @samp{%bx},
6539 @samp{%cx}, and @samp{%dx})
6540
6541 @item
6542 the 6 section registers @samp{%cs} (code section), @samp{%ds}
6543 (data section), @samp{%ss} (stack section), @samp{%es}, @samp{%fs},
6544 and @samp{%gs}.
6545
6546 @item
6547 the 3 processor control registers @samp{%cr0}, @samp{%cr2}, and
6548 @samp{%cr3}.
6549
6550 @item
6551 the 6 debug registers @samp{%db0}, @samp{%db1}, @samp{%db2},
6552 @samp{%db3}, @samp{%db6}, and @samp{%db7}.
6553
6554 @item
6555 the 2 test registers @samp{%tr6} and @samp{%tr7}.
6556
6557 @item
6558 the 8 floating point register stack @samp{%st} or equivalently
6559 @samp{%st(0)}, @samp{%st(1)}, @samp{%st(2)}, @samp{%st(3)},
6560 @samp{%st(4)}, @samp{%st(5)}, @samp{%st(6)}, and @samp{%st(7)}.
6561 @end itemize
6562
6563 @node i386-prefixes
6564 @section Opcode Prefixes
6565
6566 @cindex i386 opcode prefixes
6567 @cindex opcode prefixes, i386
6568 @cindex prefixes, i386
6569 Opcode prefixes are used to modify the following opcode. They are used
6570 to repeat string instructions, to provide section overrides, to perform
6571 bus lock operations, and to give operand and address size (16-bit
6572 operands are specified in an instruction by prefixing what would
6573 normally be 32-bit operands with a ``operand size'' opcode prefix).
6574 Opcode prefixes are usually given as single-line instructions with no
6575 operands, and must directly precede the instruction they act upon. For
6576 example, the @samp{scas} (scan string) instruction is repeated with:
6577 @smallexample
6578 repne
6579 scas
6580 @end smallexample
6581
6582 Here is a list of opcode prefixes:
6583
6584 @itemize @bullet
6585 @item
6586 @cindex section override prefixes, i386
6587 Section override prefixes @samp{cs}, @samp{ds}, @samp{ss}, @samp{es},
6588 @samp{fs}, @samp{gs}. These are automatically added by specifying
6589 using the @var{section}:@var{memory-operand} form for memory references.
6590
6591 @item
6592 @cindex size prefixes, i386
6593 Operand/Address size prefixes @samp{data16} and @samp{addr16}
6594 change 32-bit operands/addresses into 16-bit operands/addresses. Note
6595 that 16-bit addressing modes (i.e. 8086 and 80286 addressing modes)
6596 are not supported (yet).
6597
6598 @item
6599 @cindex bus lock prefixes, i386
6600 @cindex inhibiting interrupts, i386
6601 The bus lock prefix @samp{lock} inhibits interrupts during
6602 execution of the instruction it precedes. (This is only valid with
6603 certain instructions; see a 80386 manual for details).
6604
6605 @item
6606 @cindex coprocessor wait, i386
6607 The wait for coprocessor prefix @samp{wait} waits for the
6608 coprocessor to complete the current instruction. This should never be
6609 needed for the 80386/80387 combination.
6610
6611 @item
6612 @cindex repeat prefixes, i386
6613 The @samp{rep}, @samp{repe}, and @samp{repne} prefixes are added
6614 to string instructions to make them repeat @samp{%ecx} times.
6615 @end itemize
6616
6617 @node i386-Memory
6618 @section Memory References
6619
6620 @cindex i386 memory references
6621 @cindex memory references, i386
6622 An Intel syntax indirect memory reference of the form
6623
6624 @smallexample
6625 @var{section}:[@var{base} + @var{index}*@var{scale} + @var{disp}]
6626 @end smallexample
6627
6628 @noindent
6629 is translated into the AT&T syntax
6630
6631 @smallexample
6632 @var{section}:@var{disp}(@var{base}, @var{index}, @var{scale})
6633 @end smallexample
6634
6635 @noindent
6636 where @var{base} and @var{index} are the optional 32-bit base and
6637 index registers, @var{disp} is the optional displacement, and
6638 @var{scale}, taking the values 1, 2, 4, and 8, multiplies @var{index}
6639 to calculate the address of the operand. If no @var{scale} is
6640 specified, @var{scale} is taken to be 1. @var{section} specifies the
6641 optional section register for the memory operand, and may override the
6642 default section register (see a 80386 manual for section register
6643 defaults). Note that section overrides in AT&T syntax @emph{must} have
6644 be preceded by a @samp{%}. If you specify a section override which
6645 coincides with the default section register, @code{@value{AS}} does @emph{not}
6646 output any section register override prefixes to assemble the given
6647 instruction. Thus, section overrides can be specified to emphasize which
6648 section register is used for a given memory operand.
6649
6650 Here are some examples of Intel and AT&T style memory references:
6651
6652 @table @asis
6653 @item AT&T: @samp{-4(%ebp)}, Intel: @samp{[ebp - 4]}
6654 @var{base} is @samp{%ebp}; @var{disp} is @samp{-4}. @var{section} is
6655 missing, and the default section is used (@samp{%ss} for addressing with
6656 @samp{%ebp} as the base register). @var{index}, @var{scale} are both missing.
6657
6658 @item AT&T: @samp{foo(,%eax,4)}, Intel: @samp{[foo + eax*4]}
6659 @var{index} is @samp{%eax} (scaled by a @var{scale} 4); @var{disp} is
6660 @samp{foo}. All other fields are missing. The section register here
6661 defaults to @samp{%ds}.
6662
6663 @item AT&T: @samp{foo(,1)}; Intel @samp{[foo]}
6664 This uses the value pointed to by @samp{foo} as a memory operand.
6665 Note that @var{base} and @var{index} are both missing, but there is only
6666 @emph{one} @samp{,}. This is a syntactic exception.
6667
6668 @item AT&T: @samp{%gs:foo}; Intel @samp{gs:foo}
6669 This selects the contents of the variable @samp{foo} with section
6670 register @var{section} being @samp{%gs}.
6671 @end table
6672
6673 Absolute (as opposed to PC relative) call and jump operands must be
6674 prefixed with @samp{*}. If no @samp{*} is specified, @code{@value{AS}}
6675 always chooses PC relative addressing for jump/call labels.
6676
6677 Any instruction that has a memory operand @emph{must} specify its size (byte,
6678 word, or long) with an opcode suffix (@samp{b}, @samp{w}, or @samp{l},
6679 respectively).
6680
6681 @node i386-jumps
6682 @section Handling of Jump Instructions
6683
6684 @cindex jump optimization, i386
6685 @cindex i386 jump optimization
6686 Jump instructions are always optimized to use the smallest possible
6687 displacements. This is accomplished by using byte (8-bit) displacement
6688 jumps whenever the target is sufficiently close. If a byte displacement
6689 is insufficient a long (32-bit) displacement is used. We do not support
6690 word (16-bit) displacement jumps (i.e. prefixing the jump instruction
6691 with the @samp{addr16} opcode prefix), since the 80386 insists upon masking
6692 @samp{%eip} to 16 bits after the word displacement is added.
6693
6694 Note that the @samp{jcxz}, @samp{jecxz}, @samp{loop}, @samp{loopz},
6695 @samp{loope}, @samp{loopnz} and @samp{loopne} instructions only come in byte
6696 displacements, so that if you use these instructions (@code{@value{GCC}} does
6697 not use them) you may get an error message (and incorrect code). The AT&T
6698 80386 assembler tries to get around this problem by expanding @samp{jcxz foo}
6699 to
6700
6701 @smallexample
6702 jcxz cx_zero
6703 jmp cx_nonzero
6704 cx_zero: jmp foo
6705 cx_nonzero:
6706 @end smallexample
6707
6708 @node i386-Float
6709 @section Floating Point
6710
6711 @cindex i386 floating point
6712 @cindex floating point, i386
6713 All 80387 floating point types except packed BCD are supported.
6714 (BCD support may be added without much difficulty). These data
6715 types are 16-, 32-, and 64- bit integers, and single (32-bit),
6716 double (64-bit), and extended (80-bit) precision floating point.
6717 Each supported type has an opcode suffix and a constructor
6718 associated with it. Opcode suffixes specify operand's data
6719 types. Constructors build these data types into memory.
6720
6721 @itemize @bullet
6722 @item
6723 @cindex @code{float} directive, i386
6724 @cindex @code{single} directive, i386
6725 @cindex @code{double} directive, i386
6726 @cindex @code{tfloat} directive, i386
6727 Floating point constructors are @samp{.float} or @samp{.single},
6728 @samp{.double}, and @samp{.tfloat} for 32-, 64-, and 80-bit formats.
6729 These correspond to opcode suffixes @samp{s}, @samp{l}, and @samp{t}.
6730 @samp{t} stands for temporary real, and that the 80387 only supports
6731 this format via the @samp{fldt} (load temporary real to stack top) and
6732 @samp{fstpt} (store temporary real and pop stack) instructions.
6733
6734 @item
6735 @cindex @code{word} directive, i386
6736 @cindex @code{long} directive, i386
6737 @cindex @code{int} directive, i386
6738 @cindex @code{quad} directive, i386
6739 Integer constructors are @samp{.word}, @samp{.long} or @samp{.int}, and
6740 @samp{.quad} for the 16-, 32-, and 64-bit integer formats. The corresponding
6741 opcode suffixes are @samp{s} (single), @samp{l} (long), and @samp{q}
6742 (quad). As with the temporary real format the 64-bit @samp{q} format is
6743 only present in the @samp{fildq} (load quad integer to stack top) and
6744 @samp{fistpq} (store quad integer and pop stack) instructions.
6745 @end itemize
6746
6747 Register to register operations do not require opcode suffixes,
6748 so that @samp{fst %st, %st(1)} is equivalent to @samp{fstl %st, %st(1)}.
6749
6750 @cindex i386 @code{fwait} instruction
6751 @cindex @code{fwait instruction}, i386
6752 Since the 80387 automatically synchronizes with the 80386 @samp{fwait}
6753 instructions are almost never needed (this is not the case for the
6754 80286/80287 and 8086/8087 combinations). Therefore, @code{@value{AS}} suppresses
6755 the @samp{fwait} instruction whenever it is implicitly selected by one
6756 of the @samp{fn@dots{}} instructions. For example, @samp{fsave} and
6757 @samp{fnsave} are treated identically. In general, all the @samp{fn@dots{}}
6758 instructions are made equivalent to @samp{f@dots{}} instructions. If
6759 @samp{fwait} is desired it must be explicitly coded.
6760
6761 @node i386-Notes
6762 @section Notes
6763
6764 @cindex i386 @code{mul}, @code{imul} instructions
6765 @cindex @code{mul} instruction, i386
6766 @cindex @code{imul} instruction, i386
6767 There is some trickery concerning the @samp{mul} and @samp{imul}
6768 instructions that deserves mention. The 16-, 32-, and 64-bit expanding
6769 multiplies (base opcode @samp{0xf6}; extension 4 for @samp{mul} and 5
6770 for @samp{imul}) can be output only in the one operand form. Thus,
6771 @samp{imul %ebx, %eax} does @emph{not} select the expanding multiply;
6772 the expanding multiply would clobber the @samp{%edx} register, and this
6773 would confuse @code{@value{GCC}} output. Use @samp{imul %ebx} to get the
6774 64-bit product in @samp{%edx:%eax}.
6775
6776 We have added a two operand form of @samp{imul} when the first operand
6777 is an immediate mode expression and the second operand is a register.
6778 This is just a shorthand, so that, multiplying @samp{%eax} by 69, for
6779 example, can be done with @samp{imul $69, %eax} rather than @samp{imul
6780 $69, %eax, %eax}.
6781
6782 @end ifset
6783 @ifset Z8000
6784 @ifset GENERIC
6785 @page
6786 @node Z8000-Dependent
6787 @chapter Z8000 Dependent Features
6788 @end ifset
6789 @ifclear GENERIC
6790 @node Machine Dependencies
6791 @chapter Z8000 Dependent Features
6792 @end ifclear
6793
6794 @cindex Z8000 support
6795 The Z8000 @value{AS} supports both members of the Z8000 family: the
6796 unsegmented Z8002, with 16 bit addresses, and the segmented Z8001 with
6797 24 bit addresses.
6798
6799 When the assembler is in unsegmented mode (specified with the
6800 @code{unsegm} directive), an address takes up one word (16 bit)
6801 sized register. When the assembler is in segmented mode (specified with
6802 the @code{segm} directive), a 24-bit address takes up a long (32 bit)
6803 register. @xref{Z8000 Directives,,Assembler Directives for the Z8000},
6804 for a list of other Z8000 specific assembler directives.
6805
6806 @menu
6807 * Z8000 Options:: No special command-line options for Z8000
6808 * Z8000 Syntax:: Assembler syntax for the Z8000
6809 * Z8000 Directives:: Special directives for the Z8000
6810 * Z8000 Opcodes:: Opcodes
6811 @end menu
6812
6813 @node Z8000 Options
6814 @section Options
6815
6816 @cindex Z8000 options
6817 @cindex options, Z8000
6818 @code{@value{AS}} has no additional command-line options for the Zilog
6819 Z8000 family.
6820
6821 @node Z8000 Syntax
6822 @section Syntax
6823 @menu
6824 * Z8000-Chars:: Special Characters
6825 * Z8000-Regs:: Register Names
6826 * Z8000-Addressing:: Addressing Modes
6827 @end menu
6828
6829 @node Z8000-Chars
6830 @subsection Special Characters
6831
6832 @cindex line comment character, Z8000
6833 @cindex Z8000 line comment character
6834 @samp{!} is the line comment character.
6835
6836 @cindex line separator, Z8000
6837 @cindex statement separator, Z8000
6838 @cindex Z8000 line separator
6839 You can use @samp{;} instead of a newline to separate statements.
6840
6841 @node Z8000-Regs
6842 @subsection Register Names
6843
6844 @cindex Z8000 registers
6845 @cindex registers, Z8000
6846 The Z8000 has sixteen 16 bit registers, numbered 0 to 15. You can refer
6847 to different sized groups of registers by register number, with the
6848 prefix @samp{r} for 16 bit registers, @samp{rr} for 32 bit registers and
6849 @samp{rq} for 64 bit registers. You can also refer to the contents of
6850 the first eight (of the sixteen 16 bit registers) by bytes. They are
6851 named @samp{r@var{n}h} and @samp{r@var{n}l}.
6852
6853 @smallexample
6854 @exdent @emph{byte registers}
6855 r0l r0h r1h r1l r2h r2l r3h r3l
6856 r4h r4l r5h r5l r6h r6l r7h r7l
6857
6858 @exdent @emph{word registers}
6859 r0 r1 r2 r3 r4 r5 r6 r7 r8 r9 r10 r11 r12 r13 r14 r15
6860
6861 @exdent @emph{long word registers}
6862 rr0 rr2 rr4 rr6 rr8 rr10 rr12 rr14
6863
6864 @exdent @emph{quad word registers}
6865 rq0 rq4 rq8 rq12
6866 @end smallexample
6867
6868 @node Z8000-Addressing
6869 @subsection Addressing Modes
6870
6871 @cindex addressing modes, Z8000
6872 @cindex Z800 addressing modes
6873 @value{AS} understands the following addressing modes for the Z8000:
6874
6875 @table @code
6876 @item r@var{n}
6877 Register direct
6878
6879 @item @@r@var{n}
6880 Indirect register
6881
6882 @item @var{addr}
6883 Direct: the 16 bit or 24 bit address (depending on whether the assembler
6884 is in segmented or unsegmented mode) of the operand is in the instruction.
6885
6886 @item address(r@var{n})
6887 Indexed: the 16 or 24 bit address is added to the 16 bit register to produce
6888 the final address in memory of the operand.
6889
6890 @item r@var{n}(#@var{imm})
6891 Base Address: the 16 or 24 bit register is added to the 16 bit sign
6892 extended immediate displacement to produce the final address in memory
6893 of the operand.
6894
6895 @item r@var{n}(r@var{m})
6896 Base Index: the 16 or 24 bit register r@var{n} is added to the sign
6897 extended 16 bit index register r@var{m} to produce the final address in
6898 memory of the operand.
6899
6900 @item #@var{xx}
6901 Immediate data @var{xx}.
6902 @end table
6903
6904 @node Z8000 Directives
6905 @section Assembler Directives for the Z8000
6906
6907 @cindex Z8000 directives
6908 @cindex directives, Z8000
6909 The Z8000 port of @value{AS} includes these additional assembler directives,
6910 for compatibility with other Z8000 assemblers. As shown, these do not
6911 begin with @samp{.} (unlike the ordinary @value{AS} directives).
6912
6913 @table @code
6914 @item segm
6915 @kindex segm
6916 Generates code for the segmented Z8001.
6917
6918 @item unsegm
6919 @kindex unsegm
6920 Generates code for the unsegmented Z8002.
6921
6922 @item name
6923 @kindex name
6924 Synonym for @code{.file}
6925
6926 @item global
6927 @kindex global
6928 Synonum for @code{.global}
6929
6930 @item wval
6931 @kindex wval
6932 Synonym for @code{.word}
6933
6934 @item lval
6935 @kindex lval
6936 Synonym for @code{.long}
6937
6938 @item bval
6939 @kindex bval
6940 Synonym for @code{.byte}
6941
6942 @item sval
6943 @kindex sval
6944 Assemble a string. @code{sval} expects one string literal, delimited by
6945 single quotes. It assembles each byte of the string into consecutive
6946 addresses. You can use the escape sequence @samp{%@var{xx}} (where
6947 @var{xx} represents a two-digit hexadecimal number) to represent the
6948 character whose @sc{ascii} value is @var{xx}. Use this feature to
6949 describe single quote and other characters that may not appear in string
6950 literals as themselves. For example, the C statement @w{@samp{char *a =
6951 "he said \"it's 50% off\"";}} is represented in Z8000 assembly language
6952 (shown with the assembler output in hex at the left) as
6953
6954 @iftex
6955 @begingroup
6956 @let@nonarrowing=@comment
6957 @end iftex
6958 @smallexample
6959 68652073 sval 'he said %22it%27s 50%25 off%22%00'
6960 61696420
6961 22697427
6962 73203530
6963 25206F66
6964 662200
6965 @end smallexample
6966 @iftex
6967 @endgroup
6968 @end iftex
6969
6970 @item rsect
6971 @kindex rsect
6972 synonym for @code{.section}
6973
6974 @item block
6975 @kindex block
6976 synonym for @code{.space}
6977
6978 @item even
6979 @kindex even
6980 synonym for @code{.align 1}
6981 @end table
6982
6983 @node Z8000 Opcodes
6984 @section Opcodes
6985
6986 @cindex Z8000 opcode summary
6987 @cindex opcode summary, Z8000
6988 @cindex mnemonics, Z8000
6989 @cindex instruction summary, Z8000
6990 For detailed information on the Z8000 machine instruction set, see
6991 @cite{Z8000 Technical Manual}.
6992
6993 @ifset SMALL
6994 @c this table, due to the multi-col faking and hardcoded order, looks silly
6995 @c except in smallbook. See comments below "@set SMALL" near top of this file.
6996
6997 The following table summarizes the opcodes and their arguments:
6998 @iftex
6999 @begingroup
7000 @let@nonarrowing=@comment
7001 @end iftex
7002 @smallexample
7003
7004 rs @r{16 bit source register}
7005 rd @r{16 bit destination register}
7006 rbs @r{8 bit source register}
7007 rbd @r{8 bit destination register}
7008 rrs @r{32 bit source register}
7009 rrd @r{32 bit destination register}
7010 rqs @r{64 bit source register}
7011 rqd @r{64 bit destination register}
7012 addr @r{16/24 bit address}
7013 imm @r{immediate data}
7014
7015 adc rd,rs clrb addr cpsir @@rd,@@rs,rr,cc
7016 adcb rbd,rbs clrb addr(rd) cpsirb @@rd,@@rs,rr,cc
7017 add rd,@@rs clrb rbd dab rbd
7018 add rd,addr com @@rd dbjnz rbd,disp7
7019 add rd,addr(rs) com addr dec @@rd,imm4m1
7020 add rd,imm16 com addr(rd) dec addr(rd),imm4m1
7021 add rd,rs com rd dec addr,imm4m1
7022 addb rbd,@@rs comb @@rd dec rd,imm4m1
7023 addb rbd,addr comb addr decb @@rd,imm4m1
7024 addb rbd,addr(rs) comb addr(rd) decb addr(rd),imm4m1
7025 addb rbd,imm8 comb rbd decb addr,imm4m1
7026 addb rbd,rbs comflg flags decb rbd,imm4m1
7027 addl rrd,@@rs cp @@rd,imm16 di i2
7028 addl rrd,addr cp addr(rd),imm16 div rrd,@@rs
7029 addl rrd,addr(rs) cp addr,imm16 div rrd,addr
7030 addl rrd,imm32 cp rd,@@rs div rrd,addr(rs)
7031 addl rrd,rrs cp rd,addr div rrd,imm16
7032 and rd,@@rs cp rd,addr(rs) div rrd,rs
7033 and rd,addr cp rd,imm16 divl rqd,@@rs
7034 and rd,addr(rs) cp rd,rs divl rqd,addr
7035 and rd,imm16 cpb @@rd,imm8 divl rqd,addr(rs)
7036 and rd,rs cpb addr(rd),imm8 divl rqd,imm32
7037 andb rbd,@@rs cpb addr,imm8 divl rqd,rrs
7038 andb rbd,addr cpb rbd,@@rs djnz rd,disp7
7039 andb rbd,addr(rs) cpb rbd,addr ei i2
7040 andb rbd,imm8 cpb rbd,addr(rs) ex rd,@@rs
7041 andb rbd,rbs cpb rbd,imm8 ex rd,addr
7042 bit @@rd,imm4 cpb rbd,rbs ex rd,addr(rs)
7043 bit addr(rd),imm4 cpd rd,@@rs,rr,cc ex rd,rs
7044 bit addr,imm4 cpdb rbd,@@rs,rr,cc exb rbd,@@rs
7045 bit rd,imm4 cpdr rd,@@rs,rr,cc exb rbd,addr
7046 bit rd,rs cpdrb rbd,@@rs,rr,cc exb rbd,addr(rs)
7047 bitb @@rd,imm4 cpi rd,@@rs,rr,cc exb rbd,rbs
7048 bitb addr(rd),imm4 cpib rbd,@@rs,rr,cc ext0e imm8
7049 bitb addr,imm4 cpir rd,@@rs,rr,cc ext0f imm8
7050 bitb rbd,imm4 cpirb rbd,@@rs,rr,cc ext8e imm8
7051 bitb rbd,rs cpl rrd,@@rs ext8f imm8
7052 bpt cpl rrd,addr exts rrd
7053 call @@rd cpl rrd,addr(rs) extsb rd
7054 call addr cpl rrd,imm32 extsl rqd
7055 call addr(rd) cpl rrd,rrs halt
7056 calr disp12 cpsd @@rd,@@rs,rr,cc in rd,@@rs
7057 clr @@rd cpsdb @@rd,@@rs,rr,cc in rd,imm16
7058 clr addr cpsdr @@rd,@@rs,rr,cc inb rbd,@@rs
7059 clr addr(rd) cpsdrb @@rd,@@rs,rr,cc inb rbd,imm16
7060 clr rd cpsi @@rd,@@rs,rr,cc inc @@rd,imm4m1
7061 clrb @@rd cpsib @@rd,@@rs,rr,cc inc addr(rd),imm4m1
7062 inc addr,imm4m1 ldb rbd,rs(rx) mult rrd,addr(rs)
7063 inc rd,imm4m1 ldb rd(imm16),rbs mult rrd,imm16
7064 incb @@rd,imm4m1 ldb rd(rx),rbs mult rrd,rs
7065 incb addr(rd),imm4m1 ldctl ctrl,rs multl rqd,@@rs
7066 incb addr,imm4m1 ldctl rd,ctrl multl rqd,addr
7067 incb rbd,imm4m1 ldd @@rs,@@rd,rr multl rqd,addr(rs)
7068 ind @@rd,@@rs,ra lddb @@rs,@@rd,rr multl rqd,imm32
7069 indb @@rd,@@rs,rba lddr @@rs,@@rd,rr multl rqd,rrs
7070 inib @@rd,@@rs,ra lddrb @@rs,@@rd,rr neg @@rd
7071 inibr @@rd,@@rs,ra ldi @@rd,@@rs,rr neg addr
7072 iret ldib @@rd,@@rs,rr neg addr(rd)
7073 jp cc,@@rd ldir @@rd,@@rs,rr neg rd
7074 jp cc,addr ldirb @@rd,@@rs,rr negb @@rd
7075 jp cc,addr(rd) ldk rd,imm4 negb addr
7076 jr cc,disp8 ldl @@rd,rrs negb addr(rd)
7077 ld @@rd,imm16 ldl addr(rd),rrs negb rbd
7078 ld @@rd,rs ldl addr,rrs nop
7079 ld addr(rd),imm16 ldl rd(imm16),rrs or rd,@@rs
7080 ld addr(rd),rs ldl rd(rx),rrs or rd,addr
7081 ld addr,imm16 ldl rrd,@@rs or rd,addr(rs)
7082 ld addr,rs ldl rrd,addr or rd,imm16
7083 ld rd(imm16),rs ldl rrd,addr(rs) or rd,rs
7084 ld rd(rx),rs ldl rrd,imm32 orb rbd,@@rs
7085 ld rd,@@rs ldl rrd,rrs orb rbd,addr
7086 ld rd,addr ldl rrd,rs(imm16) orb rbd,addr(rs)
7087 ld rd,addr(rs) ldl rrd,rs(rx) orb rbd,imm8
7088 ld rd,imm16 ldm @@rd,rs,n orb rbd,rbs
7089 ld rd,rs ldm addr(rd),rs,n out @@rd,rs
7090 ld rd,rs(imm16) ldm addr,rs,n out imm16,rs
7091 ld rd,rs(rx) ldm rd,@@rs,n outb @@rd,rbs
7092 lda rd,addr ldm rd,addr(rs),n outb imm16,rbs
7093 lda rd,addr(rs) ldm rd,addr,n outd @@rd,@@rs,ra
7094 lda rd,rs(imm16) ldps @@rs outdb @@rd,@@rs,rba
7095 lda rd,rs(rx) ldps addr outib @@rd,@@rs,ra
7096 ldar rd,disp16 ldps addr(rs) outibr @@rd,@@rs,ra
7097 ldb @@rd,imm8 ldr disp16,rs pop @@rd,@@rs
7098 ldb @@rd,rbs ldr rd,disp16 pop addr(rd),@@rs
7099 ldb addr(rd),imm8 ldrb disp16,rbs pop addr,@@rs
7100 ldb addr(rd),rbs ldrb rbd,disp16 pop rd,@@rs
7101 ldb addr,imm8 ldrl disp16,rrs popl @@rd,@@rs
7102 ldb addr,rbs ldrl rrd,disp16 popl addr(rd),@@rs
7103 ldb rbd,@@rs mbit popl addr,@@rs
7104 ldb rbd,addr mreq rd popl rrd,@@rs
7105 ldb rbd,addr(rs) mres push @@rd,@@rs
7106 ldb rbd,imm8 mset push @@rd,addr
7107 ldb rbd,rbs mult rrd,@@rs push @@rd,addr(rs)
7108 ldb rbd,rs(imm16) mult rrd,addr push @@rd,imm16
7109 push @@rd,rs set addr,imm4 subl rrd,imm32
7110 pushl @@rd,@@rs set rd,imm4 subl rrd,rrs
7111 pushl @@rd,addr set rd,rs tcc cc,rd
7112 pushl @@rd,addr(rs) setb @@rd,imm4 tccb cc,rbd
7113 pushl @@rd,rrs setb addr(rd),imm4 test @@rd
7114 res @@rd,imm4 setb addr,imm4 test addr
7115 res addr(rd),imm4 setb rbd,imm4 test addr(rd)
7116 res addr,imm4 setb rbd,rs test rd
7117 res rd,imm4 setflg imm4 testb @@rd
7118 res rd,rs sinb rbd,imm16 testb addr
7119 resb @@rd,imm4 sinb rd,imm16 testb addr(rd)
7120 resb addr(rd),imm4 sind @@rd,@@rs,ra testb rbd
7121 resb addr,imm4 sindb @@rd,@@rs,rba testl @@rd
7122 resb rbd,imm4 sinib @@rd,@@rs,ra testl addr
7123 resb rbd,rs sinibr @@rd,@@rs,ra testl addr(rd)
7124 resflg imm4 sla rd,imm8 testl rrd
7125 ret cc slab rbd,imm8 trdb @@rd,@@rs,rba
7126 rl rd,imm1or2 slal rrd,imm8 trdrb @@rd,@@rs,rba
7127 rlb rbd,imm1or2 sll rd,imm8 trib @@rd,@@rs,rbr
7128 rlc rd,imm1or2 sllb rbd,imm8 trirb @@rd,@@rs,rbr
7129 rlcb rbd,imm1or2 slll rrd,imm8 trtdrb @@ra,@@rb,rbr
7130 rldb rbb,rba sout imm16,rs trtib @@ra,@@rb,rr
7131 rr rd,imm1or2 soutb imm16,rbs trtirb @@ra,@@rb,rbr
7132 rrb rbd,imm1or2 soutd @@rd,@@rs,ra trtrb @@ra,@@rb,rbr
7133 rrc rd,imm1or2 soutdb @@rd,@@rs,rba tset @@rd
7134 rrcb rbd,imm1or2 soutib @@rd,@@rs,ra tset addr
7135 rrdb rbb,rba soutibr @@rd,@@rs,ra tset addr(rd)
7136 rsvd36 sra rd,imm8 tset rd
7137 rsvd38 srab rbd,imm8 tsetb @@rd
7138 rsvd78 sral rrd,imm8 tsetb addr
7139 rsvd7e srl rd,imm8 tsetb addr(rd)
7140 rsvd9d srlb rbd,imm8 tsetb rbd
7141 rsvd9f srll rrd,imm8 xor rd,@@rs
7142 rsvdb9 sub rd,@@rs xor rd,addr
7143 rsvdbf sub rd,addr xor rd,addr(rs)
7144 sbc rd,rs sub rd,addr(rs) xor rd,imm16
7145 sbcb rbd,rbs sub rd,imm16 xor rd,rs
7146 sc imm8 sub rd,rs xorb rbd,@@rs
7147 sda rd,rs subb rbd,@@rs xorb rbd,addr
7148 sdab rbd,rs subb rbd,addr xorb rbd,addr(rs)
7149 sdal rrd,rs subb rbd,addr(rs) xorb rbd,imm8
7150 sdl rd,rs subb rbd,imm8 xorb rbd,rbs
7151 sdlb rbd,rs subb rbd,rbs xorb rbd,rbs
7152 sdll rrd,rs subl rrd,@@rs
7153 set @@rd,imm4 subl rrd,addr
7154 set addr(rd),imm4 subl rrd,addr(rs)
7155 @end smallexample
7156 @iftex
7157 @endgroup
7158 @end iftex
7159 @end ifset
7160
7161 @end ifset
7162
7163 @ifset MIPS
7164 @ifset GENERIC
7165 @page
7166 @node MIPS-Dependent
7167 @chapter MIPS Dependent Features
7168 @end ifset
7169 @ifclear GENERIC
7170 @node Machine Dependencies
7171 @chapter MIPS Dependent Features
7172 @end ifclear
7173
7174 @cindex MIPS R2000
7175 @cindex MIPS R3000
7176 @cindex MIPS R4000
7177 @cindex MIPS R6000
7178 @sc{gnu} @code{@value{AS}} for @sc{mips} architectures supports the @sc{mips}
7179 @sc{r2000}, @sc{r3000}, @sc{r4000} and @sc{r6000} processors. For information
7180 about the @sc{mips} instruction set, see @cite{MIPS RISC Architecture}, by Kane
7181 and Heindrich (Prentice-Hall). For an overview of @sc{mips} assembly
7182 conventions, see ``Appendix D: Assembly Language Programming'' in the same
7183 work.
7184
7185 @menu
7186 * MIPS Opts:: Assembler options
7187 * MIPS Object:: ECOFF object code
7188 * MIPS Stabs:: Directives for debugging information
7189 * MIPS ISA:: Directives to override the ISA level
7190 @end menu
7191
7192 @node MIPS Opts
7193 @section Assembler options
7194
7195 The @sc{mips} configurations of @sc{gnu} @code{@value{AS}} support these
7196 special options:
7197
7198 @table @code
7199 @cindex @code{-G} option (MIPS)
7200 @item -G @var{num}
7201 This option sets the largest size of an object that can be referenced
7202 implicitly with the @code{gp} register. It is only accepted for targets
7203 that use @sc{ecoff} format. The default value is 8.
7204
7205 @cindex @code{-EB} option (MIPS)
7206 @cindex @code{-EL} option (MIPS)
7207 @cindex MIPS big-endian output
7208 @cindex MIPS little-endian output
7209 @cindex big-endian output, MIPS
7210 @cindex little-endian output, MIPS
7211 @item -EB
7212 @itemx -EL
7213 Any @sc{mips} configuration of @code{@value{AS}} can select big-endian or
7214 little-endian output at run time (unlike the other @sc{gnu} development
7215 tools, which must be configured for one or the other). Use @samp{-EB}
7216 to select big-endian output, and @samp{-EL} for little-endian.
7217
7218 @cindex MIPS architecture options
7219 @item -mips1
7220 @itemx -mips2
7221 @itemx -mips3
7222 Generate code for a particular MIPS Instruction Set Architecture level.
7223 @samp{-mips1} corresponds to the @sc{r2000} and @sc{r3000} processors,
7224 @samp{-mips2} to the @sc{r6000} processor, and @samp{-mips3} to the @sc{r4000}
7225 processor. You can also switch instruction sets during the assembly; see
7226 @ref{MIPS ISA,, Directives to override the ISA level}.
7227
7228 @item -m4650
7229 @item -no-m4650
7230 Generate code for the MIPS @sc{r4650} chip. This tells the assembler to accept
7231 the @samp{mad} and @samp{madu} instruction, and to not schedule @samp{nop}
7232 instructions around accesses to the @samp{HI} and @samp{LO} registers.
7233 @samp{-no-m4650} turns off this option.
7234
7235 @item -mcpu=@var{CPU}
7236 Generate code for a particular MIPS cpu. This has little effect on the
7237 assembler, but it is passed by @code{@value{GCC}}.
7238
7239 @cindex @code{-nocpp} ignored (MIPS)
7240 @item -nocpp
7241 This option is ignored. It is accepted for command-line compatibility with
7242 other assemblers, which use it to turn off C style preprocessing. With
7243 @sc{gnu} @code{@value{AS}}, there is no need for @samp{-nocpp}, because the
7244 @sc{gnu} assembler itself never runs the C preprocessor.
7245
7246 @item --trap
7247 @itemx --no-break
7248 @c FIXME! (1) reflect these options (next item too) in option summaries;
7249 @c (2) stop teasing, say _which_ instructions expanded _how_.
7250 @code{@value{AS}} automatically macro expands certain division and
7251 multiplication instructions to check for overflow and division by zero. This
7252 option causes @code{@value{AS}} to generate code to take a trap exception
7253 rather than a break exception when an error is detected. The trap instructions
7254 are only supported at Instruction Set Architecture level 2 and higher.
7255
7256 @item --break
7257 @itemx --no-trap
7258 Generate code to take a break exception rather than a trap exception when an
7259 error is detected. This is the default.
7260 @end table
7261
7262 @node MIPS Object
7263 @section MIPS ECOFF object code
7264
7265 @cindex ECOFF sections
7266 @cindex MIPS ECOFF sections
7267 Assembling for a @sc{mips} @sc{ecoff} target supports some additional sections
7268 besides the usual @code{.text}, @code{.data} and @code{.bss}. The
7269 additional sections are @code{.rdata}, used for read-only data,
7270 @code{.sdata}, used for small data, and @code{.sbss}, used for small
7271 common objects.
7272
7273 @cindex small objects, MIPS ECOFF
7274 @cindex @code{gp} register, MIPS
7275 When assembling for @sc{ecoff}, the assembler uses the @code{$gp} (@code{$28})
7276 register to form the address of a ``small object''. Any object in the
7277 @code{.sdata} or @code{.sbss} sections is considered ``small'' in this sense.
7278 For external objects, or for objects in the @code{.bss} section, you can use
7279 the @code{@value{GCC}} @samp{-G} option to control the size of objects addressed via
7280 @code{$gp}; the default value is 8, meaning that a reference to any object
7281 eight bytes or smaller uses @code{$gp}. Passing @samp{-G 0} to
7282 @code{@value{AS}} prevents it from using the @code{$gp} register on the basis
7283 of object size (but the assembler uses @code{$gp} for objects in @code{.sdata}
7284 or @code{sbss} in any case). The size of an object in the @code{.bss} section
7285 is set by the @code{.comm} or @code{.lcomm} directive that defines it. The
7286 size of an external object may be set with the @code{.extern} directive. For
7287 example, @samp{.extern sym,4} declares that the object at @code{sym} is 4 bytes
7288 in length, whie leaving @code{sym} otherwise undefined.
7289
7290 Using small @sc{ecoff} objects requires linker support, and assumes that the
7291 @code{$gp} register is correctly initialized (normally done automatically by
7292 the startup code). @sc{mips} @sc{ecoff} assembly code must not modify the
7293 @code{$gp} register.
7294
7295 @node MIPS Stabs
7296 @section Directives for debugging information
7297
7298 @cindex MIPS debugging directives
7299 @sc{mips} @sc{ecoff} @code{@value{AS}} supports several directives used for
7300 generating debugging information which are not support by traditional @sc{mips}
7301 assemblers. These are @code{.def}, @code{.endef}, @code{.dim}, @code{.file},
7302 @code{.scl}, @code{.size}, @code{.tag}, @code{.type}, @code{.val},
7303 @code{.stabd}, @code{.stabn}, and @code{.stabs}. The debugging information
7304 generated by the three @code{.stab} directives can only be read by @sc{gdb},
7305 not by traditional @sc{mips} debuggers (this enhancement is required to fully
7306 support C++ debugging). These directives are primarily used by compilers, not
7307 assembly language programmers!
7308
7309 @node MIPS ISA
7310 @section Directives to override the ISA level
7311
7312 @cindex MIPS ISA override
7313 @kindex @code{.set mips@var{n}}
7314 @sc{gnu} @code{@value{AS}} supports an additional directive to change the
7315 @sc{mips} Instruction Set Architecture level on the fly: @code{.set
7316 mips@var{n}}. @var{n} should be a number from 0 to 3. A value from 1 to 3
7317 makes the assembler accept instructions for the corresponding @sc{isa} level,
7318 from that point on in the assembly. @code{.set mips@var{n}} affects not only
7319 which instructions are permitted, but also how certain macros are expanded.
7320 @code{.set mips0} restores the @sc{isa} level to its original level: either the
7321 level you selected with command line options, or the default for your
7322 configuration. You can use this feature to permit specific @sc{r4000}
7323 instructions while assembling in 32 bit mode. Use this directive with care!
7324
7325 Traditional @sc{mips} assemblers do not support this directive.
7326 @end ifset
7327
7328 @ifset GENERIC
7329 @c reverse effect of @down at top of generic Machine-Dep chapter
7330 @raisesections
7331 @end ifset
7332
7333 @node Acknowledgements
7334 @chapter Acknowledgements
7335
7336 If you have contributed to @code{@value{AS}} and your name isn't listed here,
7337 it is not meant as a slight. We just don't know about it. Send mail to the
7338 maintainer, and we'll correct the situation. Currently (January 1994), the
7339 maintainer is Ken Raeburn (email address @code{raeburn@@cygnus.com}).
7340
7341 Dean Elsner wrote the original @sc{gnu} assembler for the VAX.@footnote{Any more
7342 details?}
7343
7344 Jay Fenlason maintained GAS for a while, adding support for GDB-specific debug
7345 information and the 68k series machines, most of the preprocessing pass, and
7346 extensive changes in @file{messages.c}, @file{input-file.c}, @file{write.c}.
7347
7348 K. Richard Pixley maintained GAS for a while, adding various enhancements and
7349 many bug fixes, including merging support for several processors, breaking GAS
7350 up to handle multiple object file format back ends (including heavy rewrite,
7351 testing, an integration of the coff and b.out back ends), adding configuration
7352 including heavy testing and verification of cross assemblers and file splits
7353 and renaming, converted GAS to strictly ANSI C including full prototypes, added
7354 support for m680[34]0 and cpu32, did considerable work on i960 including a COFF
7355 port (including considerable amounts of reverse engineering), a SPARC opcode
7356 file rewrite, DECstation, rs6000, and hp300hpux host ports, updated ``know''
7357 assertions and made them work, much other reorganization, cleanup, and lint.
7358
7359 Ken Raeburn wrote the high-level BFD interface code to replace most of the code
7360 in format-specific I/O modules.
7361
7362 The original VMS support was contributed by David L. Kashtan. Eric Youngdale
7363 has done much work with it since.
7364
7365 The Intel 80386 machine description was written by Eliot Dresselhaus.
7366
7367 Minh Tran-Le at IntelliCorp contributed some AIX 386 support.
7368
7369 The Motorola 88k machine description was contributed by Devon Bowen of Buffalo
7370 University and Torbjorn Granlund of the Swedish Institute of Computer Science.
7371
7372 Keith Knowles at the Open Software Foundation wrote the original MIPS back end
7373 (@file{tc-mips.c}, @file{tc-mips.h}), and contributed Rose format support
7374 (which hasn't been merged in yet). Ralph Campbell worked with the MIPS code to
7375 support a.out format.
7376
7377 Support for the Zilog Z8k and Hitachi H8/300 and H8/500 processors (tc-z8k,
7378 tc-h8300, tc-h8500), and IEEE 695 object file format (obj-ieee), was written by
7379 Steve Chamberlain of Cygnus Support. Steve also modified the COFF back end to
7380 use BFD for some low-level operations, for use with the H8/300 and AMD 29k
7381 targets.
7382
7383 John Gilmore built the AMD 29000 support, added @code{.include} support, and
7384 simplified the configuration of which versions accept which directives. He
7385 updated the 68k machine description so that Motorola's opcodes always produced
7386 fixed-size instructions (e.g. @code{jsr}), while synthetic instructions
7387 remained shrinkable (@code{jbsr}). John fixed many bugs, including true tested
7388 cross-compilation support, and one bug in relaxation that took a week and
7389 required the proverbial one-bit fix.
7390
7391 Ian Lance Taylor of Cygnus Support merged the Motorola and MIT syntax for the
7392 68k, completed support for some COFF targets (68k, i386 SVR3, and SCO Unix),
7393 added support for MIPS ECOFF and ELF targets, and made a few other minor
7394 patches.
7395
7396 Steve Chamberlain made @code{@value{AS}} able to generate listings.
7397
7398 Hewlett-Packard contributed support for the HP9000/300.
7399
7400 Jeff Law wrote GAS and BFD support for the native HPPA object format (SOM)
7401 along with a fairly extensive HPPA testsuite (for both SOM and ELF object
7402 formats). This work was supported by both the Center for Software Science at
7403 the University of Utah and Cygnus Support.
7404
7405 Support for ELF format files has been worked on by Mark Eichin of Cygnus
7406 Support (original, incomplete implementation for SPARC), Pete Hoogenboom and
7407 Jeff Law at the University of Utah (HPPA mainly), Michael Meissner of the Open
7408 Software Foundation (i386 mainly), and Ken Raeburn of Cygnus Support (sparc,
7409 and some initial 64-bit support).
7410
7411 Several engineers at Cygnus Support have also provided many small bug fixes and
7412 configuration enhancements.
7413
7414 Many others have contributed large or small bugfixes and enhancements. If
7415 you have contributed significant work and are not mentioned on this list, and
7416 want to be, let us know. Some of the history has been lost; we are not
7417 intentionally leaving anyone out.
7418
7419 @node Index
7420 @unnumbered Index
7421
7422 @printindex cp
7423
7424 @contents
7425 @bye
7426 @c Local Variables:
7427 @c fill-column: 79
7428 @c End: