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