z8000 documentation
[deliverable/binutils-gdb.git] / gas / doc / as-all.texinfo
1 \input texinfo @c -*-Texinfo-*-
2 @c Copyright (c) 1991 1992 Free Software Foundation, Inc.
3 @c %**start of header
4 @setfilename as.info
5 @settitle Using as
6 @setchapternewpage odd
7 @c @smallbook
8 @c @cropmarks
9 @c %**end of header
10
11 @ifinfo
12 @format
13 START-INFO-DIR-ENTRY
14 * As: (as). The GNU assembler.
15 END-INFO-DIR-ENTRY
16 @end format
17 @end ifinfo
18
19 @finalout
20 @syncodeindex ky cp
21
22 @c
23 @ifinfo
24 This file documents the GNU Assembler "as".
25
26 Copyright (C) 1991 Free Software Foundation, Inc.
27
28 Permission is granted to make and distribute verbatim copies of
29 this manual provided the copyright notice and this permission notice
30 are preserved on all copies.
31
32 @ignore
33 Permission is granted to process this file through Tex and print the
34 results, provided the printed document carries copying permission
35 notice identical to this one except for the removal of this paragraph
36 (this paragraph not being relevant to the printed manual).
37
38 @end ignore
39 Permission is granted to copy and distribute modified versions of this
40 manual under the conditions for verbatim copying, provided also that the
41 section entitled ``GNU General Public License'' is included exactly as
42 in the original, and provided that the entire resulting derived work is
43 distributed under the terms of a permission notice identical to this
44 one.
45
46 Permission is granted to copy and distribute translations of this manual
47 into another language, under the above conditions for modified versions,
48 except that the section entitled ``GNU General Public License'' may be
49 included in a translation approved by the Free Software Foundation
50 instead of in the original English.
51 @end ifinfo
52
53 @titlepage
54 @title Using as
55 @subtitle The GNU Assembler
56 @sp 1
57 @subtitle January 1992
58 @sp 1
59 @sp 13
60 The Free Software Foundation Inc. thanks The Nice Computer
61 Company of Australia for loaning Dean Elsner to write the
62 first (Vax) version of @code{as} for Project GNU.
63 The proprietors, management and staff of TNCCA thank FSF for
64 distracting the boss while they got some work
65 done.
66 @sp 3
67 @author Dean Elsner, Jay Fenlason & friends
68 @c edited by: pesch@cygnus.com
69 @page
70 @tex
71 \def\$#1${{#1}} % Kluge: collect RCS revision info without $...$
72 \xdef\manvers{\$Revision$} % For use in headers, footers too
73 {\parskip=0pt
74 \hfill {\it Using {\tt as}} \manvers\par
75 \hfill \TeX{}info \texinfoversion\par
76 \hfill Edited by Roland Pesch for Cygnus Support\par
77 }
78 %"boxit" macro for figures:
79 %Modified from Knuth's ``boxit'' macro from TeXbook (answer to exercise 21.3)
80 \gdef\boxit#1#2{\vbox{\hrule\hbox{\vrule\kern3pt
81 \vbox{\parindent=0pt\parskip=0pt\hsize=#1\kern3pt\strut\hfil
82 #2\hfil\strut\kern3pt}\kern3pt\vrule}\hrule}}%box with visible outline
83 \gdef\ibox#1#2{\hbox to #1{#2\hfil}\kern8pt}% invisible box
84 @end tex
85
86 @vskip 0pt plus 1filll
87 Copyright @copyright{} 1991 Free Software Foundation, Inc.
88
89 Permission is granted to make and distribute verbatim copies of
90 this manual provided the copyright notice and this permission notice
91 are preserved on all copies.
92
93 Permission is granted to copy and distribute modified versions of this
94 manual under the conditions for verbatim copying, provided also that the
95 section entitled ``GNU General Public License'' is included exactly as
96 in the original, and provided that the entire resulting derived work is
97 distributed under the terms of a permission notice identical to this
98 one.
99
100 Permission is granted to copy and distribute translations of this manual
101 into another language, under the above conditions for modified versions,
102 except that the section entitled ``GNU General Public License'' may be
103 included in a translation approved by the Free Software Foundation
104 instead of in the original English.
105 @end titlepage
106 @page
107 @ifinfo
108 @node Top
109 @top Using as
110
111 This file is a user guide to the GNU assembler @code{as}.
112 @menu
113 * Overview:: Overview
114 * Invoking:: Command-Line Options
115 * Syntax:: Syntax
116 * Sections:: Sections and Relocation
117 * Symbols:: Symbols
118 * Expressions:: Expressions
119 * Pseudo Ops:: Assembler Directives
120 * Machine Dependent:: Machine Dependent Features
121 * Copying:: GNU GENERAL PUBLIC LICENSE
122 * Index:: Index
123 @end menu
124 @end ifinfo
125
126 @node Overview
127 @chapter Overview
128 @iftex
129 This manual is a user guide to the GNU assembler @code{as}.
130 @end iftex
131
132 @cindex invocation summary
133 @cindex option summary
134 @cindex summary of options
135 Here is a brief summary of how to invoke @code{as}. For details,
136 @pxref{Invoking,,Comand-Line Options}.
137
138 @c We don't use deffn and friends for the following because they seem
139 @c to be limited to one line for the header.
140 @smallexample
141 as [ -a | -al | -as ] [ -D ] [ -f ]
142 [ -I @var{path} ] [ -K ] [ -L ]
143 [ -o @var{objfile} ] [ -R ] [ -v ] [ -w ]
144 @c am29k has no machine-dependent assembler options
145 @c h8/300 has no machine-dependent assembler options
146 @c Z8000 has no machine-dependent assembler options
147 @c see md_parse_option in i960.c
148 [ -ACA | -ACA_A | -ACB | -ACC | -AKA | -AKB | -AKC | -AMC ]
149 [ -b ] [ -norelax ]
150 [ -l ] [ -mc68000 | -mc68010 | -mc68020 ]
151 [ -- | @var{files} @dots{} ]
152 @end smallexample
153
154 @table @code
155 @item -a | -al | -as
156 Turn on assembly listings; @samp{-al}, listing only, @samp{-as}, symbols
157 only, @samp{-a}, everything.
158
159 @item -D
160 This option is accepted only for script compatibility with calls to
161 other assemblers; it has no effect on @code{as}.
162
163 @item -f
164 ``fast''---skip preprocessing (assume source is compiler output)
165
166 @item -I @var{path}
167 Add @var{path} to the search list for @code{.include} directives
168
169 @item -K
170 Issue warnings when difference tables altered for long displacements.
171
172 @item -L
173 Keep (in symbol table) local symbols, starting with @samp{L}
174
175 @item -o @var{objfile}
176 Name the object-file output from @code{as}
177
178 @item -R
179 Fold data section into text section
180
181 @item -v
182 Announce @code{as} version
183
184 @item -W
185 Suppress warning messages
186
187 @item -ACA | -ACA_A | -ACB | -ACC | -AKA | -AKB | -AKC | -AMC
188 (When configured for Intel 960).
189 Specify which variant of the 960 architecture is the target.
190
191 @item -b
192 (When configured for Intel 960).
193 Add code to collect statistics about branches taken.
194
195 @item -norelax
196 (When configured for Intel 960).
197 Do not alter compare-and-branch instructions for long displacements;
198 error if necessary.
199
200 @item -l
201 (When configured for Motorola 68000).
202 Shorten references to undefined symbols, to one word instead of two
203
204 @item -mc68000 | -mc68010 | -mc68020
205 (When configured for Motorola 68000).
206 Specify what processor in the 68000 family is the target (default 68020)
207
208 @item -- | @var{files} @dots{}
209 Standard input, or source files to assemble
210 @end table
211
212 @menu
213 * Manual:: Structure of this Manual
214 * GNU Assembler:: as, the GNU Assembler
215 * Object Formats:: Object File Formats
216 * Command Line:: Command Line
217 * Input Files:: Input Files
218 * Object:: Output (Object) File
219 * Errors:: Error and Warning Messages
220 @end menu
221
222 @node Manual
223 @section Structure of this Manual
224
225 @cindex manual, structure and purpose
226 This manual is intended to describe what you need to know to use
227 @sc{gnu} @code{as}. We cover the syntax expected in source files, including
228 notation for symbols, constants, and expressions; the directives that
229 @code{as} understands; and of course how to invoke @code{as}.
230
231 This manual also describes some of the machine-dependent features of
232 various flavors of the assembler.
233 @refill
234
235 @cindex machine instructions (not covered)
236 On the other hand, this manual is @emph{not} intended as an introduction
237 to programming in assembly language---let alone programming in general!
238 In a similar vein, we make no attempt to introduce the machine
239 architecture; we do @emph{not} describe the instruction set, standard
240 mnemonics, registers or addressing modes that are standard to a
241 particular architecture.
242 You may want to consult the manufacturer's
243 machine architecture manual for this information.
244
245
246 @c I think this is premature---pesch@cygnus.com, 17jan1991
247 @ignore
248 Throughout this manual, we assume that you are running @dfn{GNU},
249 the portable operating system from the @dfn{Free Software
250 Foundation, Inc.}. This restricts our attention to certain kinds of
251 computer (in particular, the kinds of computers that GNU can run on);
252 once this assumption is granted examples and definitions need less
253 qualification.
254
255 @code{as} is part of a team of programs that turn a high-level
256 human-readable series of instructions into a low-level
257 computer-readable series of instructions. Different versions of
258 @code{as} are used for different kinds of computer.
259 @end ignore
260
261 @c There used to be a section "Terminology" here, which defined
262 @c "contents", "byte", "word", and "long". Defining "word" to any
263 @c particular size is confusing when the .word directive may generate 16
264 @c bits on one machine and 32 bits on another; in general, for the user
265 @c version of this manual, none of these terms seem essential to define.
266 @c They were used very little even in the former draft of the manual;
267 @c this draft makes an effort to avoid them (except in names of
268 @c directives).
269
270 @node GNU Assembler
271 @section as, the GNU Assembler
272
273 GNU @code{as} is really a family of assemblers.
274 If you use (or have used) the GNU assembler on one architecture, you
275 should find a fairly similar environment when you use it on another
276 architecture. Each version has much in common with the others,
277 including object file formats, most assembler directives (often called
278 @dfn{pseudo-ops)} and assembler syntax.@refill
279
280 @cindex purpose of @sc{gnu} @code{as}
281 @code{as} is primarily intended to assemble the output of the GNU C
282 compiler @code{gcc} for use by the linker @code{ld}. Nevertheless,
283 we've tried to make @code{as} assemble correctly everything that the native
284 assembler would.
285 Any exceptions are documented explicitly (@pxref{Machine Dependent}).
286 This doesn't mean @code{as} always uses the same syntax as another
287 assembler for the same architecture; for example, we know of several
288 incompatible versions of 680x0 assembly language syntax.
289
290 Unlike older assemblers, @code{as} is designed to assemble a source
291 program in one pass of the source file. This has a subtle impact on the
292 @kbd{.org} directive (@pxref{Org,,@code{.org}}).
293
294 @node Object Formats
295 @section Object File Formats
296
297 @cindex object file format
298 The GNU assembler can be configured to produce several alternative
299 object file formats. For the most part, this does not affect how you
300 write assembly language programs; but directives for debugging symbols
301 are typically different in different file formats. @xref{Symbol
302 Attributes,,Symbol Attributes}.
303
304 @node Command Line
305 @section Command Line
306
307 @cindex command line conventions
308 After the program name @code{as}, the command line may contain
309 options and file names. Options may appear in any order, and may be
310 before, after, or between file names. The order of file names is
311 significant.
312
313 @cindex standard input, as input file
314 @kindex --
315 @file{--} (two hyphens) by itself names the standard input file
316 explicitly, as one of the files for @code{as} to assemble.
317
318 @cindex options, command line
319 Except for @samp{--} any command line argument that begins with a
320 hyphen (@samp{-}) is an option. Each option changes the behavior of
321 @code{as}. No option changes the way another option works. An
322 option is a @samp{-} followed by one or more letters; the case of
323 the letter is important. All options are optional.
324
325 Some options expect exactly one file name to follow them. The file
326 name may either immediately follow the option's letter (compatible
327 with older assemblers) or it may be the next command argument (GNU
328 standard). These two command lines are equivalent:
329
330 @smallexample
331 as -o my-object-file.o mumble.s
332 as -omy-object-file.o mumble.s
333 @end smallexample
334
335 @node Input Files
336 @section Input Files
337
338 @cindex input
339 @cindex source program
340 @cindex files, input
341 We use the phrase @dfn{source program}, abbreviated @dfn{source}, to
342 describe the program input to one run of @code{as}. The program may
343 be in one or more files; how the source is partitioned into files
344 doesn't change the meaning of the source.
345
346 @c I added "con" prefix to "catenation" just to prove I can overcome my
347 @c APL training... pesch@cygnus.com
348 The source program is a concatenation of the text in all the files, in the
349 order specified.
350
351 Each time you run @code{as} it assembles exactly one source
352 program. The source program is made up of one or more files.
353 (The standard input is also a file.)
354
355 You give @code{as} a command line that has zero or more input file
356 names. The input files are read (from left file name to right). A
357 command line argument (in any position) that has no special meaning
358 is taken to be an input file name.
359
360 If you give @code{as} no file names it attempts to read one input file
361 from the @code{as} standard input, which is normally your terminal. You
362 may have to type @key{ctl-D} to tell @code{as} there is no more program
363 to assemble.
364
365 Use @samp{--} if you need to explicitly name the standard input file
366 in your command line.
367
368 If the source is empty, @code{as} will produce a small, empty object
369 file.
370
371 @subheading Filenames and Line-numbers
372
373 @cindex input file linenumbers
374 @cindex line numbers, in input files
375 There are two ways of locating a line in the input file (or files) and
376 either may be used in reporting error messages. One way refers to a line
377 number in a physical file; the other refers to a line number in a
378 ``logical'' file. @xref{Errors, ,Error and Warning Messages}.
379
380 @dfn{Physical files} are those files named in the command line given
381 to @code{as}.
382
383 @dfn{Logical files} are simply names declared explicitly by assembler
384 directives; they bear no relation to physical files. Logical file names
385 help error messages reflect the original source file, when @code{as}
386 source is itself synthesized from other files.
387 @xref{App-File,,@code{.app-file}}.
388
389 @node Object
390 @section Output (Object) File
391
392 @cindex object file
393 @cindex output file
394 @kindex a.out
395 @kindex .o
396 Every time you run @code{as} it produces an output file, which is
397 your assembly language program translated into numbers. This file
398 is the object file, named @code{a.out} unless you tell @code{as} to
399 give it another name by using the @code{-o} option. Conventionally,
400 object file names end with @file{.o}. The default name of
401 @file{a.out} is used for historical reasons: older assemblers were
402 capable of assembling self-contained programs directly into a
403 runnable program.
404 @c This may still work, but hasn't been tested.
405
406 @cindex linker
407 @kindex ld
408 The object file is meant for input to the linker @code{ld}. It contains
409 assembled program code, information to help @code{ld} integrate
410 the assembled program into a runnable file, and (optionally) symbolic
411 information for the debugger.
412
413 @c link above to some info file(s) like the description of a.out.
414 @c don't forget to describe GNU info as well as Unix lossage.
415
416 @node Errors
417 @section Error and Warning Messages
418
419 @cindex error messsages
420 @cindex warning messages
421 @cindex messages from @code{as}
422 @code{as} may write warnings and error messages to the standard error
423 file (usually your terminal). This should not happen when a compiler
424 runs @code{as} automatically. Warnings report an assumption made so
425 that @code{as} could keep assembling a flawed program; errors report a
426 grave problem that stops the assembly.
427
428 @cindex format of warning messages
429 Warning messages have the format
430
431 @smallexample
432 file_name:@b{NNN}:Warning Message Text
433 @end smallexample
434
435 @noindent
436 @cindex line numbers, in warnings/errors
437 (where @b{NNN} is a line number). If a logical file name has
438 been given (@pxref{App-File,,@code{.app-file}}) it is used for the filename, otherwise the
439 name of the current input file is used. If a logical line number was
440 given
441 (@pxref{Ln,,@code{.ln}})
442 then it is used to calculate the number printed,
443 otherwise the actual line in the current source file is printed. The
444 message text is intended to be self explanatory (in the grand Unix
445 tradition). @refill
446
447 @cindex format of error messages
448 Error messages have the format
449 @smallexample
450 file_name:@b{NNN}:FATAL:Error Message Text
451 @end smallexample
452 The file name and line number are derived as for warning
453 messages. The actual message text may be rather less explanatory
454 because many of them aren't supposed to happen.
455
456 @node Invoking
457 @chapter Command-Line Options
458
459 @cindex options, all versions of @code{as}
460 This chapter describes command-line options available in @emph{all}
461 versions of the GNU assembler; @pxref{Machine Dependent}, for options specific
462 to particular machine architectures.
463
464 @section Enable Listings: @code{-a}, @code{-al}, @code{-as}
465
466 @kindex -a
467 @kindex -al
468 @kindex -as
469 @cindex listings, enabling
470 @cindex assembly listings, enabling
471 These options enable listing output from the assembler. @samp{-a} by
472 itself requests all listing output; @samp{-al} requests only the
473 output-program listing, and @samp{-as} requests only a symbol table
474 listing.
475
476 Once you have specified one of these options, you can further control
477 listing output and its appearance using the directives @code{.list},
478 @code{.nolist}, @code{.psize}, @code{.eject}, @code{.title}, and
479 @code{.sbttl}.
480
481 If you do not request listing output with one of the @samp{-a} options, the
482 listing-control directives have no effect.
483
484 @section @code{-D}
485
486 @kindex -D
487 This option has no effect whatsoever, but it is accepted to make it more
488 likely that scripts written for other assemblers will also work with
489 @code{as}.
490
491 @section Work Faster: @code{-f}
492
493 @kindex -f
494 @cindex trusted compiler
495 @cindex faster processing (@code{-f})
496 @samp{-f} should only be used when assembling programs written by a
497 (trusted) compiler. @samp{-f} stops the assembler from pre-processing
498 the input file(s) before assembling them. @xref{Pre-processing,
499 ,Pre-processing}.
500
501 @quotation
502 @emph{Warning:} if the files actually need to be pre-processed (if they
503 contain comments, for example), @code{as} will not work correctly if
504 @samp{-f} is used.
505 @end quotation
506
507 @section @code{.include} search path: @code{-I} @var{path}
508
509 @kindex -I @var{path}
510 @cindex paths for @code{.include}
511 @cindex search path for @code{.include}
512 @cindex @code{include} directive search path
513 Use this option to add a @var{path} to the list of directories
514 @code{as} will search for files specified in @code{.include}
515 directives (@pxref{Include,,@code{.include}}). You may use @code{-I} as
516 many times as necessary to include a variety of paths. The current
517 working directory is always searched first; after that, @code{as}
518 searches any @samp{-I} directories in the same order as they were
519 specified (left to right) on the command line.
520
521 @section Difference Tables: @code{-K}
522
523 @kindex -K
524
525 @cindex difference tables, warning
526 @cindex warning for altered difference tables
527 @code{as} sometimes alters the code emitted for directives of the form
528 @samp{.word @var{sym1}-@var{sym2}}; @pxref{Word,,@code{.word}}.
529 You can use the @samp{-K} option if you want a warning issued when this
530 is done.
531
532 @section Include Local Labels: @code{-L}
533
534 @kindex -L
535 @cindex local labels, retaining in output
536 Labels beginning with @samp{L} (upper case only) are called @dfn{local
537 labels}. @xref{Symbol Names}. Normally you don't see such labels when
538 debugging, because they are intended for the use of programs (like
539 compilers) that compose assembler programs, not for your notice.
540 Normally both @code{as} and @code{ld} discard such labels, so you don't
541 normally debug with them.
542
543 This option tells @code{as} to retain those @samp{L@dots{}} symbols
544 in the object file. Usually if you do this you also tell the linker
545 @code{ld} to preserve symbols whose names begin with @samp{L}.
546
547 @section Name the Object File: @code{-o}
548
549 @kindex -o
550 @cindex naming object file
551 @cindex object file name
552 There is always one object file output when you run @code{as}. By
553 default it has the name @file{a.out}. You use this option (which
554 takes exactly one filename) to give the object file a different name.
555
556 Whatever the object file is called, @code{as} will overwrite any
557 existing file of the same name.
558
559 @section Join Data and Text Sections: @code{-R}
560
561 @kindex -R
562 @cindex data and text sections, joining
563 @cindex text and data sections, joining
564 @cindex joining text and data sections
565 @cindex merging text and data sections
566 @code{-R} tells @code{as} to write the object file as if all
567 data-section data lives in the text section. This is only done at
568 the very last moment: your binary data are the same, but data
569 section parts are relocated differently. The data section part of
570 your object file is zero bytes long because all it bytes are
571 appended to the text section. (@xref{Sections,,Sections and Relocation}.)
572
573 When you specify @code{-R} it would be possible to generate shorter
574 address displacements (because we don't have to cross between text and
575 data section). We refrain from doing this simply for compatibility with
576 older versions of @code{as}. In future, @code{-R} may work this way.
577
578 When @code{as} is configured for COFF output,
579 this option is only useful if you use sections named @samp{.text} and
580 @samp{.data}.
581
582 @section Announce Version: @code{-v}
583
584 @kindex -v
585 @kindex -version
586 @cindex @code{as} version
587 @cindex version of @code{as}
588 You can find out what version of as is running by including the
589 option @samp{-v} (which you can also spell as @samp{-version}) on the
590 command line.
591
592 @section Suppress Warnings: @code{-W}
593
594 @kindex -W
595 @cindex suppressing warnings
596 @cindex warnings, suppressing
597 @code{as} should never give a warning or error message when
598 assembling compiler output. But programs written by people often
599 cause @code{as} to give a warning that a particular assumption was
600 made. All such warnings are directed to the standard error file.
601 If you use this option, no warnings are issued. This option only
602 affects the warning messages: it does not change any particular of how
603 @code{as} assembles your file. Errors, which stop the assembly, are
604 still reported.
605
606 @node Syntax
607 @chapter Syntax
608
609 @cindex machine-independent syntax
610 @cindex syntax, machine-independent
611 This chapter describes the machine-independent syntax allowed in a
612 source file. @code{as} syntax is similar to what many other assemblers
613 use; it is inspired in BSD 4.2
614 assembler, except that @code{as} does not assemble Vax bit-fields.
615
616 @menu
617 * Pre-processing:: Pre-processing
618 * Whitespace:: Whitespace
619 * Comments:: Comments
620 * Symbol Intro:: Symbols
621 * Statements:: Statements
622 * Constants:: Constants
623 @end menu
624
625 @node Pre-processing
626 @section Pre-Processing
627
628 @cindex preprocessing
629 The pre-processor:
630 @itemize @bullet
631 @cindex whitespace, removed by preprocessor
632 @item
633 adjusts and removes extra whitespace. It leaves one space or tab before
634 the keywords on a line, and turns any other whitespace on the line into
635 a single space.
636
637 @cindex comments, removed by preprocessor
638 @item
639 removes all comments, replacing them with a single space, or an
640 appropriate number of newlines.
641
642 @cindex constants, converted by preprocessor
643 @item
644 converts character constants into the appropriate numeric values.
645 @end itemize
646
647 Excess whitespace, comments, and character constants
648 cannot be used in the portions of the input text that are not
649 pre-processed.
650
651 @cindex turning preprocessing on and off
652 @cindex preprocessing, turning on and off
653 @kindex #NO_APP
654 @kindex #APP
655 If the first line of an input file is @code{#NO_APP} or the @samp{-f}
656 option is given, the input file will not be pre-processed. Within such
657 an input file, parts of the file can be pre-processed by putting a line
658 that says @code{#APP} before the text that should be pre-processed, and
659 putting a line that says @code{#NO_APP} after them. This feature is
660 mainly intend to support @code{asm} statements in compilers whose output
661 normally does not need to be pre-processed.
662
663 @node Whitespace
664 @section Whitespace
665
666 @cindex whitespace
667 @dfn{Whitespace} is one or more blanks or tabs, in any order.
668 Whitespace is used to separate symbols, and to make programs neater for
669 people to read. Unless within character constants
670 (@pxref{Characters,,Character Constants}), any whitespace means the same
671 as exactly one space.
672
673 @node Comments
674 @section Comments
675
676 @cindex comments
677 There are two ways of rendering comments to @code{as}. In both
678 cases the comment is equivalent to one space.
679
680 Anything from @samp{/*} through the next @samp{*/} is a comment.
681 This means you may not nest these comments.
682
683 @smallexample
684 /*
685 The only way to include a newline ('\n') in a comment
686 is to use this sort of comment.
687 */
688
689 /* This sort of comment does not nest. */
690 @end smallexample
691
692 @cindex line comment character
693 Anything from the @dfn{line comment} character to the next newline
694 is considered a comment and is ignored. The line comment character is
695 @samp{#} on the Vax;
696 @samp{#} on the i960;
697 @samp{|} on the 680x0;
698 @samp{;} for the AMD 29K family;
699 @samp{;} for the machine specific family;
700 @samp{!} for the Z8000.
701 @pxref{Machine Dependent}. @refill
702 @c FIXME: fill in SPARC line comment char
703
704 On some machines there are two different line comment characters. One
705 will only begin a comment if it is the first non-whitespace character on
706 a line, while the other will always begin a comment.
707
708 @kindex #
709 @cindex lines starting with @code{#}
710 @cindex logical line numbers
711 To be compatible with past assemblers, a special interpretation is
712 given to lines that begin with @samp{#}. Following the @samp{#} an
713 absolute expression (@pxref{Expressions}) is expected: this will be
714 the logical line number of the @b{next} line. Then a string
715 (@xref{Strings}.) is allowed: if present it is a new logical file
716 name. The rest of the line, if any, should be whitespace.
717
718 If the first non-whitespace characters on the line are not numeric,
719 the line is ignored. (Just like a comment.)
720 @smallexample
721 # This is an ordinary comment.
722 # 42-6 "new_file_name" # New logical file name
723 # This is logical line # 36.
724 @end smallexample
725 This feature is deprecated, and may disappear from future versions
726 of @code{as}.
727
728 @node Symbol Intro
729 @section Symbols
730
731 @cindex characters used in symbols
732 A @dfn{symbol} is one or more characters chosen from the set of all
733 letters (both upper and lower case), digits and
734 the two characters @samp{_.}
735 On most machines, you can also use @code{$} in symbol names; exceptions
736 are noted in @ref{Machine Dependent}.
737 No symbol may begin with a digit. Case is significant.
738 There is no length limit: all characters are significant. Symbols are
739 delimited by characters not in that set, or by the beginning of a file
740 (since the source program must end with a newline, the end of a file is
741 not a possible symbol delimiter). @xref{Symbols}.
742 @cindex length of symbols
743
744 @node Statements
745 @section Statements
746
747 @cindex statements, structure of
748 @cindex line separator character
749 @cindex statement separator character
750 A @dfn{statement} ends at a newline character (@samp{\n}) or line
751 separator character. (The line separator is usually @samp{;}, unless
752 this conflicts with the comment character; @pxref{Machine Dependent}.) The
753 newline or separator character is considered part of the preceding
754 statement. Newlines and separators within character constants are an
755 exception: they don't end statements.
756
757 @cindex newline, required at file end
758 @cindex EOF, newline must precede
759 It is an error to end any statement with end-of-file: the last
760 character of any input file should be a newline.@refill
761
762 @cindex continuing statements
763 @cindex multi-line statements
764 @cindex statement on multiple lines
765 You may write a statement on more than one line if you put a
766 backslash (@kbd{\}) immediately in front of any newlines within the
767 statement. When @code{as} reads a backslashed newline both
768 characters are ignored. You can even put backslashed newlines in
769 the middle of symbol names without changing the meaning of your
770 source program.
771
772 An empty statement is allowed, and may include whitespace. It is ignored.
773
774 @cindex instructions and directives
775 @cindex directives and instructions
776 @c "key symbol" is not used elsewhere in the document; seems pedantic to
777 @c @defn{} it in that case, as was done previously... pesch@cygnus.com,
778 @c 13feb91.
779 A statement begins with zero or more labels, optionally followed by a
780 key symbol which determines what kind of statement it is. The key
781 symbol determines the syntax of the rest of the statement. If the
782 symbol begins with a dot @samp{.} then the statement is an assembler
783 directive: typically valid for any computer. If the symbol begins with
784 a letter the statement is an assembly language @dfn{instruction}: it
785 will assemble into a machine language instruction.
786 Different versions of @code{as} for different computers will
787 recognize different instructions. In fact, the same symbol may
788 represent a different instruction in a different computer's assembly
789 language.@refill
790
791 @cindex @code{:} (label)
792 @cindex label (@code{:})
793 A label is a symbol immediately followed by a colon (@code{:}).
794 Whitespace before a label or after a colon is permitted, but you may not
795 have whitespace between a label's symbol and its colon. @xref{Labels}.
796
797 @smallexample
798 label: .directive followed by something
799 another_label: # This is an empty statement.
800 instruction operand_1, operand_2, @dots{}
801 @end smallexample
802
803 @node Constants
804 @section Constants
805
806 @cindex constants
807 A constant is a number, written so that its value is known by
808 inspection, without knowing any context. Like this:
809 @smallexample
810 .byte 74, 0112, 092, 0x4A, 0X4a, 'J, '\J # All the same value.
811 .ascii "Ring the bell\7" # A string constant.
812 .octa 0x123456789abcdef0123456789ABCDEF0 # A bignum.
813 .float 0f-314159265358979323846264338327\
814 95028841971.693993751E-40 # - pi, a flonum.
815 @end smallexample
816
817 @menu
818 * Characters:: Character Constants
819 * Numbers:: Number Constants
820 @end menu
821
822 @node Characters
823 @subsection Character Constants
824
825 @cindex character constants
826 @cindex constants, character
827 There are two kinds of character constants. A @dfn{character} stands
828 for one character in one byte and its value may be used in
829 numeric expressions. String constants (properly called string
830 @emph{literals}) are potentially many bytes and their values may not be
831 used in arithmetic expressions.
832
833 @menu
834 * Strings:: Strings
835 * Chars:: Characters
836 @end menu
837
838 @node Strings
839 @subsubsection Strings
840
841 @cindex string constants
842 @cindex constants, string
843 A @dfn{string} is written between double-quotes. It may contain
844 double-quotes or null characters. The way to get special characters
845 into a string is to @dfn{escape} these characters: precede them with
846 a backslash @samp{\} character. For example @samp{\\} represents
847 one backslash: the first @code{\} is an escape which tells
848 @code{as} to interpret the second character literally as a backslash
849 (which prevents @code{as} from recognizing the second @code{\} as an
850 escape character). The complete list of escapes follows.
851
852 @cindex escape codes, character
853 @cindex character escape codes
854 @table @kbd
855 @c @item \a
856 @c Mnemonic for ACKnowledge; for ASCII this is octal code 007.
857 @c
858 @item \b
859 @cindex @code{\b} (backspace character)
860 @cindex backspace (@code{\b})
861 Mnemonic for backspace; for ASCII this is octal code 010.
862
863 @c @item \e
864 @c Mnemonic for EOText; for ASCII this is octal code 004.
865 @c
866 @item \f
867 @cindex @code{\f} (formfeed character)
868 @cindex formfeed (@code{\f})
869 Mnemonic for FormFeed; for ASCII this is octal code 014.
870
871 @item \n
872 @cindex @code{\n} (newline character)
873 @cindex newline (@code{\n})
874 Mnemonic for newline; for ASCII this is octal code 012.
875
876 @c @item \p
877 @c Mnemonic for prefix; for ASCII this is octal code 033, usually known as @code{escape}.
878 @c
879 @item \r
880 @cindex @code{\r} (carriage return character)
881 @cindex carriage return (@code{\r})
882 Mnemonic for carriage-Return; for ASCII this is octal code 015.
883
884 @c @item \s
885 @c Mnemonic for space; for ASCII this is octal code 040. Included for compliance with
886 @c other assemblers.
887 @c
888 @item \t
889 @cindex @code{\t} (tab)
890 @cindex tab (@code{\t})
891 Mnemonic for horizontal Tab; for ASCII this is octal code 011.
892
893 @c @item \v
894 @c Mnemonic for Vertical tab; for ASCII this is octal code 013.
895 @c @item \x @var{digit} @var{digit} @var{digit}
896 @c A hexadecimal character code. The numeric code is 3 hexadecimal digits.
897 @c
898 @item \ @var{digit} @var{digit} @var{digit}
899 @cindex @code{\@var{ddd}} (octal character code)
900 @cindex octal character code (@code{\@var{ddd}})
901 An octal character code. The numeric code is 3 octal digits.
902 For compatibility with other Unix systems, 8 and 9 are accepted as digits:
903 for example, @code{\008} has the value 010, and @code{\009} the value 011.
904
905 @item \\
906 @cindex @code{\\} (@samp{\} character)
907 @cindex backslash (@code{\\})
908 Represents one @samp{\} character.
909
910 @c @item \'
911 @c Represents one @samp{'} (accent acute) character.
912 @c This is needed in single character literals
913 @c (@xref{Characters,,Character Constants}.) to represent
914 @c a @samp{'}.
915 @c
916 @item \"
917 @cindex @code{\"} (doublequote character)
918 @cindex doublequote (@code{\"})
919 Represents one @samp{"} character. Needed in strings to represent
920 this character, because an unescaped @samp{"} would end the string.
921
922 @item \ @var{anything-else}
923 Any other character when escaped by @kbd{\} will give a warning, but
924 assemble as if the @samp{\} was not present. The idea is that if
925 you used an escape sequence you clearly didn't want the literal
926 interpretation of the following character. However @code{as} has no
927 other interpretation, so @code{as} knows it is giving you the wrong
928 code and warns you of the fact.
929 @end table
930
931 Which characters are escapable, and what those escapes represent,
932 varies widely among assemblers. The current set is what we think
933 the BSD 4.2 assembler recognizes, and is a subset of what most C
934 compilers recognize. If you are in doubt, don't use an escape
935 sequence.
936
937 @node Chars
938 @subsubsection Characters
939
940 @cindex single character constant
941 @cindex character, single
942 @cindex constant, single character
943 A single character may be written as a single quote immediately
944 followed by that character. The same escapes apply to characters as
945 to strings. So if you want to write the character backslash, you
946 must write @kbd{'\\} where the first @code{\} escapes the second
947 @code{\}. As you can see, the quote is an acute accent, not a
948 grave accent. A newline
949 immediately following an acute accent is taken as a literal character
950 and does not count as the end of a statement. The value of a character
951 constant in a numeric expression is the machine's byte-wide code for
952 that character. @code{as} assumes your character code is ASCII:
953 @kbd{'A} means 65, @kbd{'B} means 66, and so on. @refill
954
955 @node Numbers
956 @subsection Number Constants
957
958 @cindex constants, number
959 @cindex number constants
960 @code{as} distinguishes three kinds of numbers according to how they
961 are stored in the target machine. @emph{Integers} are numbers that
962 would fit into an @code{int} in the C language. @emph{Bignums} are
963 integers, but they are stored in more than 32 bits. @emph{Flonums}
964 are floating point numbers, described below.
965
966 @menu
967 * Integers:: Integers
968 * Bignums:: Bignums
969 * Flonums:: Flonums
970 @end menu
971
972 @node Integers
973 @subsubsection Integers
974 @cindex integers
975 @cindex constants, integer
976
977 @cindex binary integers
978 @cindex integers, binary
979 A binary integer is @samp{0b} or @samp{0B} followed by zero or more of
980 the binary digits @samp{01}.
981
982 @cindex octal integers
983 @cindex integers, octal
984 An octal integer is @samp{0} followed by zero or more of the octal
985 digits (@samp{01234567}).
986
987 @cindex decimal integers
988 @cindex integers, decimal
989 A decimal integer starts with a non-zero digit followed by zero or
990 more digits (@samp{0123456789}).
991
992 @cindex hexadecimal integers
993 @cindex integers, hexadecimal
994 A hexadecimal integer is @samp{0x} or @samp{0X} followed by one or
995 more hexadecimal digits chosen from @samp{0123456789abcdefABCDEF}.
996
997 Integers have the usual values. To denote a negative integer, use
998 the prefix operator @samp{-} discussed under expressions
999 (@pxref{Prefix Ops,,Prefix Operators}).
1000
1001 @node Bignums
1002 @subsubsection Bignums
1003
1004 @cindex bignums
1005 @cindex constants, bignum
1006 A @dfn{bignum} has the same syntax and semantics as an integer
1007 except that the number (or its negative) takes more than 32 bits to
1008 represent in binary. The distinction is made because in some places
1009 integers are permitted while bignums are not.
1010
1011 @node Flonums
1012 @subsubsection Flonums
1013 @cindex flonums
1014 @cindex floating point numbers
1015 @cindex constants, floating point
1016
1017 @cindex precision, floating point
1018 A @dfn{flonum} represents a floating point number. The translation is
1019 indirect: a decimal floating point number from the text is converted by
1020 @code{as} to a generic binary floating point number of more than
1021 sufficient precision. This generic floating point number is converted
1022 to a particular computer's floating point format (or formats) by a
1023 portion of @code{as} specialized to that computer.
1024
1025 A flonum is written by writing (in order)
1026 @itemize @bullet
1027 @item
1028 The digit @samp{0}.
1029 @item
1030 A letter, to tell @code{as} the rest of the number is a flonum.
1031 @kbd{e} is recommended. Case is not important.
1032 @ignore
1033 @c FIXME: verify if flonum syntax really this vague for most cases
1034 (Any otherwise illegal letter
1035 will work here, but that might be changed. Vax BSD 4.2 assembler seems
1036 to allow any of @samp{defghDEFGH}.)
1037 @end ignore
1038 On the AMD 29K and H8/300 architectures, the letter must be:
1039 One of the letters @samp{DFPRSX} (in upper or lower case).
1040 On the Intel 960 architecture, the letter must be:
1041 One of the letters @samp{DFT} (in upper or lower case).
1042 @item
1043 An optional sign: either @samp{+} or @samp{-}.
1044 @item
1045 An optional @dfn{integer part}: zero or more decimal digits.
1046 @item
1047 An optional @dfn{fractional part}: @samp{.} followed by zero
1048 or more decimal digits.
1049 @item
1050 An optional exponent, consisting of:
1051 @itemize @bullet
1052 @item
1053 An @samp{E} or @samp{e}.
1054 @c I can't find a config where "EXP_CHARS" is other than 'eE', but in
1055 @c principle this can perfectly well be different on different targets.
1056 @item
1057 Optional sign: either @samp{+} or @samp{-}.
1058 @item
1059 One or more decimal digits.
1060 @end itemize
1061 @end itemize
1062
1063 At least one of the integer part or the fractional part must be
1064 present. The floating point number has the usual base-10 value.
1065
1066 @code{as} does all processing using integers. Flonums are computed
1067 independently of any floating point hardware in the computer running
1068 @code{as}.
1069
1070
1071 @node Sections
1072 @chapter Sections and Relocation
1073 @cindex sections
1074 @cindex relocation
1075
1076 @menu
1077 * Secs Background:: Background
1078 * ld Sections:: ld Sections
1079 * as Sections:: as Internal Sections
1080 * Sub-Sections:: Sub-Sections
1081 * bss:: bss Section
1082 @end menu
1083
1084 @node Secs Background
1085 @section Background
1086
1087 Roughly, a section is a range of addresses, with no gaps; all data
1088 ``in'' those addresses is treated the same for some particular purpose.
1089 For example there may be a ``read only'' section.
1090
1091 @cindex linker, and assembler
1092 @cindex assembler, and linker
1093 The linker @code{ld} reads many object files (partial programs) and
1094 combines their contents to form a runnable program. When @code{as}
1095 emits an object file, the partial program is assumed to start at address
1096 0. @code{ld} will assign the final addresses the partial program
1097 occupies, so that different partial programs don't overlap. This is
1098 actually an over-simplification, but it will suffice to explain how
1099 @code{as} uses sections.
1100
1101 @code{ld} moves blocks of bytes of your program to their run-time
1102 addresses. These blocks slide to their run-time addresses as rigid
1103 units; their length does not change and neither does the order of bytes
1104 within them. Such a rigid unit is called a @emph{section}. Assigning
1105 run-time addresses to sections is called @dfn{relocation}. It includes
1106 the task of adjusting mentions of object-file addresses so they refer to
1107 the proper run-time addresses.
1108 For the H8/300, @code{as} pads sections if needed to ensure they end
1109 on a word (sixteen bit) boundary.
1110
1111 @cindex standard @code{as} sections
1112 An object file written by @code{as} has at least three sections, any
1113 of which may be empty. These are named @dfn{text}, @dfn{data} and
1114 @dfn{bss} sections.
1115
1116 When it generates COFF output,
1117 @code{as} can also generate whatever other named sections you specify
1118 using the @samp{.section} directive (@pxref{Section,,@code{.section}}).
1119 If you don't use any directives that place output in the @samp{.text}
1120 or @samp{.data} sections, these sections will still exist, but will be empty.
1121
1122 Within the object file, the text section starts at address @code{0}, the
1123 data section follows, and the bss section follows the data section.
1124
1125 To let @code{ld} know which data will change when the sections are
1126 relocated, and how to change that data, @code{as} also writes to the
1127 object file details of the relocation needed. To perform relocation
1128 @code{ld} must know, each time an address in the object
1129 file is mentioned:
1130 @itemize @bullet
1131 @item
1132 Where in the object file is the beginning of this reference to
1133 an address?
1134 @item
1135 How long (in bytes) is this reference?
1136 @item
1137 Which section does the address refer to? What is the numeric value of
1138 @display
1139 (@var{address}) @minus{} (@var{start-address of section})?
1140 @end display
1141 @item
1142 Is the reference to an address ``Program-Counter relative''?
1143 @end itemize
1144
1145 @cindex addresses, format of
1146 @cindex section-relative addressing
1147 In fact, every address @code{as} ever uses is expressed as
1148 @display
1149 (@var{section}) + (@var{offset into section})
1150 @end display
1151 @noindent
1152 Further, every expression @code{as} computes is of this section-relative
1153 nature. @dfn{Absolute expression} means an expression with section
1154 ``absolute'' (@pxref{ld Sections}). A @dfn{pass1 expression} means
1155 an expression with section ``pass1'' (@pxref{as Sections,,as
1156 Internal Sections}). In this manual we use the notation @{@var{secname}
1157 @var{N}@} to mean ``offset @var{N} into section @var{secname}''.
1158
1159 Apart from text, data and bss sections you need to know about the
1160 @dfn{absolute} section. When @code{ld} mixes partial programs,
1161 addresses in the absolute section remain unchanged. For example, address
1162 @code{@{absolute 0@}} is ``relocated'' to run-time address 0 by @code{ld}.
1163 Although two partial programs' data sections will not overlap addresses
1164 after linking, @emph{by definition} their absolute sections will overlap.
1165 Address @code{@{absolute@ 239@}} in one partial program will always be the same
1166 address when the program is running as address @code{@{absolute@ 239@}} in any
1167 other partial program.
1168
1169 The idea of sections is extended to the @dfn{undefined} section. Any
1170 address whose section is unknown at assembly time is by definition
1171 rendered @{undefined @var{U}@}---where @var{U} will be filled in later.
1172 Since numbers are always defined, the only way to generate an undefined
1173 address is to mention an undefined symbol. A reference to a named
1174 common block would be such a symbol: its value is unknown at assembly
1175 time so it has section @emph{undefined}.
1176
1177 By analogy the word @emph{section} is used to describe groups of sections in
1178 the linked program. @code{ld} puts all partial programs' text
1179 sections in contiguous addresses in the linked program. It is
1180 customary to refer to the @emph{text section} of a program, meaning all
1181 the addresses of all partial program's text sections. Likewise for
1182 data and bss sections.
1183
1184 Some sections are manipulated by @code{ld}; others are invented for
1185 use of @code{as} and have no meaning except during assembly.
1186
1187 @node ld Sections
1188 @section ld Sections
1189 @code{ld} deals with just four kinds of sections, summarized below.
1190
1191 @table @strong
1192
1193 @cindex named sections
1194 @cindex sections, named
1195 @item named sections
1196 @cindex text section
1197 @cindex data section
1198 @item text section
1199 @itemx data section
1200 These sections hold your program. @code{as} and @code{ld} treat them as
1201 separate but equal sections. Anything you can say of one section is
1202 true another.
1203 When the program is running, however, it is
1204 customary for the text section to be unalterable. The
1205 text section is often shared among processes: it will contain
1206 instructions, constants and the like. The data section of a running
1207 program is usually alterable: for example, C variables would be stored
1208 in the data section.
1209
1210 @cindex bss section
1211 @item bss section
1212 This section contains zeroed bytes when your program begins running. It
1213 is used to hold unitialized variables or common storage. The length of
1214 each partial program's bss section is important, but because it starts
1215 out containing zeroed bytes there is no need to store explicit zero
1216 bytes in the object file. The bss section was invented to eliminate
1217 those explicit zeros from object files.
1218
1219 @cindex absolute section
1220 @item absolute section
1221 Address 0 of this section is always ``relocated'' to runtime address 0.
1222 This is useful if you want to refer to an address that @code{ld} must
1223 not change when relocating. In this sense we speak of absolute
1224 addresses being ``unrelocatable'': they don't change during relocation.
1225
1226 @cindex undefined section
1227 @item undefined section
1228 This ``section'' is a catch-all for address references to objects not in
1229 the preceding sections.
1230 @c FIXME: ref to some other doc on obj-file formats could go here.
1231 @end table
1232
1233 @cindex relocation example
1234 An idealized example of three relocatable sections follows.
1235 The example uses the traditional section names @samp{.text} and @samp{.data}.
1236 Memory addresses are on the horizontal axis.
1237
1238 @c TEXI2ROFF-KILL
1239 @ifinfo
1240 @c END TEXI2ROFF-KILL
1241 @smallexample
1242 +-----+----+--+
1243 partial program # 1: |ttttt|dddd|00|
1244 +-----+----+--+
1245
1246 text data bss
1247 seg. seg. seg.
1248
1249 +---+---+---+
1250 partial program # 2: |TTT|DDD|000|
1251 +---+---+---+
1252
1253 +--+---+-----+--+----+---+-----+~~
1254 linked program: | |TTT|ttttt| |dddd|DDD|00000|
1255 +--+---+-----+--+----+---+-----+~~
1256
1257 addresses: 0 @dots{}
1258 @end smallexample
1259 @c TEXI2ROFF-KILL
1260 @end ifinfo
1261 @c FIXME make sure no page breaks inside figure!!
1262 @tex
1263
1264 \line{\it Partial program \#1: \hfil}
1265 \line{\ibox{2.5cm}{\tt text}\ibox{2cm}{\tt data}\ibox{1cm}{\tt bss}\hfil}
1266 \line{\boxit{2.5cm}{\tt ttttt}\boxit{2cm}{\tt dddd}\boxit{1cm}{\tt 00}\hfil}
1267
1268 \line{\it Partial program \#2: \hfil}
1269 \line{\ibox{1cm}{\tt text}\ibox{1.5cm}{\tt data}\ibox{1cm}{\tt bss}\hfil}
1270 \line{\boxit{1cm}{\tt TTT}\boxit{1.5cm}{\tt DDDD}\boxit{1cm}{\tt 000}\hfil}
1271
1272 \line{\it linked program: \hfil}
1273 \line{\ibox{.5cm}{}\ibox{1cm}{\tt text}\ibox{2.5cm}{}\ibox{.75cm}{}\ibox{2cm}{\tt data}\ibox{1.5cm}{}\ibox{2cm}{\tt bss}\hfil}
1274 \line{\boxit{.5cm}{}\boxit{1cm}{\tt TTT}\boxit{2.5cm}{\tt
1275 ttttt}\boxit{.75cm}{}\boxit{2cm}{\tt dddd}\boxit{1.5cm}{\tt
1276 DDDD}\boxit{2cm}{\tt 00000}\ \dots\hfil}
1277
1278 \line{\it addresses: \hfil}
1279 \line{0\dots\hfil}
1280
1281 @end tex
1282 @c END TEXI2ROFF-KILL
1283
1284 @node as Sections
1285 @section as Internal Sections
1286
1287 @cindex internal @code{as} sections
1288 @cindex sections in messages, internal
1289 These sections are meant only for the internal use of @code{as}. They
1290 have no meaning at run-time. You don't really need to know about these
1291 sections for most purposes; but they can be mentioned in @code{as}
1292 warning messages, so it might be helpful to have an idea of their
1293 meanings to @code{as}. These sections are used to permit the
1294 value of every expression in your assembly language program to be a
1295 section-relative address.
1296
1297 @table @b
1298 @item absent
1299 @cindex absent (internal section)
1300 An expression was expected and none was found.
1301
1302 @item ASSEMBLER-INTERNAL-LOGIC-ERROR!
1303 @cindex assembler internal logic error
1304 An internal assembler logic error has been found. This means there is a
1305 bug in the assembler.
1306
1307 @item bignum/flonum
1308 @cindex bignum/flonum (internal section)
1309 If a number can't be written as a C @code{int} constant (a bignum or a
1310 flonum, but not an integer), it is recorded as belonging to this
1311 ``section''. @code{as} has to remember that a flonum or a bignum
1312 does not fit into 32 bits, and cannot be an argument (@pxref{Arguments})
1313 in an expression: this is done by making a flonum or bignum be in a
1314 separate internal section. This is purely for internal @code{as}
1315 convenience; bignum/flonum section behaves similarly to absolute
1316 section.
1317
1318 @item pass1 section
1319 @cindex pass1 (internal section)
1320 The expression was impossible to evaluate in the first pass. The
1321 assembler will attempt a second pass (second reading of the source) to
1322 evaluate the expression. Your expression mentioned an undefined symbol
1323 in a way that defies the one-pass (section + offset in section) assembly
1324 process. No compiler need emit such an expression.
1325
1326 @quotation
1327 @emph{Warning:} the second pass is currently not implemented. @code{as}
1328 will abort with an error message if one is required.
1329 @end quotation
1330
1331 @item difference section
1332 @cindex difference (internal section)
1333 As an assist to the C compiler, expressions of the forms
1334 @display
1335 (@var{undefined symbol}) @minus{} (@var{expression})
1336 @var{something} @minus{} (@var{undefined symbol})
1337 (@var{undefined symbol}) @minus{} (@var{undefined symbol})
1338 @end display
1339
1340 are permitted, and belong to the difference section. @code{as}
1341 re-evaluates such expressions after the source file has been read and
1342 the symbol table built. If by that time there are no undefined symbols
1343 in the expression then the expression assumes a new section. The
1344 intention is to permit statements like
1345 @samp{.word label - base_of_table}
1346 to be assembled in one pass where both @code{label} and
1347 @code{base_of_table} are undefined. This is useful for compiling C and
1348 Algol switch statements, Pascal case statements, FORTRAN computed goto
1349 statements and the like.
1350 @c FIXME item debug
1351 @c FIXME item transfer[t] vector preload
1352 @c FIXME item transfer[t] vector postload
1353 @c FIXME item register
1354 @end table
1355
1356 @node Sub-Sections
1357 @section Sub-Sections
1358
1359 @cindex numbered subsections
1360 @cindex grouping data
1361 Assembled bytes
1362 conventionally
1363 fall into two sections: text and data.
1364 You may have separate groups of
1365 data in named sections
1366 that you want to end up near to each other in the object
1367 file, even though they are not contiguous in the assembler source.
1368 @code{as} allows you to use @dfn{subsections} for this purpose.
1369 Within each section, there can be numbered subsections with
1370 values from 0 to 8192. Objects assembled into the same subsection will
1371 be grouped with other objects in the same subsection when they are all
1372 put into the object file. For example, a compiler might want to store
1373 constants in the text section, but might not want to have them
1374 interspersed with the program being assembled. In this case, the
1375 compiler could issue a @samp{.text 0} before each section of code being
1376 output, and a @samp{.text 1} before each group of constants being output.
1377
1378 Subsections are optional. If you don't use subsections, everything
1379 will be stored in subsection number zero.
1380
1381 Each subsection is zero-padded up to a multiple of four bytes.
1382 (Subsections may be padded a different amount on different flavors
1383 of @code{as}.)
1384
1385 Subsections appear in your object file in numeric order, lowest numbered
1386 to highest. (All this to be compatible with other people's assemblers.)
1387 The object file contains no representation of subsections; @code{ld} and
1388 other programs that manipulate object files will see no trace of them.
1389 They just see all your text subsections as a text section, and all your
1390 data subsections as a data section.
1391
1392 To specify which subsection you want subsequent statements assembled
1393 into, use a numeric argument to specify it, in a @samp{.text
1394 @var{expression}} or a @samp{.data @var{expression}} statement.
1395 When generating COFF output, you
1396 can also use an extra subsection
1397 argument with arbitrary named sections: @samp{.section @var{name},
1398 @var{expression}}.
1399 @var{Expression} should be an absolute expression.
1400 (@xref{Expressions}.) If you just say @samp{.text} then @samp{.text 0}
1401 is assumed. Likewise @samp{.data} means @samp{.data 0}. Assembly
1402 begins in @code{text 0}. For instance:
1403 @smallexample
1404 .text 0 # The default subsection is text 0 anyway.
1405 .ascii "This lives in the first text subsection. *"
1406 .text 1
1407 .ascii "But this lives in the second text subsection."
1408 .data 0
1409 .ascii "This lives in the data section,"
1410 .ascii "in the first data subsection."
1411 .text 0
1412 .ascii "This lives in the first text section,"
1413 .ascii "immediately following the asterisk (*)."
1414 @end smallexample
1415
1416 Each section has a @dfn{location counter} incremented by one for every
1417 byte assembled into that section. Because subsections are merely a
1418 convenience restricted to @code{as} there is no concept of a subsection
1419 location counter. There is no way to directly manipulate a location
1420 counter---but the @code{.align} directive will change it, and any label
1421 definition will capture its current value. The location counter of the
1422 section that statements are being assembled into is said to be the
1423 @dfn{active} location counter.
1424
1425 @node bss
1426 @section bss Section
1427
1428 @cindex bss section
1429 @cindex common variable storage
1430 The bss section is used for local common variable storage.
1431 You may allocate address space in the bss section, but you may
1432 not dictate data to load into it before your program executes. When
1433 your program starts running, all the contents of the bss
1434 section are zeroed bytes.
1435
1436 Addresses in the bss section are allocated with special directives; you
1437 may not assemble anything directly into the bss section. Hence there
1438 are no bss subsections. @xref{Comm,,@code{.comm}},
1439 @pxref{Lcomm,,@code{.lcomm}}.
1440
1441 @node Symbols
1442 @chapter Symbols
1443
1444 @cindex symbols
1445 Symbols are a central concept: the programmer uses symbols to name
1446 things, the linker uses symbols to link, and the debugger uses symbols
1447 to debug.
1448
1449 @quotation
1450 @cindex debuggers, and symbol order
1451 @emph{Warning:} @code{as} does not place symbols in the object file in
1452 the same order they were declared. This may break some debuggers.
1453 @end quotation
1454
1455 @menu
1456 * Labels:: Labels
1457 * Setting Symbols:: Giving Symbols Other Values
1458 * Symbol Names:: Symbol Names
1459 * Dot:: The Special Dot Symbol
1460 * Symbol Attributes:: Symbol Attributes
1461 @end menu
1462
1463 @node Labels
1464 @section Labels
1465
1466 @cindex labels
1467 A @dfn{label} is written as a symbol immediately followed by a colon
1468 @samp{:}. The symbol then represents the current value of the
1469 active location counter, and is, for example, a suitable instruction
1470 operand. You are warned if you use the same symbol to represent two
1471 different locations: the first definition overrides any other
1472 definitions.
1473
1474 @node Setting Symbols
1475 @section Giving Symbols Other Values
1476
1477 @cindex assigning values to symbols
1478 @cindex symbol values, assigning
1479 A symbol can be given an arbitrary value by writing a symbol, followed
1480 by an equals sign @samp{=}, followed by an expression
1481 (@pxref{Expressions}). This is equivalent to using the @code{.set}
1482 directive. @xref{Set,,@code{.set}}.
1483
1484 @node Symbol Names
1485 @section Symbol Names
1486
1487 @cindex symbol names
1488 @cindex names, symbol
1489 Symbol names begin with a letter or with one of
1490 @samp{_.}
1491 (On most machines, you can also use @code{$} in symbol names; exceptions
1492 are noted in @ref{Machine Dependent}.)
1493 That character may be followed by any string of digits, letters,
1494 dollar signs (unless otherwise noted in @ref{Machine Dependent}),
1495 and underscores.
1496 Case of letters is significant:
1497 @code{foo} is a different symbol name than @code{Foo}.
1498
1499 For the AMD 29K family, @samp{?} is also allowed in the
1500 body of a symbol name, though not at its beginning.
1501
1502 Each symbol has exactly one name. Each name in an assembly language
1503 program refers to exactly one symbol. You may use that symbol name any
1504 number of times in a program.
1505
1506 @subheading Local Symbol Names
1507
1508 @cindex local symbol names
1509 @cindex symbol names, local
1510 @cindex temporary symbol names
1511 @cindex symbol names, temporary
1512 Local symbols help compilers and programmers use names temporarily.
1513 There are ten local symbol names, which are re-used throughout the
1514 program. You may refer to them using the names @samp{0} @samp{1}
1515 @dots{} @samp{9}. To define a local symbol, write a label of the form
1516 @samp{@b{N}:} (where @b{N} represents any digit). To refer to the most
1517 recent previous definition of that symbol write @samp{@b{N}b}, using the
1518 same digit as when you defined the label. To refer to the next
1519 definition of a local label, write @samp{@b{N}f}---where @b{N} gives you
1520 a choice of 10 forward references. The @samp{b} stands for
1521 ``backwards'' and the @samp{f} stands for ``forwards''.
1522
1523 Local symbols are not emitted by the current GNU C compiler.
1524
1525 There is no restriction on how you can use these labels, but
1526 remember that at any point in the assembly you can refer to at most
1527 10 prior local labels and to at most 10 forward local labels.
1528
1529 Local symbol names are only a notation device. They are immediately
1530 transformed into more conventional symbol names before the assembler
1531 uses them. The symbol names stored in the symbol table, appearing in
1532 error messages and optionally emitted to the object file have these
1533 parts:
1534
1535 @table @code
1536 @item L
1537 All local labels begin with @samp{L}. Normally both @code{as} and
1538 @code{ld} forget symbols that start with @samp{L}. These labels are
1539 used for symbols you are never intended to see. If you give the
1540 @samp{-L} option then @code{as} will retain these symbols in the
1541 object file. If you also instruct @code{ld} to retain these symbols,
1542 you may use them in debugging.
1543
1544 @item @var{digit}
1545 If the label is written @samp{0:} then the digit is @samp{0}.
1546 If the label is written @samp{1:} then the digit is @samp{1}.
1547 And so on up through @samp{9:}.
1548
1549 @item @ctrl{A}
1550 This unusual character is included so you don't accidentally invent
1551 a symbol of the same name. The character has ASCII value
1552 @samp{\001}.
1553
1554 @item @emph{ordinal number}
1555 This is a serial number to keep the labels distinct. The first
1556 @samp{0:} gets the number @samp{1}; The 15th @samp{0:} gets the
1557 number @samp{15}; @emph{etc.}. Likewise for the other labels @samp{1:}
1558 through @samp{9:}.
1559 @end table
1560
1561 For instance, the first @code{1:} is named @code{L1@ctrl{A}1}, the 44th
1562 @code{3:} is named @code{L3@ctrl{A}44}.
1563
1564 @node Dot
1565 @section The Special Dot Symbol
1566
1567 @cindex dot (symbol)
1568 @cindex @code{.} (symbol)
1569 @cindex current address
1570 @cindex location counter
1571 The special symbol @samp{.} refers to the current address that
1572 @code{as} is assembling into. Thus, the expression @samp{melvin:
1573 .long .} will cause @code{melvin} to contain its own address.
1574 Assigning a value to @code{.} is treated the same as a @code{.org}
1575 directive. Thus, the expression @samp{.=.+4} is the same as saying
1576 @samp{.block 4}.
1577
1578 @node Symbol Attributes
1579 @section Symbol Attributes
1580
1581 @cindex symbol attributes
1582 @cindex attributes, symbol
1583 Every symbol has, as well as its name, the attributes ``Value'' and
1584 ``Type''. Depending on output format, symbols can also have auxiliary
1585 attributes.
1586
1587 If you use a symbol without defining it, @code{as} assumes zero for
1588 all these attributes, and probably won't warn you. This makes the
1589 symbol an externally defined symbol, which is generally what you
1590 would want.
1591
1592 @menu
1593 * Symbol Value:: Value
1594 * Symbol Type:: Type
1595 * a.out Symbols:: Symbol Attributes: @code{a.out}
1596 * COFF Symbols:: Symbol Attributes for COFF
1597 @end menu
1598
1599 @node Symbol Value
1600 @subsection Value
1601
1602 @cindex value of a symbol
1603 @cindex symbol value
1604 The value of a symbol is (usually) 32 bits. For a symbol which labels a
1605 location in the text, data, bss or absolute sections the value is the
1606 number of addresses from the start of that section to the label.
1607 Naturally for text, data and bss sections the value of a symbol changes
1608 as @code{ld} changes section base addresses during linking. Absolute
1609 symbols' values do not change during linking: that is why they are
1610 called absolute.
1611
1612 The value of an undefined symbol is treated in a special way. If it is
1613 0 then the symbol is not defined in this assembler source program, and
1614 @code{ld} will try to determine its value from other programs it is
1615 linked with. You make this kind of symbol simply by mentioning a symbol
1616 name without defining it. A non-zero value represents a @code{.comm}
1617 common declaration. The value is how much common storage to reserve, in
1618 bytes (addresses). The symbol refers to the first address of the
1619 allocated storage.
1620
1621 @node Symbol Type
1622 @subsection Type
1623
1624 @cindex type of a symbol
1625 @cindex symbol type
1626 The type attribute of a symbol contains relocation (section)
1627 information, any flag settings indicating that a symbol is external, and
1628 (optionally), other information for linkers and debuggers. The exact
1629 format depends on the object-code output format in use.
1630
1631 @node a.out Symbols
1632 @subsection Symbol Attributes: @code{a.out}
1633
1634 @cindex @code{a.out} symbol attributes
1635 @cindex symbol attributes, @code{a.out}
1636
1637 @menu
1638 * Symbol Desc:: Descriptor
1639 * Symbol Other:: Other
1640 @end menu
1641
1642 @node Symbol Desc
1643 @subsubsection Descriptor
1644
1645 @cindex descriptor, of @code{a.out} symbol
1646 This is an arbitrary 16-bit value. You may establish a symbol's
1647 descriptor value by using a @code{.desc} statement
1648 (@pxref{Desc,,@code{.desc}}). A descriptor value means nothing to
1649 @code{as}.
1650
1651 @node Symbol Other
1652 @subsubsection Other
1653
1654 @cindex other attribute, of @code{a.out} symbol
1655 This is an arbitrary 8-bit value. It means nothing to @code{as}.
1656
1657 @node COFF Symbols
1658 @subsection Symbol Attributes for COFF
1659
1660 @cindex COFF symbol attributes
1661 @cindex symbol attributes, COFF
1662
1663 The COFF format supports a multitude of auxiliary symbol attributes;
1664 like the primary symbol attributes, they are set between @code{.def} and
1665 @code{.endef} directives.
1666
1667 @subsubsection Primary Attributes
1668
1669 @cindex primary attributes, COFF symbols
1670 The symbol name is set with @code{.def}; the value and type,
1671 respectively, with @code{.val} and @code{.type}.
1672
1673 @subsubsection Auxiliary Attributes
1674
1675 @cindex auxiliary attributes, COFF symbols
1676 The @code{as} directives @code{.dim}, @code{.line}, @code{.scl},
1677 @code{.size}, and @code{.tag} can generate auxiliary symbol table
1678 information for COFF.
1679
1680 @node Expressions
1681 @chapter Expressions
1682
1683 @cindex expressions
1684 @cindex addresses
1685 @cindex numeric values
1686 An @dfn{expression} specifies an address or numeric value.
1687 Whitespace may precede and/or follow an expression.
1688
1689 @menu
1690 * Empty Exprs:: Empty Expressions
1691 * Integer Exprs:: Integer Expressions
1692 @end menu
1693
1694 @node Empty Exprs
1695 @section Empty Expressions
1696
1697 @cindex empty expressions
1698 @cindex expressions, empty
1699 An empty expression has no value: it is just whitespace or null.
1700 Wherever an absolute expression is required, you may omit the
1701 expression and @code{as} will assume a value of (absolute) 0. This
1702 is compatible with other assemblers.
1703
1704 @node Integer Exprs
1705 @section Integer Expressions
1706
1707 @cindex integer expressions
1708 @cindex expressions, integer
1709 An @dfn{integer expression} is one or more @emph{arguments} delimited
1710 by @emph{operators}.
1711
1712 @menu
1713 * Arguments:: Arguments
1714 * Operators:: Operators
1715 * Prefix Ops:: Prefix Operators
1716 * Infix Ops:: Infix Operators
1717 @end menu
1718
1719 @node Arguments
1720 @subsection Arguments
1721
1722 @cindex expression arguments
1723 @cindex arguments in expressions
1724 @cindex operands in expressions
1725 @cindex arithmetic operands
1726 @dfn{Arguments} are symbols, numbers or subexpressions. In other
1727 contexts arguments are sometimes called ``arithmetic operands''. In
1728 this manual, to avoid confusing them with the ``instruction operands'' of
1729 the machine language, we use the term ``argument'' to refer to parts of
1730 expressions only, reserving the word ``operand'' to refer only to machine
1731 instruction operands.
1732
1733 Symbols are evaluated to yield @{@var{section} @var{NNN}@} where
1734 @var{section} is one of text, data, bss, absolute,
1735 or undefined. @var{NNN} is a signed, 2's complement 32 bit
1736 integer.
1737
1738 Numbers are usually integers.
1739
1740 A number can be a flonum or bignum. In this case, you are warned
1741 that only the low order 32 bits are used, and @code{as} pretends
1742 these 32 bits are an integer. You may write integer-manipulating
1743 instructions that act on exotic constants, compatible with other
1744 assemblers.
1745
1746 @cindex subexpressions
1747 Subexpressions are a left parenthesis @samp{(} followed by an integer
1748 expression, followed by a right parenthesis @samp{)}; or a prefix
1749 operator followed by an argument.
1750
1751 @node Operators
1752 @subsection Operators
1753
1754 @cindex operators, in expressions
1755 @cindex arithmetic functions
1756 @cindex functions, in expressions
1757 @dfn{Operators} are arithmetic functions, like @code{+} or @code{%}. Prefix
1758 operators are followed by an argument. Infix operators appear
1759 between their arguments. Operators may be preceded and/or followed by
1760 whitespace.
1761
1762 @node Prefix Ops
1763 @subsection Prefix Operator
1764
1765 @cindex prefix operators
1766 @code{as} has the following @dfn{prefix operators}. They each take
1767 one argument, which must be absolute.
1768
1769 @c the tex/end tex stuff surrounding this small table is meant to make
1770 @c it align, on the printed page, with the similar table in the next
1771 @c section (which is inside an enumerate).
1772 @tex
1773 \global\advance\leftskip by \itemindent
1774 @end tex
1775
1776 @table @code
1777 @item -
1778 @dfn{Negation}. Two's complement negation.
1779 @item ~
1780 @dfn{Complementation}. Bitwise not.
1781 @end table
1782
1783 @tex
1784 \global\advance\leftskip by -\itemindent
1785 @end tex
1786
1787 @node Infix Ops
1788 @subsection Infix Operators
1789
1790 @cindex infix operators
1791 @cindex operators, permitted arguments
1792 @dfn{Infix operators} take two arguments, one on either side. Operators
1793 have precedence, but operations with equal precedence are performed left
1794 to right. Apart from @code{+} or @code{-}, both arguments must be
1795 absolute, and the result is absolute.
1796
1797 @enumerate
1798 @cindex operator precedence
1799 @cindex precedence of operators
1800
1801 @item
1802 Highest Precedence
1803
1804 @table @code
1805 @item *
1806 @dfn{Multiplication}.
1807
1808 @item /
1809 @dfn{Division}. Truncation is the same as the C operator @samp{/}
1810
1811 @item %
1812 @dfn{Remainder}.
1813
1814 @item <
1815 @itemx <<
1816 @dfn{Shift Left}. Same as the C operator @samp{<<}
1817
1818 @item >
1819 @itemx >>
1820 @dfn{Shift Right}. Same as the C operator @samp{>>}
1821 @end table
1822
1823 @item
1824 Intermediate precedence
1825
1826 @table @code
1827 @item |
1828
1829 @dfn{Bitwise Inclusive Or}.
1830
1831 @item &
1832 @dfn{Bitwise And}.
1833
1834 @item ^
1835 @dfn{Bitwise Exclusive Or}.
1836
1837 @item !
1838 @dfn{Bitwise Or Not}.
1839 @end table
1840
1841 @item
1842 Lowest Precedence
1843
1844 @table @code
1845 @item +
1846 @cindex addition, permitted arguments
1847 @cindex plus, permitted arguments
1848 @cindex arguments for addition
1849 @dfn{Addition}. If either argument is absolute, the result
1850 has the section of the other argument.
1851 If either argument is pass1 or undefined, the result is pass1.
1852 Otherwise @code{+} is illegal.
1853
1854 @item -
1855 @cindex subtraction, permitted arguments
1856 @cindex minus, permitted arguments
1857 @cindex arguments for subtraction
1858 @dfn{Subtraction}. If the right argument is absolute, the
1859 result has the section of the left argument.
1860 If either argument is pass1 the result is pass1.
1861 If either argument is undefined the result is difference section.
1862 If both arguments are in the same section, the result is absolute---provided
1863 that section is one of text, data or bss.
1864 Otherwise subtraction is illegal.
1865 @end table
1866 @end enumerate
1867
1868 The sense of the rule for addition is that it's only meaningful to add
1869 the @emph{offsets} in an address; you can only have a defined section in
1870 one of the two arguments.
1871
1872 Similarly, you can't subtract quantities from two different sections.
1873
1874 @node Pseudo Ops
1875 @chapter Assembler Directives
1876
1877 @cindex directives, machine independent
1878 @cindex pseudo-ops, machine independent
1879 @cindex machine independent directives
1880 All assembler directives have names that begin with a period (@samp{.}).
1881 The rest of the name is letters, usually in lower case.
1882
1883 This chapter discusses directives present regardless of the target
1884 machine configuration for the GNU assembler.
1885
1886 @menu
1887 * Abort:: @code{.abort}
1888 * coff-ABORT:: @code{.ABORT}
1889 * Align:: @code{.align @var{abs-expr} , @var{abs-expr}}
1890 * App-File:: @code{.app-file @var{string}}
1891 * Ascii:: @code{.ascii "@var{string}"}@dots{}
1892 * Asciz:: @code{.asciz "@var{string}"}@dots{}
1893 * Byte:: @code{.byte @var{expressions}}
1894 * Comm:: @code{.comm @var{symbol} , @var{length} }
1895 * Data:: @code{.data @var{subsection}}
1896 * Def:: @code{.def @var{name}}
1897 * Desc:: @code{.desc @var{symbol}, @var{abs-expression}}
1898 * Dim:: @code{.dim}
1899 * Double:: @code{.double @var{flonums}}
1900 * Eject:: @code{.eject}
1901 * Else:: @code{.else}
1902 * Endef:: @code{.endef}
1903 * Endif:: @code{.endif}
1904 * Equ:: @code{.equ @var{symbol}, @var{expression}}
1905 * Extern:: @code{.extern}
1906 * File:: @code{.file @var{string}}
1907 * Fill:: @code{.fill @var{repeat} , @var{size} , @var{value}}
1908 * Float:: @code{.float @var{flonums}}
1909 * Global:: @code{.global @var{symbol}}, @code{.globl @var{symbol}}
1910 * hword:: @code{.hword @var{expressions}}
1911 * Ident:: @code{.ident}
1912 * If:: @code{.if @var{absolute expression}}
1913 * Include:: @code{.include "@var{file}"}
1914 * Int:: @code{.int @var{expressions}}
1915 * Lcomm:: @code{.lcomm @var{symbol} , @var{length}}
1916 * Lflags:: @code{.lflags}
1917 * Line:: @code{.line @var{line-number}}
1918 * Ln:: @code{.ln @var{line-number}}
1919 * List:: @code{.list}
1920 * Long:: @code{.long @var{expressions}}
1921 * Nolist:: @code{.nolist}
1922 * Octa:: @code{.octa @var{bignums}}
1923 * Org:: @code{.org @var{new-lc} , @var{fill}}
1924 * Psize:: @code{.psize @var{lines}, @var{columns}}
1925 * Quad:: @code{.quad @var{bignums}}
1926 * Sbttl:: @code{.sbttl "@var{subheading}"}
1927 * Scl:: @code{.scl @var{class}}
1928 * Section:: @code{.section @var{name}, @var{subsection}}
1929 * Set:: @code{.set @var{symbol}, @var{expression}}
1930 * Short:: @code{.short @var{expressions}}
1931 * Single:: @code{.single @var{flonums}}
1932 * Size:: @code{.size}
1933 * Space:: @code{.space @var{size} , @var{fill}}
1934 * Stab:: @code{.stabd, .stabn, .stabs}
1935 * Tag:: @code{.tag @var{structname}}
1936 * Text:: @code{.text @var{subsection}}
1937 * Title:: @code{.title "@var{heading}"}
1938 * Type:: @code{.type @var{int}}
1939 * Val:: @code{.val @var{addr}}
1940 * Word:: @code{.word @var{expressions}}
1941 * Deprecated:: Deprecated Directives
1942 @end menu
1943
1944 @node Abort
1945 @section @code{.abort}
1946
1947 @cindex @code{abort} directive
1948 @cindex stopping the assembly
1949 This directive stops the assembly immediately. It is for
1950 compatibility with other assemblers. The original idea was that the
1951 assembly language source would be piped into the assembler. If the sender
1952 of the source quit, it could use this directive tells @code{as} to
1953 quit also. One day @code{.abort} will not be supported.
1954
1955 @node coff-ABORT
1956 @section @code{.ABORT}
1957
1958 @cindex @code{ABORT} directive
1959 When producing COFF output, @code{as} accepts this directive as a
1960 synonym for @samp{.abort}.
1961
1962
1963 When producing @code{b.out} output, @code{as} accepts this directive,
1964 but ignores it.
1965
1966 @node Align
1967 @section @code{.align @var{abs-expr} , @var{abs-expr}}
1968
1969 @cindex padding the location counter
1970 @cindex @code{align} directive
1971 Pad the location counter (in the current subsection) to a particular
1972 storage boundary. The first expression (which must be absolute) is the
1973 number of low-order zero bits the location counter will have after
1974 advancement. For example @samp{.align 3} will advance the location
1975 counter until it a multiple of 8. If the location counter is already a
1976 multiple of 8, no change is needed.
1977
1978 The second expression (also absolute) gives the value to be stored in
1979 the padding bytes. It (and the comma) may be omitted. If it is
1980 omitted, the padding bytes are zero.
1981
1982 @node App-File
1983 @section @code{.app-file @var{string}}
1984
1985 @cindex logical file name
1986 @cindex file name, logical
1987 @cindex @code{app-file} directive
1988 @code{.app-file}
1989 tells @code{as} that we are about to start a new
1990 logical file. @var{string} is the new file name. In general, the
1991 filename is recognized whether or not it is surrounded by quotes @samp{"};
1992 but if you wish to specify an empty file name is permitted,
1993 you must give the quotes--@code{""}. This statement may go away in
1994 future: it is only recognized to be compatible with old @code{as}
1995 programs.@refill
1996
1997 @node Ascii
1998 @section @code{.ascii "@var{string}"}@dots{}
1999
2000 @cindex @code{ascii} directive
2001 @cindex string literals
2002 @code{.ascii} expects zero or more string literals (@pxref{Strings})
2003 separated by commas. It assembles each string (with no automatic
2004 trailing zero byte) into consecutive addresses.
2005
2006 @node Asciz
2007 @section @code{.asciz "@var{string}"}@dots{}
2008
2009 @cindex @code{asciz} directive
2010 @cindex zero-terminated strings
2011 @cindex null-terminated strings
2012 @code{.asciz} is just like @code{.ascii}, but each string is followed by
2013 a zero byte. The ``z'' in @samp{.asciz} stands for ``zero''.
2014
2015 @node Byte
2016 @section @code{.byte @var{expressions}}
2017
2018 @cindex @code{byte} directive
2019 @cindex integers, one byte
2020 @code{.byte} expects zero or more expressions, separated by commas.
2021 Each expression is assembled into the next byte.
2022
2023 @node Comm
2024 @section @code{.comm @var{symbol} , @var{length} }
2025
2026 @cindex @code{comm} directive
2027 @cindex symbol, common
2028 @code{.comm} declares a named common area in the bss section. Normally
2029 @code{ld} reserves memory addresses for it during linking, so no partial
2030 program defines the location of the symbol. Use @code{.comm} to tell
2031 @code{ld} that it must be at least @var{length} bytes long. @code{ld}
2032 will allocate space for each @code{.comm} symbol that is at least as
2033 long as the longest @code{.comm} request in any of the partial programs
2034 linked. @var{length} is an absolute expression.
2035
2036 @node Data
2037 @section @code{.data @var{subsection}}
2038
2039 @cindex @code{data} directive
2040 @code{.data} tells @code{as} to assemble the following statements onto the
2041 end of the data subsection numbered @var{subsection} (which is an
2042 absolute expression). If @var{subsection} is omitted, it defaults
2043 to zero.
2044
2045 @node Def
2046 @section @code{.def @var{name}}
2047
2048 @cindex @code{def} directive
2049 @cindex COFF symbols, debugging
2050 @cindex debugging COFF symbols
2051 Begin defining debugging information for a symbol @var{name}; the
2052 definition extends until the @code{.endef} directive is encountered.
2053
2054 This directive is only observed when @code{as} is configured for COFF
2055 format output; when producing @code{b.out}, @samp{.def} is recognized,
2056 but ignored.
2057
2058 @node Desc
2059 @section @code{.desc @var{symbol}, @var{abs-expression}}
2060
2061 @cindex @code{desc} directive
2062 @cindex COFF symbol descriptor
2063 @cindex symbol descriptor, COFF
2064 This directive sets the descriptor of the symbol (@pxref{Symbol Attributes})
2065 to the low 16 bits of an absolute expression.
2066
2067 The @samp{.desc} directive is not available when @code{as} is
2068 configured for COFF output; it is only for @code{a.out} or @code{b.out}
2069 object format. For the sake of compatibility, @code{as} will accept
2070 it, but produce no output, when configured for COFF.
2071
2072 @node Dim
2073 @section @code{.dim}
2074
2075 @cindex @code{dim} directive
2076 @cindex COFF auxiliary symbol information
2077 @cindex auxiliary symbol information, COFF
2078 This directive is generated by compilers to include auxiliary debugging
2079 information in the symbol table. It is only permitted inside
2080 @code{.def}/@code{.endef} pairs.
2081
2082 @samp{.dim} is only meaningful when generating COFF format output; when
2083 @code{as} is generating @code{b.out}, it accepts this directive but
2084 ignores it.
2085
2086 @node Double
2087 @section @code{.double @var{flonums}}
2088
2089 @cindex @code{double} directive
2090 @cindex floating point numbers (double)
2091 @code{.double} expects zero or more flonums, separated by commas. It
2092 assembles floating point numbers.
2093 The exact kind of floating point numbers emitted depends on how
2094 @code{as} is configured. @xref{Machine Dependent}.
2095
2096 @node Eject
2097 @section @code{.eject}
2098
2099 @cindex @code{eject} directive
2100 @cindex new page, in listings
2101 @cindex page, in listings
2102 @cindex listing control: new page
2103 Force a page break at this point, when generating assembly listings.
2104
2105 @node Else
2106 @section @code{.else}
2107
2108 @cindex @code{else} directive
2109 @code{.else} is part of the @code{as} support for conditional
2110 assembly; @pxref{If,,@code{.if}}. It marks the beginning of a section
2111 of code to be assembled if the condition for the preceding @code{.if}
2112 was false.
2113
2114
2115 @node Endef
2116 @section @code{.endef}
2117
2118 @cindex @code{endef} directive
2119 This directive flags the end of a symbol definition begun with
2120 @code{.def}.
2121
2122 @samp{.endef} is only meaningful when generating COFF format output; if
2123 @code{as} is configured to generate @code{b.out}, it accepts this
2124 directive but ignores it.
2125
2126 @node Endif
2127 @section @code{.endif}
2128
2129 @cindex @code{endif} directive
2130 @code{.endif} is part of the @code{as} support for conditional assembly;
2131 it marks the end of a block of code that is only assembled
2132 conditionally. @xref{If,,@code{.if}}.
2133
2134 @node Equ
2135 @section @code{.equ @var{symbol}, @var{expression}}
2136
2137 @cindex @code{equ} directive
2138 @cindex assigning values to symbols
2139 @cindex symbols, assigning values to
2140 This directive sets the value of @var{symbol} to @var{expression}.
2141 It is synonymous with @samp{.set}; @pxref{Set,,@code{.set}}.
2142
2143 @node Extern
2144 @section @code{.extern}
2145
2146 @cindex @code{extern} directive
2147 @code{.extern} is accepted in the source program---for compatibility
2148 with other assemblers---but it is ignored. @code{as} treats
2149 all undefined symbols as external.
2150
2151 @node File
2152 @section @code{.file @var{string}}
2153
2154 @cindex @code{file} directive
2155 @cindex logical file name
2156 @cindex file name, logical
2157 @code{.file} (which may also be spelled @samp{.app-file}) tells
2158 @code{as} that we are about to start a new logical file.
2159 @var{string} is the new file name. In general, the filename is
2160 recognized whether or not it is surrounded by quotes @samp{"}; but if
2161 you wish to specify an empty file name, you must give the
2162 quotes--@code{""}. This statement may go away in future: it is only
2163 recognized to be compatible with old @code{as} programs.
2164 In some configurations of @code{as}, @code{.file} has already been
2165 removed to avoid conflicts with other assemblers. @xref{Machine Dependent}.
2166
2167 @node Fill
2168 @section @code{.fill @var{repeat} , @var{size} , @var{value}}
2169
2170 @cindex @code{fill} directive
2171 @cindex writing patterns in memory
2172 @cindex patterns, writing in memory
2173 @var{result}, @var{size} and @var{value} are absolute expressions.
2174 This emits @var{repeat} copies of @var{size} bytes. @var{Repeat}
2175 may be zero or more. @var{Size} may be zero or more, but if it is
2176 more than 8, then it is deemed to have the value 8, compatible with
2177 other people's assemblers. The contents of each @var{repeat} bytes
2178 is taken from an 8-byte number. The highest order 4 bytes are
2179 zero. The lowest order 4 bytes are @var{value} rendered in the
2180 byte-order of an integer on the computer @code{as} is assembling for.
2181 Each @var{size} bytes in a repetition is taken from the lowest order
2182 @var{size} bytes of this number. Again, this bizarre behavior is
2183 compatible with other people's assemblers.
2184
2185 @var{size} and @var{value} are optional.
2186 If the second comma and @var{value} are absent, @var{value} is
2187 assumed zero. If the first comma and following tokens are absent,
2188 @var{size} is assumed to be 1.
2189
2190 @node Float
2191 @section @code{.float @var{flonums}}
2192
2193 @cindex floating point numbers (single)
2194 @cindex @code{float} directive
2195 This directive assembles zero or more flonums, separated by commas. It
2196 has the same effect as @code{.single}.
2197 The exact kind of floating point numbers emitted depends on how
2198 @code{as} is configured.
2199 @xref{Machine Dependent}.
2200
2201 @node Global
2202 @section @code{.global @var{symbol}}, @code{.globl @var{symbol}}
2203
2204 @cindex @code{global} directive
2205 @cindex symbol, making visible to linker
2206 @code{.global} makes the symbol visible to @code{ld}. If you define
2207 @var{symbol} in your partial program, its value is made available to
2208 other partial programs that are linked with it. Otherwise,
2209 @var{symbol} will take its attributes from a symbol of the same name
2210 from another partial program it is linked with.
2211
2212 Both spellings (@samp{.globl} and @samp{.global}) are accepted, for
2213 compatibility with other assemblers.
2214
2215 @node hword
2216 @section @code{.hword @var{expressions}}
2217
2218 @cindex @code{hword} directive
2219 @cindex integers, 16-bit
2220 @cindex numbers, 16-bit
2221 @cindex sixteen bit integers
2222 This expects zero or more @var{expressions}, and emits
2223 a 16 bit number for each.
2224
2225 This directive is a synonym for @samp{.short}; depending on the target
2226 architecture, it may also be a synonym for @samp{.word}.
2227
2228 @node Ident
2229 @section @code{.ident}
2230
2231 @cindex @code{ident} directive
2232 This directive is used by some assemblers to place tags in object files.
2233 @code{as} simply accepts the directive for source-file
2234 compatibility with such assemblers, but does not actually emit anything
2235 for it.
2236
2237 @node If
2238 @section @code{.if @var{absolute expression}}
2239
2240 @cindex conditional assembly
2241 @cindex @code{if} directive
2242 @code{.if} marks the beginning of a section of code which is only
2243 considered part of the source program being assembled if the argument
2244 (which must be an @var{absolute expression}) is non-zero. The end of
2245 the conditional section of code must be marked by @code{.endif}
2246 (@pxref{Endif,,@code{.endif}}); optionally, you may include code for the
2247 alternative condition, flagged by @code{.else} (@pxref{Else,,@code{.else}}.
2248
2249 The following variants of @code{.if} are also supported:
2250 @table @code
2251 @item .ifdef @var{symbol}
2252 @cindex @code{ifdef} directive
2253 Assembles the following section of code if the specified @var{symbol}
2254 has been defined.
2255
2256
2257 @item .ifndef @var{symbol}
2258 @itemx ifnotdef @var{symbol}
2259 @cindex @code{ifndef} directive
2260 @cindex @code{ifnotdef} directive
2261 Assembles the following section of code if the specified @var{symbol}
2262 has not been defined. Both spelling variants are equivalent.
2263
2264 @end table
2265
2266 @node Include
2267 @section @code{.include "@var{file}"}
2268
2269 @cindex @code{include} directive
2270 @cindex supporting files, including
2271 @cindex files, including
2272 This directive provides a way to include supporting files at specified
2273 points in your source program. The code from @var{file} is assembled as
2274 if it followed the point of the @code{.include}; when the end of the
2275 included file is reached, assembly of the original file continues. You
2276 can control the search paths used with the @samp{-I} command-line option
2277 (@pxref{Invoking,,Command-Line Options}). Quotation marks are required
2278 around @var{file}.
2279
2280 @node Int
2281 @section @code{.int @var{expressions}}
2282
2283 @cindex @code{int} directive
2284 @cindex integers, 32-bit
2285 Expect zero or more @var{expressions}, of any section, separated by
2286 commas. For each expression, emit a
2287 32-bit
2288 number that will, at run
2289 time, be the value of that expression. The byte order of the
2290 expression depends on what kind of computer will run the program.
2291
2292 @node Lcomm
2293 @section @code{.lcomm @var{symbol} , @var{length}}
2294
2295 @cindex @code{lcomm} directive
2296 @cindex local common symbols
2297 @cindex symbols, local common
2298 Reserve @var{length} (an absolute expression) bytes for a local common
2299 denoted by @var{symbol}. The section and value of @var{symbol} are
2300 those of the new local common. The addresses are allocated in the bss
2301 section, so at run-time the bytes will start off zeroed. @var{Symbol}
2302 is not declared global (@pxref{Global,,@code{.global}}), so is normally
2303 not visible to @code{ld}.
2304
2305 @node Lflags
2306 @section @code{.lflags}
2307
2308 @cindex @code{lflags} directive (ignored)
2309 @code{as} accepts this directive, for compatibility with other
2310 assemblers, but ignores it.
2311
2312 @node Line
2313 @section @code{.line @var{line-number}}
2314
2315 @cindex @code{line} directive
2316 @cindex logical line number
2317 Tell @code{as} to change the logical line number. @var{line-number} must be
2318 an absolute expression. The next line will have that logical line
2319 number. So any other statements on the current line (after a statement
2320 separator
2321 character)
2322 will be reported as on logical line number
2323 @var{line-number} @minus{} 1.
2324 One day this directive will be unsupported: it is used only
2325 for compatibility with existing assembler programs. @refill
2326
2327 @emph{Warning:} In the AMD29K configuration of as, this command is
2328 only available with the name @code{.ln}, rather than as either
2329 @code{.line} or @code{.ln}.
2330
2331 @node Ln
2332 @section @code{.ln @var{line-number}}
2333
2334 @cindex @code{ln} directive
2335 @samp{.ln} is a synonym for @samp{.line}.
2336
2337 @node List
2338 @section @code{.list}
2339
2340 @cindex @code{list} directive
2341 @cindex listing control, turning on
2342 Control (in conjunction with the @code{.nolist} directive) whether or
2343 not assembly listings are generated. These two directives maintain an
2344 internal counter (which is zero initially). @code{.list} increments the
2345 counter, and @code{.nolist} decrements it. Assembly listings are
2346 generated whenever the counter is greater than zero.
2347
2348 By default, listings are disabled. When you enable them (with the
2349 @samp{-a} command line option; @pxref{Invoking,,Command-Line Options}),
2350 the initial value of the listing counter is one.
2351
2352 @node Long
2353 @section @code{.long @var{expressions}}
2354
2355 @cindex @code{long} directive
2356 @code{.long} is the same as @samp{.int}, @pxref{Int,,@code{.int}}.
2357
2358 @ignore
2359 @c no one seems to know what this is for or whether this description is
2360 @c what it really ought to do
2361 @node Lsym
2362 @section @code{.lsym @var{symbol}, @var{expression}}
2363
2364 @cindex @code{lsym} directive
2365 @cindex symbol, not referenced in assembly
2366 @code{.lsym} creates a new symbol named @var{symbol}, but does not put it in
2367 the hash table, ensuring it cannot be referenced by name during the
2368 rest of the assembly. This sets the attributes of the symbol to be
2369 the same as the expression value:
2370 @smallexample
2371 @var{other} = @var{descriptor} = 0
2372 @var{type} = @r{(section of @var{expression})}
2373 @var{value} = @var{expression}
2374 @end smallexample
2375 @noindent
2376 The new symbol is not flagged as external.
2377 @end ignore
2378
2379 @node Nolist
2380 @section @code{.nolist}
2381
2382 @cindex @code{nolist} directive
2383 @cindex listing control, turning off
2384 Control (in conjunction with the @code{.list} directive) whether or
2385 not assembly listings are generated. These two directives maintain an
2386 internal counter (which is zero initially). @code{.list} increments the
2387 counter, and @code{.nolist} decrements it. Assembly listings are
2388 generated whenever the counter is greater than zero.
2389
2390 @node Octa
2391 @section @code{.octa @var{bignums}}
2392
2393 @c FIXME: double size emitted for "octa" on i960, others? Or warn?
2394 @cindex @code{octa} directive
2395 @cindex integer, 16-byte
2396 @cindex sixteen byte integer
2397 This directive expects zero or more bignums, separated by commas. For each
2398 bignum, it emits a 16-byte integer.
2399
2400 The term ``octa'' comes from contexts in which a ``word'' is two bytes;
2401 hence @emph{octa}-word for 16 bytes.
2402
2403 @node Org
2404 @section @code{.org @var{new-lc} , @var{fill}}
2405
2406 @cindex @code{org} directive
2407 @cindex location counter, advancing
2408 @cindex advancing location counter
2409 @cindex current address, advancing
2410 @code{.org} will advance the location counter of the current section to
2411 @var{new-lc}. @var{new-lc} is either an absolute expression or an
2412 expression with the same section as the current subsection. That is,
2413 you can't use @code{.org} to cross sections: if @var{new-lc} has the
2414 wrong section, the @code{.org} directive is ignored. To be compatible
2415 with former assemblers, if the section of @var{new-lc} is absolute,
2416 @code{as} will issue a warning, then pretend the section of @var{new-lc}
2417 is the same as the current subsection.
2418
2419 @code{.org} may only increase the location counter, or leave it
2420 unchanged; you cannot use @code{.org} to move the location counter
2421 backwards.
2422
2423 @c double negative used below "not undefined" because this is a specific
2424 @c reference to "undefined" (as SEG_UNKNOWN is called in this manual)
2425 @c section. pesch@cygnus.com 18feb91
2426 Because @code{as} tries to assemble programs in one pass @var{new-lc}
2427 may not be undefined. If you really detest this restriction we eagerly await
2428 a chance to share your improved assembler.
2429
2430 Beware that the origin is relative to the start of the section, not
2431 to the start of the subsection. This is compatible with other
2432 people's assemblers.
2433
2434 When the location counter (of the current subsection) is advanced, the
2435 intervening bytes are filled with @var{fill} which should be an
2436 absolute expression. If the comma and @var{fill} are omitted,
2437 @var{fill} defaults to zero.
2438
2439 @node Psize
2440 @section @code{.psize @var{lines} , @var{columns}}
2441
2442 @cindex @code{psize} directive
2443 @cindex listing control: paper size
2444 @cindex paper size, for listings
2445 Use this directive to declare the number of lines---and, optionally, the
2446 number of columns---to use for each page, when generating listings.
2447
2448 If you don't use @code{.psize}, listings will use a default line-count
2449 of 60. You may omit the comma and @var{columns} specification; the
2450 default width is 200 columns.
2451
2452 @code{as} will generate formfeeds whenever the specified number of
2453 lines is exceeded (or whenever you explicitly request one, using
2454 @code{.eject}).
2455
2456 If you specify @var{lines} as @code{0}, no formfeeds are generated save
2457 those explicitly specified with @code{.eject}.
2458
2459 @node Quad
2460 @section @code{.quad @var{bignums}}
2461
2462 @cindex @code{quad} directive
2463 @code{.quad} expects zero or more bignums, separated by commas. For
2464 each bignum, it emits
2465 an 8-byte integer. If the bignum won't fit in 8
2466 bytes, it prints a warning message; and just takes the lowest order 8
2467 bytes of the bignum.@refill
2468 @cindex eight-byte integer
2469 @cindex integer, 8-byte
2470
2471 The term ``quad'' comes from contexts in which a ``word'' is two bytes;
2472 hence @emph{quad}-word for 8 bytes.
2473
2474 @node Sbttl
2475 @section @code{.sbttl "@var{subheading}"}
2476
2477 @cindex @code{sbttl} directive
2478 @cindex subtitles for listings
2479 @cindex listing control: subtitle
2480 Use @var{subheading} as the title (third line, immediately after the
2481 title line) when generating assembly listings.
2482
2483 This directive affects subsequent pages, as well as the current page if
2484 it appears within ten lines of the top of a page.
2485
2486 @node Scl
2487 @section @code{.scl @var{class}}
2488
2489 @cindex @code{scl} directive
2490 @cindex symbol storage class (COFF)
2491 @cindex COFF symbol storage class
2492 Set the storage-class value for a symbol. This directive may only be
2493 used inside a @code{.def}/@code{.endef} pair. Storage class may flag
2494 whether a symbol is static or external, or it may record further
2495 symbolic debugging information.
2496
2497 The @samp{.scl} directive is primarily associated with COFF output; when
2498 configured to generate @code{b.out} output format, @code{as} will
2499 accept this directive but ignore it.
2500
2501 @node Section
2502 @section @code{.section @var{name}, @var{subsection}}
2503
2504 @cindex @code{section} directive
2505 @cindex named section (COFF)
2506 @cindex COFF named section
2507 Assemble the following code into end of subsection numbered
2508 @var{subsection} in the COFF named section @var{name}. If you omit
2509 @var{subsection}, @code{as} uses subsection number zero.
2510 @samp{.section .text} is equivalent to the @code{.text} directive;
2511 @samp{.section .data} is equivalent to the @code{.data} directive.
2512
2513 @node Set
2514 @section @code{.set @var{symbol}, @var{expression}}
2515
2516 @cindex @code{set} directive
2517 @cindex symbol value, setting
2518 This directive sets the value of @var{symbol} to @var{expression}. This
2519 will change @var{symbol}'s value and type to conform to
2520 @var{expression}. If @var{symbol} was flagged as external, it remains
2521 flagged. (@xref{Symbol Attributes}.)
2522
2523 You may @code{.set} a symbol many times in the same assembly.
2524 If the expression's section is unknowable during pass 1, a second
2525 pass over the source program will be forced. The second pass is
2526 currently not implemented. @code{as} will abort with an error
2527 message if one is required.
2528
2529 If you @code{.set} a global symbol, the value stored in the object
2530 file is the last value stored into it.
2531
2532 @node Short
2533 @section @code{.short @var{expressions}}
2534
2535 @cindex @code{short} directive
2536 @code{.short} is the same as @samp{.word}. @xref{Word,,@code{.word}}.
2537
2538 @node Single
2539 @section @code{.single @var{flonums}}
2540
2541 @cindex @code{single} directive
2542 @cindex floating point numbers (single)
2543 This directive assembles zero or more flonums, separated by commas. It
2544 has the same effect as @code{.float}.
2545 The exact kind of floating point numbers emitted depends on how
2546 @code{as} is configured. @xref{Machine Dependent}.
2547
2548 @node Size
2549 @section @code{.size}
2550
2551 @cindex @code{size} directive
2552 This directive is generated by compilers to include auxiliary debugging
2553 information in the symbol table. It is only permitted inside
2554 @code{.def}/@code{.endef} pairs.
2555
2556 @samp{.size} is only meaningful when generating COFF format output; when
2557 @code{as} is generating @code{b.out}, it accepts this directive but
2558 ignores it.
2559
2560 @node Space
2561 @section @code{.space @var{size} , @var{fill}}
2562
2563 @cindex @code{space} directive
2564 @cindex filling memory
2565 This directive emits @var{size} bytes, each of value @var{fill}. Both
2566 @var{size} and @var{fill} are absolute expressions. If the comma
2567 and @var{fill} are omitted, @var{fill} is assumed to be zero.
2568
2569 On the AMD 29K, this directive is ignored; it is accepted for
2570 compatibility with other AMD 29K assemblers.
2571
2572 @quotation
2573 @emph{Warning:} In other versions of the GNU assembler, the directive
2574 @code{.space} has the effect of @code{.block} @xref{Machine Dependent}.
2575 @end quotation
2576
2577 @node Stab
2578 @section @code{.stabd, .stabn, .stabs}
2579
2580 @cindex symbolic debuggers, information for
2581 @cindex @code{stab@var{x}} directives
2582 There are three directives that begin @samp{.stab}.
2583 All emit symbols (@pxref{Symbols}), for use by symbolic debuggers.
2584 The symbols are not entered in the @code{as} hash table: they
2585 cannot be referenced elsewhere in the source file.
2586 Up to five fields are required:
2587 @table @var
2588 @item string
2589 This is the symbol's name. It may contain any character except @samp{\000},
2590 so is more general than ordinary symbol names. Some debuggers used to
2591 code arbitrarily complex structures into symbol names using this field.
2592 @item type
2593 An absolute expression. The symbol's type is set to the low 8
2594 bits of this expression.
2595 Any bit pattern is permitted, but @code{ld} and debuggers will choke on
2596 silly bit patterns.
2597 @item other
2598 An absolute expression.
2599 The symbol's ``other'' attribute is set to the low 8 bits of this expression.
2600 @item desc
2601 An absolute expression.
2602 The symbol's descriptor is set to the low 16 bits of this expression.
2603 @item value
2604 An absolute expression which becomes the symbol's value.
2605 @end table
2606
2607 If a warning is detected while reading a @code{.stabd}, @code{.stabn},
2608 or @code{.stabs} statement, the symbol has probably already been created
2609 and you will get a half-formed symbol in your object file. This is
2610 compatible with earlier assemblers!
2611
2612 @table @code
2613 @cindex @code{stabd} directive
2614 @item .stabd @var{type} , @var{other} , @var{desc}
2615
2616 The ``name'' of the symbol generated is not even an empty string.
2617 It is a null pointer, for compatibility. Older assemblers used a
2618 null pointer so they didn't waste space in object files with empty
2619 strings.
2620
2621 The symbol's value is set to the location counter,
2622 relocatably. When your program is linked, the value of this symbol
2623 will be where the location counter was when the @code{.stabd} was
2624 assembled.
2625
2626 @item .stabn @var{type} , @var{other} , @var{desc} , @var{value}
2627 @cindex @code{stabn} directive
2628 The name of the symbol is set to the empty string @code{""}.
2629
2630 @item .stabs @var{string} , @var{type} , @var{other} , @var{desc} , @var{value}
2631 @cindex @code{stabs} directive
2632 All five fields are specified.
2633 @end table
2634
2635 @node Tag
2636 @section @code{.tag @var{structname}}
2637
2638 @cindex COFF structure debugging
2639 @cindex structure debugging, COFF
2640 @cindex @code{tag} directive
2641 This directive is generated by compilers to include auxiliary debugging
2642 information in the symbol table. It is only permitted inside
2643 @code{.def}/@code{.endef} pairs. Tags are used to link structure
2644 definitions in the symbol table with instances of those structures.
2645
2646 @samp{.tag} is only used when generating COFF format output; when
2647 @code{as} is generating @code{b.out}, it accepts this directive but
2648 ignores it.
2649
2650 @node Text
2651 @section @code{.text @var{subsection}}
2652
2653 @cindex @code{text} directive
2654 Tells @code{as} to assemble the following statements onto the end of
2655 the text subsection numbered @var{subsection}, which is an absolute
2656 expression. If @var{subsection} is omitted, subsection number zero
2657 is used.
2658
2659 @node Title
2660 @section @code{.title "@var{heading}"}
2661
2662 @cindex @code{title} directive
2663 @cindex listing control: title line
2664 Use @var{heading} as the title (second line, immediately after the
2665 source file name and pagenumber) when generating assembly listings.
2666
2667 This directive affects subsequent pages, as well as the current page if
2668 it appears within ten lines of the top of a page.
2669
2670 @node Type
2671 @section @code{.type @var{int}}
2672
2673 @cindex COFF symbol type
2674 @cindex symbol type, COFF
2675 @cindex @code{type} directive
2676 This directive, permitted only within @code{.def}/@code{.endef} pairs,
2677 records the integer @var{int} as the type attribute of a symbol table entry.
2678
2679 @samp{.type} is associated only with COFF format output; when
2680 @code{as} is configured for @code{b.out} output, it accepts this
2681 directive but ignores it.
2682
2683 @node Val
2684 @section @code{.val @var{addr}}
2685
2686 @cindex @code{val} directive
2687 @cindex COFF value attribute
2688 @cindex value attribute, COFF
2689 This directive, permitted only within @code{.def}/@code{.endef} pairs,
2690 records the address @var{addr} as the value attribute of a symbol table
2691 entry.
2692
2693 @samp{.val} is used only for COFF output; when @code{as} is
2694 configured for @code{b.out}, it accepts this directive but ignores it.
2695
2696 @node Word
2697 @section @code{.word @var{expressions}}
2698
2699 @cindex @code{word} directive
2700 This directive expects zero or more @var{expressions}, of any section,
2701 separated by commas.
2702
2703 The size of the number emitted, and its byte order,
2704 depends on what kind of computer will run the program.
2705
2706 @c on amd29k, i960, sparc the "special treatment to support compilers" doesn't
2707 @c happen---32-bit addressability, period; no long/short jumps.
2708 @cindex difference tables altered
2709 @cindex altered difference tables
2710 @quotation
2711 @emph{Warning: Special Treatment to support Compilers}
2712 @end quotation
2713
2714 Machines with a 32-bit address space, but that do less than 32-bit
2715 addressing, require the following special treatment. If the machine of
2716 interest to you does 32-bit addressing (or doesn't require it;
2717 @pxref{Machine Dependent}), you can ignore this issue.
2718
2719 In order to assemble compiler output into something that will work,
2720 @code{as} will occasionlly do strange things to @samp{.word} directives.
2721 Directives of the form @samp{.word sym1-sym2} are often emitted by
2722 compilers as part of jump tables. Therefore, when @code{as} assembles a
2723 directive of the form @samp{.word sym1-sym2}, and the difference between
2724 @code{sym1} and @code{sym2} does not fit in 16 bits, @code{as} will
2725 create a @dfn{secondary jump table}, immediately before the next label.
2726 This secondary jump table will be preceded by a short-jump to the
2727 first byte after the secondary table. This short-jump prevents the flow
2728 of control from accidentally falling into the new table. Inside the
2729 table will be a long-jump to @code{sym2}. The original @samp{.word}
2730 will contain @code{sym1} minus the address of the long-jump to
2731 @code{sym2}.
2732
2733 If there were several occurrences of @samp{.word sym1-sym2} before the
2734 secondary jump table, all of them will be adjusted. If there was a
2735 @samp{.word sym3-sym4}, that also did not fit in sixteen bits, a
2736 long-jump to @code{sym4} will be included in the secondary jump table,
2737 and the @code{.word} directives will be adjusted to contain @code{sym3}
2738 minus the address of the long-jump to @code{sym4}; and so on, for as many
2739 entries in the original jump table as necessary.
2740
2741
2742 @node Deprecated
2743 @section Deprecated Directives
2744
2745 @cindex deprecated directives
2746 @cindex obsolescent directives
2747 One day these directives won't work.
2748 They are included for compatibility with older assemblers.
2749 @table @t
2750 @item .abort
2751 @item .app-file
2752 @item .line
2753 @end table
2754
2755 @node Machine Dependent
2756 @chapter Machine Dependent Features
2757
2758 @cindex machine dependencies
2759 The machine instruction sets are (almost by definition) different on
2760 each machine where @code{as} runs. Floating point representations
2761 vary as well, and @code{as} often supports a few additional
2762 directives or command-line options for compatibility with other
2763 assemblers on a particular platform. Finally, some versions of
2764 @code{as} support special pseudo-instructions for branch
2765 optimization.
2766
2767 This chapter discusses most of these differences, though it does not
2768 include details on any machine's instruction set. For details on that
2769 subject, see the hardware manufacturer's manual.
2770
2771 @menu
2772 * Vax-Dependent:: VAX Dependent Features
2773 * AMD29K-Dependent:: AMD 29K Dependent Features
2774 * H8/300-Dependent:: Hitachi H8/300 Dependent Features
2775 * i960-Dependent:: Intel 80960 Dependent Features
2776 * M68K-Dependent:: M680x0 Dependent Features
2777 * Sparc-Dependent:: SPARC Dependent Features
2778 * Z8000-Dependent:: Z8000 Dependent Features
2779 * i386-Dependent:: 80386 Dependent Features
2780 @end menu
2781
2782 @node Vax-Dependent
2783 @section VAX Dependent Features
2784
2785 @cindex VAX support
2786 @menu
2787 * Vax-Opts:: VAX Command-Line Options
2788 * VAX-float:: VAX Floating Point
2789 * VAX-directives:: Vax Machine Directives
2790 * VAX-opcodes:: VAX Opcodes
2791 * VAX-branch:: VAX Branch Improvement
2792 * VAX-operands:: VAX Operands
2793 * VAX-no:: Not Supported on VAX
2794 @end menu
2795
2796 @node Vax-Opts
2797 @subsection VAX Command-Line Options
2798
2799 @cindex command-line options ignored, VAX
2800 @cindex VAX command-line options ignored
2801 The Vax version of @code{as} accepts any of the following options,
2802 gives a warning message that the option was ignored and proceeds.
2803 These options are for compatibility with scripts designed for other
2804 people's assemblers.
2805
2806 @table @asis
2807 @item @kbd{-D} (Debug)
2808 @itemx @kbd{-S} (Symbol Table)
2809 @itemx @kbd{-T} (Token Trace)
2810 @cindex @code{-D}, ignored on VAX
2811 @cindex @code{-S}, ignored on VAX
2812 @cindex @code{-T}, ignored on VAX
2813 These are obsolete options used to debug old assemblers.
2814
2815 @item @kbd{-d} (Displacement size for JUMPs)
2816 @cindex @code{-d}, VAX option
2817 This option expects a number following the @kbd{-d}. Like options
2818 that expect filenames, the number may immediately follow the
2819 @kbd{-d} (old standard) or constitute the whole of the command line
2820 argument that follows @kbd{-d} (GNU standard).
2821
2822 @item @kbd{-V} (Virtualize Interpass Temporary File)
2823 @cindex @code{-V}, redundant on VAX
2824 Some other assemblers use a temporary file. This option
2825 commanded them to keep the information in active memory rather
2826 than in a disk file. @code{as} always does this, so this
2827 option is redundant.
2828
2829 @item @kbd{-J} (JUMPify Longer Branches)
2830 @cindex @code{-J}, ignored on VAX
2831 Many 32-bit computers permit a variety of branch instructions
2832 to do the same job. Some of these instructions are short (and
2833 fast) but have a limited range; others are long (and slow) but
2834 can branch anywhere in virtual memory. Often there are 3
2835 flavors of branch: short, medium and long. Some other
2836 assemblers would emit short and medium branches, unless told by
2837 this option to emit short and long branches.
2838
2839 @item @kbd{-t} (Temporary File Directory)
2840 @cindex @code{-t}, ignored on VAX
2841 Some other assemblers may use a temporary file, and this option
2842 takes a filename being the directory to site the temporary
2843 file. @code{as} does not use a temporary disk file, so this
2844 option makes no difference. @kbd{-t} needs exactly one
2845 filename.
2846 @end table
2847
2848 @cindex VMS (VAX) options
2849 @cindex options for VAX/VMS
2850 @cindex VAX/VMS options
2851 @cindex @code{-h} option, VAX/VMS
2852 @cindex @code{-+} option, VAX/VMS
2853 @cindex Vax-11 C compatibility
2854 @cindex symbols with lowercase, VAX/VMS
2855 @c FIXME! look into "I think" below, correct if needed, delete.
2856 The Vax version of the assembler accepts two options when
2857 compiled for VMS. They are @kbd{-h}, and @kbd{-+}. The
2858 @kbd{-h} option prevents @code{as} from modifying the
2859 symbol-table entries for symbols that contain lowercase
2860 characters (I think). The @kbd{-+} option causes @code{as} to
2861 print warning messages if the FILENAME part of the object file,
2862 or any symbol name is larger than 31 characters. The @kbd{-+}
2863 option also insertes some code following the @samp{_main}
2864 symbol so that the object file will be compatible with Vax-11
2865 "C".
2866
2867 @node VAX-float
2868 @subsection VAX Floating Point
2869
2870 @cindex VAX floating point
2871 @cindex floating point, VAX
2872 Conversion of flonums to floating point is correct, and
2873 compatible with previous assemblers. Rounding is
2874 towards zero if the remainder is exactly half the least significant bit.
2875
2876 @code{D}, @code{F}, @code{G} and @code{H} floating point formats
2877 are understood.
2878
2879 Immediate floating literals (@emph{e.g.} @samp{S`$6.9})
2880 are rendered correctly. Again, rounding is towards zero in the
2881 boundary case.
2882
2883 @cindex @code{float} directive, VAX
2884 @cindex @code{double} directive, VAX
2885 The @code{.float} directive produces @code{f} format numbers.
2886 The @code{.double} directive produces @code{d} format numbers.
2887
2888 @node VAX-directives
2889 @subsection Vax Machine Directives
2890
2891 @cindex machine directives, VAX
2892 @cindex VAX machine directives
2893 The Vax version of the assembler supports four directives for
2894 generating Vax floating point constants. They are described in the
2895 table below.
2896
2897 @cindex wide floating point directives, VAX
2898 @table @code
2899 @item .dfloat
2900 @cindex @code{dfloat} directive, VAX
2901 This expects zero or more flonums, separated by commas, and
2902 assembles Vax @code{d} format 64-bit floating point constants.
2903
2904 @item .ffloat
2905 @cindex @code{ffloat} directive, VAX
2906 This expects zero or more flonums, separated by commas, and
2907 assembles Vax @code{f} format 32-bit floating point constants.
2908
2909 @item .gfloat
2910 @cindex @code{gfloat} directive, VAX
2911 This expects zero or more flonums, separated by commas, and
2912 assembles Vax @code{g} format 64-bit floating point constants.
2913
2914 @item .hfloat
2915 @cindex @code{hfloat} directive, VAX
2916 This expects zero or more flonums, separated by commas, and
2917 assembles Vax @code{h} format 128-bit floating point constants.
2918
2919 @end table
2920
2921 @node VAX-opcodes
2922 @subsection VAX Opcodes
2923
2924 @cindex VAX opcode mnemonics
2925 @cindex opcode mnemonics, VAX
2926 @cindex mnemonics for opcodes, VAX
2927 All DEC mnemonics are supported. Beware that @code{case@dots{}}
2928 instructions have exactly 3 operands. The dispatch table that
2929 follows the @code{case@dots{}} instruction should be made with
2930 @code{.word} statements. This is compatible with all unix
2931 assemblers we know of.
2932
2933 @node VAX-branch
2934 @subsection VAX Branch Improvement
2935
2936 @cindex VAX branch improvement
2937 @cindex branch improvement, VAX
2938 @cindex pseudo-ops for branch, VAX
2939 Certain pseudo opcodes are permitted. They are for branch
2940 instructions. They expand to the shortest branch instruction that
2941 will reach the target. Generally these mnemonics are made by
2942 substituting @samp{j} for @samp{b} at the start of a DEC mnemonic.
2943 This feature is included both for compatibility and to help
2944 compilers. If you don't need this feature, don't use these
2945 opcodes. Here are the mnemonics, and the code they can expand into.
2946
2947 @table @code
2948 @item jbsb
2949 @samp{Jsb} is already an instruction mnemonic, so we chose @samp{jbsb}.
2950 @table @asis
2951 @item (byte displacement)
2952 @kbd{bsbb @dots{}}
2953 @item (word displacement)
2954 @kbd{bsbw @dots{}}
2955 @item (long displacement)
2956 @kbd{jsb @dots{}}
2957 @end table
2958 @item jbr
2959 @itemx jr
2960 Unconditional branch.
2961 @table @asis
2962 @item (byte displacement)
2963 @kbd{brb @dots{}}
2964 @item (word displacement)
2965 @kbd{brw @dots{}}
2966 @item (long displacement)
2967 @kbd{jmp @dots{}}
2968 @end table
2969 @item j@var{COND}
2970 @var{COND} may be any one of the conditional branches
2971 @code{neq}, @code{nequ}, @code{eql}, @code{eqlu}, @code{gtr},
2972 @code{geq}, @code{lss}, @code{gtru}, @code{lequ}, @code{vc}, @code{vs},
2973 @code{gequ}, @code{cc}, @code{lssu}, @code{cs}.
2974 @var{COND} may also be one of the bit tests
2975 @code{bs}, @code{bc}, @code{bss}, @code{bcs}, @code{bsc}, @code{bcc},
2976 @code{bssi}, @code{bcci}, @code{lbs}, @code{lbc}.
2977 @var{NOTCOND} is the opposite condition to @var{COND}.
2978 @table @asis
2979 @item (byte displacement)
2980 @kbd{b@var{COND} @dots{}}
2981 @item (word displacement)
2982 @kbd{b@var{NOTCOND} foo ; brw @dots{} ; foo:}
2983 @item (long displacement)
2984 @kbd{b@var{NOTCOND} foo ; jmp @dots{} ; foo:}
2985 @end table
2986 @item jacb@var{X}
2987 @var{X} may be one of @code{b d f g h l w}.
2988 @table @asis
2989 @item (word displacement)
2990 @kbd{@var{OPCODE} @dots{}}
2991 @item (long displacement)
2992 @example
2993 @var{OPCODE} @dots{}, foo ;
2994 brb bar ;
2995 foo: jmp @dots{} ;
2996 bar:
2997 @end example
2998 @end table
2999 @item jaob@var{YYY}
3000 @var{YYY} may be one of @code{lss leq}.
3001 @item jsob@var{ZZZ}
3002 @var{ZZZ} may be one of @code{geq gtr}.
3003 @table @asis
3004 @item (byte displacement)
3005 @kbd{@var{OPCODE} @dots{}}
3006 @item (word displacement)
3007 @example
3008 @var{OPCODE} @dots{}, foo ;
3009 brb bar ;
3010 foo: brw @var{destination} ;
3011 bar:
3012 @end example
3013 @item (long displacement)
3014 @example
3015 @var{OPCODE} @dots{}, foo ;
3016 brb bar ;
3017 foo: jmp @var{destination} ;
3018 bar:
3019 @end example
3020 @end table
3021 @item aobleq
3022 @itemx aoblss
3023 @itemx sobgeq
3024 @itemx sobgtr
3025 @table @asis
3026 @item (byte displacement)
3027 @kbd{@var{OPCODE} @dots{}}
3028 @item (word displacement)
3029 @example
3030 @var{OPCODE} @dots{}, foo ;
3031 brb bar ;
3032 foo: brw @var{destination} ;
3033 bar:
3034 @end example
3035 @item (long displacement)
3036 @example
3037 @var{OPCODE} @dots{}, foo ;
3038 brb bar ;
3039 foo: jmp @var{destination} ;
3040 bar:
3041 @end example
3042 @end table
3043 @end table
3044
3045 @node VAX-operands
3046 @subsection VAX Operands
3047
3048 @cindex VAX operand notation
3049 @cindex operand notation, VAX
3050 @cindex immediate character, VAX
3051 @cindex VAX immediate character
3052 The immediate character is @samp{$} for Unix compatibility, not
3053 @samp{#} as DEC writes it.
3054
3055 @cindex indirect character, VAX
3056 @cindex VAX indirect character
3057 The indirect character is @samp{*} for Unix compatibility, not
3058 @samp{@@} as DEC writes it.
3059
3060 @cindex displacement sizing character, VAX
3061 @cindex VAX displacement sizing character
3062 The displacement sizing character is @samp{`} (an accent grave) for
3063 Unix compatibility, not @samp{^} as DEC writes it. The letter
3064 preceding @samp{`} may have either case. @samp{G} is not
3065 understood, but all other letters (@code{b i l s w}) are understood.
3066
3067 @cindex register names, VAX
3068 @cindex VAX register names
3069 Register names understood are @code{r0 r1 r2 @dots{} r15 ap fp sp
3070 pc}. Any case of letters will do.
3071
3072 For instance
3073 @smallexample
3074 tstb *w`$4(r5)
3075 @end smallexample
3076
3077 Any expression is permitted in an operand. Operands are comma
3078 separated.
3079
3080 @c There is some bug to do with recognizing expressions
3081 @c in operands, but I forget what it is. It is
3082 @c a syntax clash because () is used as an address mode
3083 @c and to encapsulate sub-expressions.
3084
3085 @node VAX-no
3086 @subsection Not Supported on VAX
3087
3088 @cindex VAX bitfields not supported
3089 @cindex bitfields, not supported on VAX
3090 Vax bit fields can not be assembled with @code{as}. Someone
3091 can add the required code if they really need it.
3092
3093 @node AMD29K-Dependent
3094 @section AMD 29K Dependent Features
3095
3096 @cindex AMD 29K support
3097 @cindex 29K support
3098 @menu
3099 * AMD29K Options:: Options
3100 * AMD29K Syntax:: Syntax
3101 * AMD29K Floating Point:: Floating Point
3102 * AMD29K Directives:: AMD 29K Machine Directives
3103 * AMD29K Opcodes:: Opcodes
3104 @end menu
3105
3106 @node AMD29K Options
3107 @subsection Options
3108 @cindex AMD 29K options (none)
3109 @cindex options for AMD29K (none)
3110 @code{as} has no additional command-line options for the AMD
3111 29K family.
3112
3113 @node AMD29K Syntax
3114 @subsection Syntax
3115 @menu
3116 * AMD29K-Chars:: Special Characters
3117 * AMD29K-Regs:: Register Names
3118 @end menu
3119
3120 @node AMD29K-Chars
3121 @subsubsection Special Characters
3122
3123 @cindex line comment character, AMD 29K
3124 @cindex AMD 29K line comment character
3125 @samp{;} is the line comment character.
3126
3127 @cindex line separator, AMD 29K
3128 @cindex AMD 29K line separator
3129 @cindex statement separator, AMD 29K
3130 @cindex AMD 29K statement separator
3131 @samp{@@} can be used instead of a newline to separate statements.
3132
3133 @cindex identifiers, AMD 29K
3134 @cindex AMD 29K identifiers
3135 The character @samp{?} is permitted in identifiers (but may not begin
3136 an identifier).
3137
3138 @node AMD29K-Regs
3139 @subsubsection Register Names
3140
3141 @cindex AMD 29K register names
3142 @cindex register names, AMD 29K
3143 General-purpose registers are represented by predefined symbols of the
3144 form @samp{GR@var{nnn}} (for global registers) or @samp{LR@var{nnn}}
3145 (for local registers), where @var{nnn} represents a number between
3146 @code{0} and @code{127}, written with no leading zeros. The leading
3147 letters may be in either upper or lower case; for example, @samp{gr13}
3148 and @samp{LR7} are both valid register names.
3149
3150 You may also refer to general-purpose registers by specifying the
3151 register number as the result of an expression (prefixed with @samp{%%}
3152 to flag the expression as a register number):
3153 @smallexample
3154 %%@var{expression}
3155 @end smallexample
3156 @noindent
3157 ---where @var{expression} must be an absolute expression evaluating to a
3158 number between @code{0} and @code{255}. The range [0, 127] refers to
3159 global registers, and the range [128, 255] to local registers.
3160
3161 @cindex special purpose registers, AMD 29K
3162 @cindex AMD 29K special purpose registers
3163 @cindex protected registers, AMD 29K
3164 @cindex AMD 29K protected registers
3165 In addition, @code{as} understands the following protected
3166 special-purpose register names for the AMD 29K family:
3167
3168 @smallexample
3169 vab chd pc0
3170 ops chc pc1
3171 cps rbp pc2
3172 cfg tmc mmu
3173 cha tmr lru
3174 @end smallexample
3175
3176 These unprotected special-purpose register names are also recognized:
3177 @smallexample
3178 ipc alu fpe
3179 ipa bp inte
3180 ipb fc fps
3181 q cr exop
3182 @end smallexample
3183
3184 @node AMD29K Floating Point
3185 @subsection Floating Point
3186
3187 @cindex floating point, AMD 29K (@sc{ieee})
3188 @cindex AMD 29K floating point (@sc{ieee})
3189 The AMD 29K family uses @sc{ieee} floating-point numbers.
3190
3191 @node AMD29K Directives
3192 @subsection AMD 29K Machine Directives
3193
3194 @cindex machine directives, AMD 29K
3195 @cindex AMD 29K machine directives
3196 @table @code
3197 @item .block @var{size} , @var{fill}
3198 @cindex @code{block} directive, AMD 29K
3199 This directive emits @var{size} bytes, each of value @var{fill}. Both
3200 @var{size} and @var{fill} are absolute expressions. If the comma
3201 and @var{fill} are omitted, @var{fill} is assumed to be zero.
3202
3203 In other versions of the GNU assembler, this directive is called
3204 @samp{.space}.
3205 @end table
3206
3207 @table @code
3208 @item .cputype
3209 @cindex @code{cputype} directive, AMD 29K
3210 This directive is ignored; it is accepted for compatibility with other
3211 AMD 29K assemblers.
3212
3213 @item .file
3214 @cindex @code{file} directive, AMD 29K
3215 This directive is ignored; it is accepted for compatibility with other
3216 AMD 29K assemblers.
3217
3218 @quotation
3219 @emph{Warning:} in other versions of the GNU assembler, @code{.file} is
3220 used for the directive called @code{.app-file} in the AMD 29K support.
3221 @end quotation
3222
3223 @item .line
3224 @cindex @code{line} directive, AMD 29K
3225 This directive is ignored; it is accepted for compatibility with other
3226 AMD 29K assemblers.
3227
3228 @ignore
3229 @c since we're ignoring .lsym...
3230 @item .reg @var{symbol}, @var{expression}
3231 @cindex @code{reg} directive, AMD 29K
3232 @code{.reg} has the same effect as @code{.lsym}; @pxref{Lsym,,@code{.lsym}}.
3233 @end ignore
3234
3235 @item .sect
3236 @cindex @code{sect} directive, AMD 29K
3237 This directive is ignored; it is accepted for compatibility with other
3238 AMD 29K assemblers.
3239
3240 @item .use @var{section name}
3241 @cindex @code{use} directive, AMD 29K
3242 Establishes the section and subsection for the following code;
3243 @var{section name} may be one of @code{.text}, @code{.data},
3244 @code{.data1}, or @code{.lit}. With one of the first three @var{section
3245 name} options, @samp{.use} is equivalent to the machine directive
3246 @var{section name}; the remaining case, @samp{.use .lit}, is the same as
3247 @samp{.data 200}.
3248 @end table
3249
3250 @node AMD29K Opcodes
3251 @subsection Opcodes
3252
3253 @cindex AMD 29K opcodes
3254 @cindex opcodes for AMD 29K
3255 @code{as} implements all the standard AMD 29K opcodes. No
3256 additional pseudo-instructions are needed on this family.
3257
3258 For information on the 29K machine instruction set, see @cite{Am29000
3259 User's Manual}, Advanced Micro Devices, Inc.
3260
3261 @node H8/300-Dependent
3262 @section H8/300 Dependent Features
3263
3264 @cindex H8/300 support
3265 @menu
3266 * H8/300 Options:: Options
3267 * H8/300 Syntax:: Syntax
3268 * H8/300 Floating Point:: Floating Point
3269 * H8/300 Directives:: H8/300 Machine Directives
3270 * H8/300 Opcodes:: Opcodes
3271 @end menu
3272
3273 @node H8/300 Options
3274 @subsection Options
3275
3276 @cindex H8/300 options (none)
3277 @cindex options, H8/300 (none)
3278 @code{as} has no additional command-line options for the Hitachi
3279 H8/300 family.
3280
3281 @node H8/300 Syntax
3282 @subsection Syntax
3283 @menu
3284 * H8/300-Chars:: Special Characters
3285 * H8/300-Regs:: Register Names
3286 * H8/300-Addressing:: Addressing Modes
3287 @end menu
3288
3289 @node H8/300-Chars
3290 @subsubsection Special Characters
3291
3292 @cindex line comment character, H8/300
3293 @cindex H8/300 line comment character
3294 @samp{;} is the line comment character.
3295
3296 @cindex line separator, H8/300
3297 @cindex statement separator, H8/300
3298 @cindex H8/300 line separator
3299 @samp{$} can be used instead of a newline to separate statements.
3300 Therefore @emph{you may not use @samp{$} in symbol names} on the H8/300.
3301
3302 @node H8/300-Regs
3303 @subsubsection Register Names
3304
3305 @cindex H8/300 registers
3306 @cindex registers, H8/300
3307 You can use predefined symbols of the form @samp{r@var{n}h} and
3308 @samp{r@var{n}l} to refer to the H8/300 registers as sixteen 8-bit
3309 general-purpose registers. @var{n} is a digit from @samp{0} to
3310 @samp{7}); for instance, both @samp{r0h} and @samp{r7l} are valid
3311 register names.
3312
3313 You can also use the eight predefined symbols @samp{r@var{n}} to refer
3314 to the H8/300 registers as 16-bit registers (you must use this form for
3315 addressing).
3316
3317 The two control registers are called @code{pc} (program counter; a
3318 16-bit register) and @code{ccr} (condition code register; an 8-bit
3319 register). @code{r7} is used as the stack pointer, and can also be
3320 called @code{sp}.
3321
3322 @node H8/300-Addressing
3323 @subsubsection Addressing Modes
3324
3325 @cindex addressing modes, H8/300
3326 @cindex H8/300 addressing modes
3327 as understands the following addressing modes for the H8/300:
3328 @table @code
3329 @item r@var{n}
3330 Register direct
3331
3332 @item @@r@var{n}
3333 Register indirect
3334
3335 @item @@(@var{d}, r@var{n})
3336 @itemx @@(@var{d}:16, r@var{n})
3337 Register indirect: 16-bit displacement @var{d} from register @var{n}.
3338 (You may specify the @samp{:16} for clarity if you wish, but it is not
3339 required and has no effect.)
3340
3341 @item @@r@var{n}+
3342 Register indirect with post-increment
3343
3344 @item @@-r@var{n}
3345 Register indirect with pre-decrement
3346
3347 @item @code{@@}@var{aa}
3348 @itemx @code{@@}@var{aa}:8
3349 @itemx @code{@@}@var{aa}:16
3350 Absolute address @code{aa}. You may specify the @samp{:8} or @samp{:16}
3351 for clarity, if you wish; but @code{as} neither requires this nor
3352 uses it---the address size required is taken from context.
3353
3354 @item #@var{xx}
3355 @itemx #@var{xx}:8
3356 @itemx #@var{xx}:16
3357 Immediate data @var{xx}. You may specify the @samp{:8} or @samp{:16}
3358 for clarity, if you wish; but @code{as} neither requires this nor
3359 uses it---the data size required is taken from context.
3360
3361 @item @code{@@}@code{@@}@var{aa}
3362 @itemx @code{@@}@code{@@}@var{aa}:8
3363 Memory indirect. You may specify the @samp{:8} for clarity, if you
3364 wish; but @code{as} neither requires this nor uses it.
3365 @end table
3366
3367 @node H8/300 Floating Point
3368 @subsection Floating Point
3369
3370 @cindex floating point, H8/300 (@sc{ieee})
3371 @cindex H8/300 floating point (@sc{ieee})
3372 The H8/300 family uses @sc{ieee} floating-point numbers.
3373
3374 @node H8/300 Directives
3375 @subsection H8/300 Machine Directives
3376
3377 @cindex H8/300 machine directives (none)
3378 @cindex machine directives, H8/300 (none)
3379 @cindex @code{word} directive, H8/300
3380 @cindex @code{int} directive, H8/300
3381 @code{as} has no machine-dependent directives for the H8/300.
3382 However, on this platform the @samp{.int} and @samp{.word} directives
3383 generate 16-bit numbers.
3384
3385 @node H8/300 Opcodes
3386 @subsection Opcodes
3387
3388 @cindex H8/300 opcode summary
3389 @cindex opcode summary, H8/300
3390 @cindex mnemonics, H8/300
3391 @cindex instruction summary, H8/300
3392 For detailed information on the H8/300 machine instruction set, see
3393 @cite{H8/300 Series Programming Manual} (Hitachi ADE--602--025).
3394
3395 @code{as} implements all the standard H8/300 opcodes. No additional
3396 pseudo-instructions are needed on this family.
3397
3398 The following table summarizes the opcodes and their arguments:
3399 @c kluge due to lack of group outside example
3400 @page
3401 @smallexample
3402 @group
3403 Rs @r{source register}
3404 Rd @r{destination register}
3405 imm @r{immediate data}
3406 x:3 @r{a bit (as a number between 0 and 7)}
3407 d:8 @r{eight bit displacement from @code{pc}}
3408 d:16 @r{sixteen bit displacement from @code{Rs}}
3409
3410 add.b Rs,Rd biand #x:3,Rd
3411 add.b #imm:8,Rd biand #x:3,@@Rd
3412 add.w Rs,Rd biand #x:3,@@aa:8
3413 adds #1,Rd bild #x:3,Rd
3414 adds #2,Rd bild #x:3,@@Rd
3415 addx #imm:8,Rd bild #x:3,@@aa:8
3416 addx Rs,Rd bior #x:3,Rd
3417 and #imm:8,Rd bior #x:3,@@Rd
3418 and Rs,Rd bior #x:3,@@aa:8
3419 andc #imm:8,ccr bist #x:3,Rd
3420 band #x:3,Rd bist #x:3,@@Rd
3421 band #x:3,@@Rd bist #x:3,@@aa:8
3422 bra d:8 bixor #x:3,Rd
3423 bt d:8 bixor #x:3,@@Rd
3424 brn d:8 bixor #x:3,@@aa:8
3425 bf d:8 bld #x:3,Rd
3426 bhi d:8 bld #x:3,@@Rd
3427 bls d:8 bld #x:3,@@aa:8
3428 bcc d:8 bnot #x:3,Rd
3429 bhs d:8 bnot #x:3,@@Rd
3430 bcs d:8 bnot #x:3,@@aa:8
3431 blo d:8 bnot Rs,Rd
3432 bne d:8 bnot Rs,@@Rd
3433 beq d:8 bnot Rs,@@aa:8
3434 bvc d:8 bor #x:3,Rd
3435 bvs d:8 bor #x:3,@@Rd
3436 bpl d:8 bor #x:3,@@aa:8
3437 bmi d:8 bset #x:3,@@Rd
3438 bge d:8 bset #x:3,@@aa:8
3439 blt d:8 bset Rs,Rd
3440 bgt d:8 bset Rs,@@Rd
3441 ble d:8 bset Rs,@@aa:8
3442 bclr #x:3,Rd bsr d:8
3443 bclr #x:3,@@Rd bst #x:3,Rd
3444 bclr #x:3,@@aa:8 bst #x:3,@@Rd
3445 bclr Rs,Rd bst #x:3,@@aa:8
3446 bclr Rs,@@Rd btst #x:3,Rd
3447 @end group
3448 @group
3449 btst #x:3,@@Rd mov.w @@(d:16, Rs),Rd
3450 btst #x:3,@@aa:8 mov.w @@Rs+,Rd
3451 btst Rs,Rd mov.w @@aa:16,Rd
3452 btst Rs,@@Rd mov.w Rs,@@Rd
3453 btst Rs,@@aa:8 mov.w Rs,@@(d:16, Rd)
3454 bxor #x:3,Rd mov.w Rs,@@-Rd
3455 bxor #x:3,@@Rd mov.w Rs,@@aa:16
3456 bxor #x:3,@@aa:8 movfpe @@aa:16,Rd
3457 cmp.b #imm:8,Rd movtpe Rs,@@aa:16
3458 cmp.b Rs,Rd mulxu Rs,Rd
3459 cmp.w Rs,Rd neg Rs
3460 daa Rs nop
3461 das Rs not Rs
3462 dec Rs or #imm:8,Rd
3463 divxu Rs,Rd or Rs,Rd
3464 eepmov orc #imm:8,ccr
3465 inc Rs pop Rs
3466 jmp @@Rs push Rs
3467 jmp @@aa:16 rotl Rs
3468 jmp @@@@aa rotr Rs
3469 jsr @@Rs rotxl Rs
3470 jsr @@aa:16 rotxr Rs
3471 jsr @@@@aa:8 rte
3472 ldc #imm:8,ccr rts
3473 ldc Rs,ccr shal Rs
3474 mov.b Rs,Rd shar Rs
3475 mov.b #imm:8,Rd shll Rs
3476 mov.b @@Rs,Rd shlr Rs
3477 mov.b @@(d:16, Rs),Rd sleep
3478 mov.b @@Rs+,Rd stc ccr,Rd
3479 mov.b @@aa:16,Rd sub.b Rs,Rd
3480 mov.b @@aa:8,Rd sub.w Rs,Rd
3481 mov.b Rs,@@Rd subs #1,Rd
3482 mov.b Rs,@@(d:16, Rd) subs #2,Rd
3483 mov.b Rs,@@-Rd subx #imm:8,Rd
3484 mov.b Rs,@@aa:16 subx Rs,Rd
3485 mov.b Rs,@@aa:8 xor #imm:8,Rd
3486 mov.w Rs,Rd xor Rs,Rd
3487 mov.w #imm:16,Rd xorc #imm:8,ccr
3488 mov.w @@Rs,Rd
3489 @end group
3490 @end smallexample
3491
3492 @cindex size suffixes, H8/300
3493 @cindex H8/300 size suffixes
3494 Four H8/300 instructions (@code{add}, @code{cmp}, @code{mov},
3495 @code{sub}) are defined with variants using the suffixes @samp{.b} and
3496 @samp{.w} to specify the size of a memory operand. @code{as}
3497 supports these suffixes, but does not require them; since one of the
3498 operands is always a register, @code{as} can deduce the correct size.
3499
3500 For example, since @code{r0} refers to a 16-bit register,
3501 @example
3502 mov r0,@@foo
3503 @exdent is equivalent to
3504 mov.w r0,@@foo
3505 @end example
3506
3507 If you use the size suffixes, @code{as} will issue a warning if
3508 there's a mismatch between the suffix and the register size.
3509
3510 @node i960-Dependent
3511 @section Intel 80960 Dependent Features
3512
3513 @cindex i960 support
3514 @menu
3515 * Options-i960:: i960 Command-line Options
3516 * Floating Point-i960:: Floating Point
3517 * Directives-i960:: i960 Machine Directives
3518 * Opcodes for i960:: i960 Opcodes
3519 @end menu
3520
3521 @c FIXME! Add Syntax sec with discussion of bitfields here, at least so
3522 @c long as they're not turned on for other machines than 960.
3523
3524 @node Options-i960
3525
3526 @subsection i960 Command-line Options
3527
3528 @cindex i960 options
3529 @cindex options, i960
3530 @table @code
3531
3532 @item -ACA | -ACA_A | -ACB | -ACC | -AKA | -AKB | -AKC | -AMC
3533 @cindex i960 architecture options
3534 @cindex architecture options, i960
3535 @cindex @code{-A} options, i960
3536 Select the 80960 architecture. Instructions or features not supported
3537 by the selected architecture cause fatal errors.
3538
3539 @samp{-ACA} is equivalent to @samp{-ACA_A}; @samp{-AKC} is equivalent to
3540 @samp{-AMC}. Synonyms are provided for compatibility with other tools.
3541
3542 If none of these options is specified, @code{as} will generate code for any
3543 instruction or feature that is supported by @emph{some} version of the
3544 960 (even if this means mixing architectures!). In principle,
3545 @code{as} will attempt to deduce the minimal sufficient processor
3546 type if none is specified; depending on the object code format, the
3547 processor type may be recorded in the object file. If it is critical
3548 that the @code{as} output match a specific architecture, specify that
3549 architecture explicitly.
3550
3551 @item -b
3552 @cindex @code{-b} option, i960
3553 @cindex branch recording, i960
3554 @cindex i960 branch recording
3555 Add code to collect information about conditional branches taken, for
3556 later optimization using branch prediction bits. (The conditional branch
3557 instructions have branch prediction bits in the CA, CB, and CC
3558 architectures.) If @var{BR} represents a conditional branch instruction,
3559 the following represents the code generated by the assembler when
3560 @samp{-b} is specified:
3561
3562 @smallexample
3563 call @var{increment routine}
3564 .word 0 # pre-counter
3565 Label: @var{BR}
3566 call @var{increment routine}
3567 .word 0 # post-counter
3568 @end smallexample
3569
3570 The counter following a branch records the number of times that branch
3571 was @emph{not} taken; the differenc between the two counters is the
3572 number of times the branch @emph{was} taken.
3573
3574 @cindex @code{gbr960}, i960 postprocessor
3575 @cindex branch statistics table, i960
3576 A table of every such @code{Label} is also generated, so that the
3577 external postprocessor @code{gbr960} (supplied by Intel) can locate all
3578 the counters. This table is always labelled @samp{__BRANCH_TABLE__};
3579 this is a local symbol to permit collecting statistics for many separate
3580 object files. The table is word aligned, and begins with a two-word
3581 header. The first word, initialized to 0, is used in maintaining linked
3582 lists of branch tables. The second word is a count of the number of
3583 entries in the table, which follow immediately: each is a word, pointing
3584 to one of the labels illustrated above.
3585
3586 @c TEXI2ROFF-KILL
3587 @ifinfo
3588 @c END TEXI2ROFF-KILL
3589 @example
3590 +------------+------------+------------+ ... +------------+
3591 | | | | | |
3592 | *NEXT | COUNT: N | *BRLAB 1 | | *BRLAB N |
3593 | | | | | |
3594 +------------+------------+------------+ ... +------------+
3595
3596 __BRANCH_TABLE__ layout
3597 @end example
3598 @c TEXI2ROFF-KILL
3599 @end ifinfo
3600 @tex
3601 \vskip 1pc
3602 \line{\leftskip=0pt\hskip\tableindent
3603 \boxit{2cm}{\tt *NEXT}\boxit{2cm}{\tt COUNT: \it N}\boxit{2cm}{\tt
3604 *BRLAB 1}\ibox{1cm}{\quad\dots}\boxit{2cm}{\tt *BRLAB \it N}\hfil}
3605 \centerline{\it {\tt \_\_BRANCH\_TABLE\_\_} layout}
3606 @end tex
3607 @c END TEXI2ROFF-KILL
3608
3609 The first word of the header is used to locate multiple branch tables,
3610 since each object file may contain one. Normally the links are
3611 maintained with a call to an initialization routine, placed at the
3612 beginning of each function in the file. The GNU C compiler will
3613 generate these calls automatically when you give it a @samp{-b} option.
3614 For further details, see the documentation of @samp{gbr960}.
3615
3616 @item -norelax
3617 @cindex @code{-norelax} option, i960
3618 Normally, Compare-and-Branch instructions with targets that require
3619 displacements greater than 13 bits (or that have external targets) are
3620 replaced with the corresponding compare (or @samp{chkbit}) and branch
3621 instructions. You can use the @samp{-norelax} option to specify that
3622 @code{as} should generate errors instead, if the target displacement
3623 is larger than 13 bits.
3624
3625 This option does not affect the Compare-and-Jump instructions; the code
3626 emitted for them is @emph{always} adjusted when necessary (depending on
3627 displacement size), regardless of whether you use @samp{-norelax}.
3628 @end table
3629
3630 @node Floating Point-i960
3631 @subsection Floating Point
3632
3633 @cindex floating point, i960 (@sc{ieee})
3634 @cindex i960 floating point (@sc{ieee})
3635 @code{as} generates @sc{ieee} floating-point numbers for the directives
3636 @samp{.float}, @samp{.double}, @samp{.extended}, and @samp{.single}.
3637
3638 @node Directives-i960
3639 @subsection i960 Machine Directives
3640
3641 @cindex machine directives, i960
3642 @cindex i960 machine directives
3643
3644 @table @code
3645 @cindex @code{bss} directive, i960
3646 @item .bss @var{symbol}, @var{length}, @var{align}
3647 Reserve @var{length} bytes in the bss section for a local @var{symbol},
3648 aligned to the power of two specified by @var{align}. @var{length} and
3649 @var{align} must be positive absolute expressions. This directive
3650 differs from @samp{.lcomm} only in that it permits you to specify
3651 an alignment. @xref{Lcomm,,@code{.lcomm}}.
3652 @end table
3653
3654 @table @code
3655 @item .extended @var{flonums}
3656 @cindex @code{extended} directive, i960
3657 @code{.extended} expects zero or more flonums, separated by commas; for
3658 each flonum, @samp{.extended} emits an @sc{ieee} extended-format (80-bit)
3659 floating-point number.
3660
3661 @item .leafproc @var{call-lab}, @var{bal-lab}
3662 @cindex @code{leafproc} directive, i960
3663 You can use the @samp{.leafproc} directive in conjunction with the
3664 optimized @code{callj} instruction to enable faster calls of leaf
3665 procedures. If a procedure is known to call no other procedures, you
3666 may define an entry point that skips procedure prolog code (and that does
3667 not depend on system-supplied saved context), and declare it as the
3668 @var{bal-lab} using @samp{.leafproc}. If the procedure also has an
3669 entry point that goes through the normal prolog, you can specify that
3670 entry point as @var{call-lab}.
3671
3672 A @samp{.leafproc} declaration is meant for use in conjunction with the
3673 optimized call instruction @samp{callj}; the directive records the data
3674 needed later to choose between converting the @samp{callj} into a
3675 @code{bal} or a @code{call}.
3676
3677 @var{call-lab} is optional; if only one argument is present, or if the
3678 two arguments are identical, the single argument is assumed to be the
3679 @code{bal} entry point.
3680
3681 @item .sysproc @var{name}, @var{index}
3682 @cindex @code{sysproc} directive, i960
3683 The @samp{.sysproc} directive defines a name for a system procedure.
3684 After you define it using @samp{.sysproc}, you can use @var{name} to
3685 refer to the system procedure identified by @var{index} when calling
3686 procedures with the optimized call instruction @samp{callj}.
3687
3688 Both arguments are required; @var{index} must be between 0 and 31
3689 (inclusive).
3690 @end table
3691
3692 @node Opcodes for i960
3693 @subsection i960 Opcodes
3694
3695 @cindex opcodes, i960
3696 @cindex i960 opcodes
3697 All Intel 960 machine instructions are supported;
3698 @pxref{Options-i960,,i960 Command-line Options} for a discussion of
3699 selecting the instruction subset for a particular 960
3700 architecture.@refill
3701
3702 Some opcodes are processed beyond simply emitting a single corresponding
3703 instruction: @samp{callj}, and Compare-and-Branch or Compare-and-Jump
3704 instructions with target displacements larger than 13 bits.
3705
3706 @menu
3707 * callj-i960:: @code{callj}
3708 * Compare-and-branch-i960:: Compare-and-Branch
3709 @end menu
3710
3711 @node callj-i960
3712 @subsubsection @code{callj}
3713
3714 @cindex @code{callj}, i960 pseudo-opcode
3715 @cindex i960 @code{callj} pseudo-opcode
3716 You can write @code{callj} to have the assembler or the linker determine
3717 the most appropriate form of subroutine call: @samp{call},
3718 @samp{bal}, or @samp{calls}. If the assembly source contains
3719 enough information---a @samp{.leafproc} or @samp{.sysproc} directive
3720 defining the operand---then @code{as} will translate the
3721 @code{callj}; if not, it will simply emit the @code{callj}, leaving it
3722 for the linker to resolve.
3723
3724 @node Compare-and-branch-i960
3725 @subsubsection Compare-and-Branch
3726
3727 @cindex i960 compare/branch instructions
3728 @cindex compare/branch instructions, i960
3729 The 960 architectures provide combined Compare-and-Branch instructions
3730 that permit you to store the branch target in the lower 13 bits of the
3731 instruction word itself. However, if you specify a branch target far
3732 enough away that its address won't fit in 13 bits, the assembler can
3733 either issue an error, or convert your Compare-and-Branch instruction
3734 into separate instructions to do the compare and the branch.
3735
3736 @cindex compare and jump expansions, i960
3737 @cindex i960 compare and jump expansions
3738 Whether @code{as} gives an error or expands the instruction depends
3739 on two choices you can make: whether you use the @samp{-norelax} option,
3740 and whether you use a ``Compare and Branch'' instruction or a ``Compare
3741 and Jump'' instruction. The ``Jump'' instructions are @emph{always}
3742 expanded if necessary; the ``Branch'' instructions are expanded when
3743 necessary @emph{unless} you specify @code{-norelax}---in which case
3744 @code{as} gives an error instead.
3745
3746 These are the Compare-and-Branch instructions, their ``Jump'' variants,
3747 and the instruction pairs they may expand into:
3748
3749 @c TEXI2ROFF-KILL
3750 @ifinfo
3751 @c END TEXI2ROFF-KILL
3752 @example
3753 Compare and
3754 Branch Jump Expanded to
3755 ------ ------ ------------
3756 bbc chkbit; bno
3757 bbs chkbit; bo
3758 cmpibe cmpije cmpi; be
3759 cmpibg cmpijg cmpi; bg
3760 cmpibge cmpijge cmpi; bge
3761 cmpibl cmpijl cmpi; bl
3762 cmpible cmpijle cmpi; ble
3763 cmpibno cmpijno cmpi; bno
3764 cmpibne cmpijne cmpi; bne
3765 cmpibo cmpijo cmpi; bo
3766 cmpobe cmpoje cmpo; be
3767 cmpobg cmpojg cmpo; bg
3768 cmpobge cmpojge cmpo; bge
3769 cmpobl cmpojl cmpo; bl
3770 cmpoble cmpojle cmpo; ble
3771 cmpobne cmpojne cmpo; bne
3772 @end example
3773 @c TEXI2ROFF-KILL
3774 @end ifinfo
3775 @tex
3776 \hskip\tableindent
3777 \halign{\hfil {\tt #}\quad&\hfil {\tt #}\qquad&{\tt #}\hfil\cr
3778 \omit{\hfil\it Compare and\hfil}\span\omit&\cr
3779 {\it Branch}&{\it Jump}&{\it Expanded to}\cr
3780 bbc& & chkbit; bno\cr
3781 bbs& & chkbit; bo\cr
3782 cmpibe& cmpije& cmpi; be\cr
3783 cmpibg& cmpijg& cmpi; bg\cr
3784 cmpibge& cmpijge& cmpi; bge\cr
3785 cmpibl& cmpijl& cmpi; bl\cr
3786 cmpible& cmpijle& cmpi; ble\cr
3787 cmpibno& cmpijno& cmpi; bno\cr
3788 cmpibne& cmpijne& cmpi; bne\cr
3789 cmpibo& cmpijo& cmpi; bo\cr
3790 cmpobe& cmpoje& cmpo; be\cr
3791 cmpobg& cmpojg& cmpo; bg\cr
3792 cmpobge& cmpojge& cmpo; bge\cr
3793 cmpobl& cmpojl& cmpo; bl\cr
3794 cmpoble& cmpojle& cmpo; ble\cr
3795 cmpobne& cmpojne& cmpo; bne\cr}
3796 @end tex
3797 @c END TEXI2ROFF-KILL
3798
3799 @node M68K-Dependent
3800 @section M680x0 Dependent Features
3801
3802 @cindex M680x0 support
3803 @menu
3804 * M68K-Opts:: M680x0 Options
3805 * M68K-Syntax:: Syntax
3806 * M68K-Float:: Floating Point
3807 * M68K-Directives:: 680x0 Machine Directives
3808 * M68K-opcodes:: Opcodes
3809 @end menu
3810
3811 @node M68K-Opts
3812 @subsection M680x0 Options
3813
3814 @cindex options, M680x0
3815 @cindex M680x0 options
3816 The Motorola 680x0 version of @code{as} has two machine dependent options.
3817 One shortens undefined references from 32 to 16 bits, while the
3818 other is used to tell @code{as} what kind of machine it is
3819 assembling for.
3820
3821 @cindex @code{-l} option, M680x0
3822 You can use the @kbd{-l} option to shorten the size of references to
3823 undefined symbols. If the @kbd{-l} option is not given, references to
3824 undefined symbols will be a full long (32 bits) wide. (Since @code{as}
3825 cannot know where these symbols will end up, @code{as} can only allocate
3826 space for the linker to fill in later. Since @code{as} doesn't know how
3827 far away these symbols will be, it allocates as much space as it can.)
3828 If this option is given, the references will only be one word wide (16
3829 bits). This may be useful if you want the object file to be as small as
3830 possible, and you know that the relevant symbols will be less than 17
3831 bits away.
3832
3833 @cindex @code{-m68000} and related options
3834 @cindex architecture options, M680x0
3835 @cindex M680x0 architecture options
3836 The 680x0 version of @code{as} is most frequently used to assemble
3837 programs for the Motorola MC68020 microprocessor. Occasionally it is
3838 used to assemble programs for the mostly similar, but slightly different
3839 MC68000 or MC68010 microprocessors. You can give @code{as} the options
3840 @samp{-m68000}, @samp{-mc68000}, @samp{-m68010}, @samp{-mc68010},
3841 @samp{-m68020}, and @samp{-mc68020} to tell it what processor is the
3842 target.
3843
3844 @node M68K-Syntax
3845 @subsection Syntax
3846
3847 @cindex M680x0 syntax
3848 @cindex syntax, M680x0
3849 @cindex M680x0 size modifiers
3850 @cindex size modifiers, M680x0
3851 The 680x0 version of @code{as} uses syntax similar to the Sun assembler.
3852 Size modifiers are appended directly to the end of the opcode without an
3853 intervening period. For example, write @samp{movl} rather than
3854 @samp{move.l}.
3855
3856
3857 In the following table @dfn{apc} stands for any of the address
3858 registers (@samp{a0} through @samp{a7}), nothing, (@samp{}), the
3859 Program Counter (@samp{pc}), or the zero-address relative to the
3860 program counter (@samp{zpc}).
3861
3862 @cindex M680x0 addressing modes
3863 @cindex addressing modes, M680x0
3864 The following addressing modes are understood:
3865 @table @dfn
3866 @item Immediate
3867 @samp{#@var{digits}}
3868
3869 @item Data Register
3870 @samp{d0} through @samp{d7}
3871
3872 @item Address Register
3873 @samp{a0} through @samp{a7}
3874
3875 @item Address Register Indirect
3876 @samp{a0@@} through @samp{a7@@}
3877
3878 @item Address Register Postincrement
3879 @samp{a0@@+} through @samp{a7@@+}
3880
3881 @item Address Register Predecrement
3882 @samp{a0@@-} through @samp{a7@@-}
3883
3884 @item Indirect Plus Offset
3885 @samp{@var{apc}@@(@var{digits})}
3886
3887 @item Index
3888 @samp{@var{apc}@@(@var{digits},@var{register}:@var{size}:@var{scale})}
3889
3890 or @samp{@var{apc}@@(@var{register}:@var{size}:@var{scale})}
3891
3892 @item Postindex
3893 @samp{@var{apc}@@(@var{digits})@@(@var{digits},@var{register}:@var{size}:@var{scale})}
3894
3895 or @samp{@var{apc}@@(@var{digits})@@(@var{register}:@var{size}:@var{scale})}
3896
3897 @item Preindex
3898 @samp{@var{apc}@@(@var{digits},@var{register}:@var{size}:@var{scale})@@(@var{digits})}
3899
3900 or @samp{@var{apc}@@(@var{register}:@var{size}:@var{scale})@@(@var{digits})}
3901
3902 @item Memory Indirect
3903 @samp{@var{apc}@@(@var{digits})@@(@var{digits})}
3904
3905 @item Absolute
3906 @samp{@var{symbol}}, or @samp{@var{digits}}
3907 @ignore
3908 @c pesch@cygnus.com: gnu, rich concur the following needs careful
3909 @c research before documenting.
3910 , or either of the above followed
3911 by @samp{:b}, @samp{:w}, or @samp{:l}.
3912 @end ignore
3913 @end table
3914
3915 @node M68K-Float
3916 @subsection Floating Point
3917
3918 @cindex floating point, M680x0
3919 @cindex M680x0 floating point
3920 @c FIXME is this "not too well tested" crud STILL true?
3921 The floating point code is not too well tested, and may have
3922 subtle bugs in it.
3923
3924 Packed decimal (P) format floating literals are not supported.
3925 Feel free to add the code!
3926
3927 The floating point formats generated by directives are these.
3928
3929 @table @code
3930 @item .float
3931 @cindex @code{float} directive, M680x0
3932 @code{Single} precision floating point constants.
3933
3934 @item .double
3935 @cindex @code{double} directive, M680x0
3936 @code{Double} precision floating point constants.
3937 @end table
3938
3939 There is no directive to produce regions of memory holding
3940 extended precision numbers, however they can be used as
3941 immediate operands to floating-point instructions. Adding a
3942 directive to create extended precision numbers would not be
3943 hard, but it has not yet seemed necessary.
3944
3945 @node M68K-Directives
3946 @subsection 680x0 Machine Directives
3947
3948 @cindex M680x0 directives
3949 @cindex directives, M680x0
3950 In order to be compatible with the Sun assembler the 680x0 assembler
3951 understands the following directives.
3952
3953 @table @code
3954 @item .data1
3955 @cindex @code{data1} directive, M680x0
3956 This directive is identical to a @code{.data 1} directive.
3957
3958 @item .data2
3959 @cindex @code{data2} directive, M680x0
3960 This directive is identical to a @code{.data 2} directive.
3961
3962 @item .even
3963 @cindex @code{even} directive, M680x0
3964 This directive is identical to a @code{.align 1} directive.
3965 @c Is this true? does it work???
3966
3967 @item .skip
3968 @cindex @code{skip} directive, M680x0
3969 This directive is identical to a @code{.space} directive.
3970 @end table
3971
3972 @node M68K-opcodes
3973 @subsection Opcodes
3974
3975 @cindex M680x0 opcodes
3976 @cindex opcodes, M680x0
3977 @cindex instruction set, M680x0
3978 @c pesch@cygnus.com: I don't see any point in the following
3979 @c paragraph. Bugs are bugs; how does saying this
3980 @c help anyone?
3981 @ignore
3982 Danger: Several bugs have been found in the opcode table (and
3983 fixed). More bugs may exist. Be careful when using obscure
3984 instructions.
3985 @end ignore
3986
3987 @menu
3988 * M68K-Branch:: Branch Improvement
3989 * M68K-Chars:: Special Characters
3990 @end menu
3991
3992 @node M68K-Branch
3993 @subsubsection Branch Improvement
3994
3995 @cindex pseudo-opcodes, M680x0
3996 @cindex M680x0 pseudo-opcodes
3997 @cindex branch improvement, M680x0
3998 @cindex M680x0 branch improvement
3999 Certain pseudo opcodes are permitted for branch instructions.
4000 They expand to the shortest branch instruction that will reach the
4001 target. Generally these mnemonics are made by substituting @samp{j} for
4002 @samp{b} at the start of a Motorola mnemonic.
4003
4004 The following table summarizes the pseudo-operations. A @code{*} flags
4005 cases that are more fully described after the table:
4006
4007 @smallexample
4008 Displacement
4009 +-------------------------------------------------
4010 | 68020 68000/10
4011 Pseudo-Op |BYTE WORD LONG LONG non-PC relative
4012 +-------------------------------------------------
4013 jbsr |bsrs bsr bsrl jsr jsr
4014 jra |bras bra bral jmp jmp
4015 * jXX |bXXs bXX bXXl bNXs;jmpl bNXs;jmp
4016 * dbXX |dbXX dbXX dbXX; bra; jmpl
4017 * fjXX |fbXXw fbXXw fbXXl fbNXw;jmp
4018
4019 XX: condition
4020 NX: negative of condition XX
4021
4022 @end smallexample
4023 @center @code{*}---see full description below
4024
4025 @table @code
4026 @item jbsr
4027 @itemx jra
4028 These are the simplest jump pseudo-operations; they always map to one
4029 particular machine instruction, depending on the displacement to the
4030 branch target.
4031
4032 @item j@var{XX}
4033 Here, @samp{j@var{XX}} stands for an entire family of pseudo-operations,
4034 where @var{XX} is a conditional branch or condition-code test. The full
4035 list of pseudo-ops in this family is:
4036 @smallexample
4037 jhi jls jcc jcs jne jeq jvc
4038 jvs jpl jmi jge jlt jgt jle
4039 @end smallexample
4040
4041 For the cases of non-PC relative displacements and long displacements on
4042 the 68000 or 68010, @code{as} will issue a longer code fragment in terms of
4043 @var{NX}, the opposite condition to @var{XX}. For example, for the
4044 non-PC relative case:
4045 @smallexample
4046 j@var{XX} foo
4047 @end smallexample
4048 gives
4049 @smallexample
4050 b@var{NX}s oof
4051 jmp foo
4052 oof:
4053 @end smallexample
4054
4055 @item db@var{XX}
4056 The full family of pseudo-operations covered here is
4057 @smallexample
4058 dbhi dbls dbcc dbcs dbne dbeq dbvc
4059 dbvs dbpl dbmi dbge dblt dbgt dble
4060 dbf dbra dbt
4061 @end smallexample
4062
4063 Other than for word and byte displacements, when the source reads
4064 @samp{db@var{XX} foo}, @code{as} will emit
4065 @smallexample
4066 db@var{XX} oo1
4067 bra oo2
4068 oo1:jmpl foo
4069 oo2:
4070 @end smallexample
4071
4072 @item fj@var{XX}
4073 This family includes
4074 @smallexample
4075 fjne fjeq fjge fjlt fjgt fjle fjf
4076 fjt fjgl fjgle fjnge fjngl fjngle fjngt
4077 fjnle fjnlt fjoge fjogl fjogt fjole fjolt
4078 fjor fjseq fjsf fjsne fjst fjueq fjuge
4079 fjugt fjule fjult fjun
4080 @end smallexample
4081
4082 For branch targets that are not PC relative, @code{as} emits
4083 @smallexample
4084 fb@var{NX} oof
4085 jmp foo
4086 oof:
4087 @end smallexample
4088 when it encounters @samp{fj@var{XX} foo}.
4089
4090 @end table
4091
4092 @node M68K-Chars
4093 @subsubsection Special Characters
4094
4095 @cindex special characters, M680x0
4096 @cindex M680x0 immediate character
4097 @cindex immediate character, M680x0
4098 @cindex M680x0 line comment character
4099 @cindex line comment character, M680x0
4100 @cindex comments, M680x0
4101 The immediate character is @samp{#} for Sun compatibility. The
4102 line-comment character is @samp{|}. If a @samp{#} appears at the
4103 beginning of a line, it is treated as a comment unless it looks like
4104 @samp{# line file}, in which case it is treated normally.
4105
4106 @node Sparc-Dependent
4107 @section SPARC Dependent Features
4108
4109 @cindex SPARC support
4110 @menu
4111 * Sparc-Opts:: Options
4112 * Sparc-Float:: Floating Point
4113 * Sparc-Directives:: Sparc Machine Directives
4114 @end menu
4115
4116 @node Sparc-Opts
4117 @subsection Options
4118
4119 @cindex options for SPARC (none)
4120 @cindex SPARC options (none)
4121 The Sparc has no machine dependent options.
4122
4123 @ignore
4124 @c FIXME: (sparc) Fill in "syntax" section!
4125 @c subsection syntax
4126 I don't know anything about Sparc syntax. Someone who does
4127 will have to write this section.
4128 @end ignore
4129
4130 @node Sparc-Float
4131 @subsection Floating Point
4132
4133 @cindex floating point, SPARC (@sc{ieee})
4134 @cindex SPARC floating point (@sc{ieee})
4135 The Sparc uses @sc{ieee} floating-point numbers.
4136
4137 @node Sparc-Directives
4138 @subsection Sparc Machine Directives
4139
4140 @cindex SPARC machine directives
4141 @cindex machine directives, SPARC
4142 The Sparc version of @code{as} supports the following additional
4143 machine directives:
4144
4145 @table @code
4146 @item .common
4147 @cindex @code{common} directive, SPARC
4148 This must be followed by a symbol name, a positive number, and
4149 @code{"bss"}. This behaves somewhat like @code{.comm}, but the
4150 syntax is different.
4151
4152 @item .half
4153 @cindex @code{half} directive, SPARC
4154 This is functionally identical to @code{.short}.
4155
4156 @item .proc
4157 @cindex @code{proc} directive, SPARC
4158 This directive is ignored. Any text following it on the same
4159 line is also ignored.
4160
4161 @item .reserve
4162 @cindex @code{reserve} directive, SPARC
4163 This must be followed by a symbol name, a positive number, and
4164 @code{"bss"}. This behaves somewhat like @code{.lcomm}, but the
4165 syntax is different.
4166
4167 @item .seg
4168 @cindex @code{seg} directive, SPARC
4169 This must be followed by @code{"text"}, @code{"data"}, or
4170 @code{"data1"}. It behaves like @code{.text}, @code{.data}, or
4171 @code{.data 1}.
4172
4173 @item .skip
4174 @cindex @code{skip} directive, SPARC
4175 This is functionally identical to the @code{.space} directive.
4176
4177 @item .word
4178 @cindex @code{word} directive, SPARC
4179 On the Sparc, the .word directive produces 32 bit values,
4180 instead of the 16 bit values it produces on many other machines.
4181 @end table
4182
4183 @node i386-Dependent
4184 @section 80386 Dependent Features
4185
4186 @cindex i386 support
4187 @cindex i80306 support
4188 @menu
4189 * i386-Options:: Options
4190 * i386-Syntax:: AT&T Syntax versus Intel Syntax
4191 * i386-Opcodes:: Opcode Naming
4192 * i386-Regs:: Register Naming
4193 * i386-prefixes:: Opcode Prefixes
4194 * i386-Memory:: Memory References
4195 * i386-jumps:: Handling of Jump Instructions
4196 * i386-Float:: Floating Point
4197 * i386-Notes:: Notes
4198 @end menu
4199
4200 @node i386-Options
4201 @subsection Options
4202
4203 @cindex options for i386 (none)
4204 @cindex i386 options (none)
4205 The 80386 has no machine dependent options.
4206
4207 @node i386-Syntax
4208 @subsection AT&T Syntax versus Intel Syntax
4209
4210 @cindex i386 syntax compatibility
4211 @cindex syntax compatibility, i386
4212 In order to maintain compatibility with the output of @code{gcc},
4213 @code{as} supports AT&T System V/386 assembler syntax. This is quite
4214 different from Intel syntax. We mention these differences because
4215 almost all 80386 documents used only Intel syntax. Notable differences
4216 between the two syntaxes are:
4217
4218 @itemize @bullet
4219 @item
4220 @cindex immediate operands, i386
4221 @cindex i386 immediate operands
4222 @cindex register operands, i386
4223 @cindex i386 register operands
4224 @cindex jump/call operands, i386
4225 @cindex i386 jump/call operands
4226 @cindex operand delimiters, i386
4227 AT&T immediate operands are preceded by @samp{$}; Intel immediate
4228 operands are undelimited (Intel @samp{push 4} is AT&T @samp{pushl $4}).
4229 AT&T register operands are preceded by @samp{%}; Intel register operands
4230 are undelimited. AT&T absolute (as opposed to PC relative) jump/call
4231 operands are prefixed by @samp{*}; they are undelimited in Intel syntax.
4232
4233 @item
4234 @cindex i386 source, destination operands
4235 @cindex source, destination operands; i386
4236 AT&T and Intel syntax use the opposite order for source and destination
4237 operands. Intel @samp{add eax, 4} is @samp{addl $4, %eax}. The
4238 @samp{source, dest} convention is maintained for compatibility with
4239 previous Unix assemblers.
4240
4241 @item
4242 @cindex opcode suffixes, i386
4243 @cindex sizes operands, i386
4244 @cindex i386 size suffixes
4245 In AT&T syntax the size of memory operands is determined from the last
4246 character of the opcode name. Opcode suffixes of @samp{b}, @samp{w},
4247 and @samp{l} specify byte (8-bit), word (16-bit), and long (32-bit)
4248 memory references. Intel syntax accomplishes this by prefixes memory
4249 operands (@emph{not} the opcodes themselves) with @samp{byte ptr},
4250 @samp{word ptr}, and @samp{dword ptr}. Thus, Intel @samp{mov al, byte
4251 ptr @var{foo}} is @samp{movb @var{foo}, %al} in AT&T syntax.
4252
4253 @item
4254 @cindex return instructions, i386
4255 @cindex i386 jump, call, return
4256 Immediate form long jumps and calls are
4257 @samp{lcall/ljmp $@var{section}, $@var{offset}} in AT&T syntax; the
4258 Intel syntax is
4259 @samp{call/jmp far @var{section}:@var{offset}}. Also, the far return
4260 instruction
4261 is @samp{lret $@var{stack-adjust}} in AT&T syntax; Intel syntax is
4262 @samp{ret far @var{stack-adjust}}.
4263
4264 @item
4265 @cindex sections, i386
4266 @cindex i386 sections
4267 The AT&T assembler does not provide support for multiple section
4268 programs. Unix style systems expect all programs to be single sections.
4269 @end itemize
4270
4271 @node i386-Opcodes
4272 @subsection Opcode Naming
4273
4274 @cindex i386 opcode naming
4275 @cindex opcode naming, i386
4276 Opcode names are suffixed with one character modifiers which specify the
4277 size of operands. The letters @samp{b}, @samp{w}, and @samp{l} specify
4278 byte, word, and long operands. If no suffix is specified by an
4279 instruction and it contains no memory operands then @code{as} tries to
4280 fill in the missing suffix based on the destination register operand
4281 (the last one by convention). Thus, @samp{mov %ax, %bx} is equivalent
4282 to @samp{movw %ax, %bx}; also, @samp{mov $1, %bx} is equivalent to
4283 @samp{movw $1, %bx}. Note that this is incompatible with the AT&T Unix
4284 assembler which assumes that a missing opcode suffix implies long
4285 operand size. (This incompatibility does not affect compiler output
4286 since compilers always explicitly specify the opcode suffix.)
4287
4288 Almost all opcodes have the same names in AT&T and Intel format. There
4289 are a few exceptions. The sign extend and zero extend instructions need
4290 two sizes to specify them. They need a size to sign/zero extend
4291 @emph{from} and a size to zero extend @emph{to}. This is accomplished
4292 by using two opcode suffixes in AT&T syntax. Base names for sign extend
4293 and zero extend are @samp{movs@dots{}} and @samp{movz@dots{}} in AT&T
4294 syntax (@samp{movsx} and @samp{movzx} in Intel syntax). The opcode
4295 suffixes are tacked on to this base name, the @emph{from} suffix before
4296 the @emph{to} suffix. Thus, @samp{movsbl %al, %edx} is AT&T syntax for
4297 ``move sign extend @emph{from} %al @emph{to} %edx.'' Possible suffixes,
4298 thus, are @samp{bl} (from byte to long), @samp{bw} (from byte to word),
4299 and @samp{wl} (from word to long).
4300
4301 @cindex conversion instructions, i386
4302 @cindex i386 conversion instructions
4303 The Intel-syntax conversion instructions
4304
4305 @itemize @bullet
4306 @item
4307 @samp{cbw} --- sign-extend byte in @samp{%al} to word in @samp{%ax},
4308
4309 @item
4310 @samp{cwde} --- sign-extend word in @samp{%ax} to long in @samp{%eax},
4311
4312 @item
4313 @samp{cwd} --- sign-extend word in @samp{%ax} to long in @samp{%dx:%ax},
4314
4315 @item
4316 @samp{cdq} --- sign-extend dword in @samp{%eax} to quad in @samp{%edx:%eax},
4317 @end itemize
4318
4319 @noindent
4320 are called @samp{cbtw}, @samp{cwtl}, @samp{cwtd}, and @samp{cltd} in
4321 AT&T naming. @code{as} accepts either naming for these instructions.
4322
4323 @cindex jump instructions, i386
4324 @cindex call instructions, i386
4325 Far call/jump instructions are @samp{lcall} and @samp{ljmp} in
4326 AT&T syntax, but are @samp{call far} and @samp{jump far} in Intel
4327 convention.
4328
4329 @node i386-Regs
4330 @subsection Register Naming
4331
4332 @cindex i386 registers
4333 @cindex registers, i386
4334 Register operands are always prefixes with @samp{%}. The 80386 registers
4335 consist of
4336
4337 @itemize @bullet
4338 @item
4339 the 8 32-bit registers @samp{%eax} (the accumulator), @samp{%ebx},
4340 @samp{%ecx}, @samp{%edx}, @samp{%edi}, @samp{%esi}, @samp{%ebp} (the
4341 frame pointer), and @samp{%esp} (the stack pointer).
4342
4343 @item
4344 the 8 16-bit low-ends of these: @samp{%ax}, @samp{%bx}, @samp{%cx},
4345 @samp{%dx}, @samp{%di}, @samp{%si}, @samp{%bp}, and @samp{%sp}.
4346
4347 @item
4348 the 8 8-bit registers: @samp{%ah}, @samp{%al}, @samp{%bh},
4349 @samp{%bl}, @samp{%ch}, @samp{%cl}, @samp{%dh}, and @samp{%dl} (These
4350 are the high-bytes and low-bytes of @samp{%ax}, @samp{%bx},
4351 @samp{%cx}, and @samp{%dx})
4352
4353 @item
4354 the 6 section registers @samp{%cs} (code section), @samp{%ds}
4355 (data section), @samp{%ss} (stack section), @samp{%es}, @samp{%fs},
4356 and @samp{%gs}.
4357
4358 @item
4359 the 3 processor control registers @samp{%cr0}, @samp{%cr2}, and
4360 @samp{%cr3}.
4361
4362 @item
4363 the 6 debug registers @samp{%db0}, @samp{%db1}, @samp{%db2},
4364 @samp{%db3}, @samp{%db6}, and @samp{%db7}.
4365
4366 @item
4367 the 2 test registers @samp{%tr6} and @samp{%tr7}.
4368
4369 @item
4370 the 8 floating point register stack @samp{%st} or equivalently
4371 @samp{%st(0)}, @samp{%st(1)}, @samp{%st(2)}, @samp{%st(3)},
4372 @samp{%st(4)}, @samp{%st(5)}, @samp{%st(6)}, and @samp{%st(7)}.
4373 @end itemize
4374
4375 @node i386-prefixes
4376 @subsection Opcode Prefixes
4377
4378 @cindex i386 opcode prefixes
4379 @cindex opcode prefixes, i386
4380 @cindex prefixes, i386
4381 Opcode prefixes are used to modify the following opcode. They are used
4382 to repeat string instructions, to provide section overrides, to perform
4383 bus lock operations, and to give operand and address size (16-bit
4384 operands are specified in an instruction by prefixing what would
4385 normally be 32-bit operands with a ``operand size'' opcode prefix).
4386 Opcode prefixes are usually given as single-line instructions with no
4387 operands, and must directly precede the instruction they act upon. For
4388 example, the @samp{scas} (scan string) instruction is repeated with:
4389 @smallexample
4390 repne
4391 scas
4392 @end smallexample
4393
4394 Here is a list of opcode prefixes:
4395
4396 @itemize @bullet
4397 @item
4398 @cindex section override prefixes, i386
4399 Section override prefixes @samp{cs}, @samp{ds}, @samp{ss}, @samp{es},
4400 @samp{fs}, @samp{gs}. These are automatically added by specifying
4401 using the @var{section}:@var{memory-operand} form for memory references.
4402
4403 @item
4404 @cindex size prefixes, i386
4405 Operand/Address size prefixes @samp{data16} and @samp{addr16}
4406 change 32-bit operands/addresses into 16-bit operands/addresses. Note
4407 that 16-bit addressing modes (i.e. 8086 and 80286 addressing modes)
4408 are not supported (yet).
4409
4410 @item
4411 @cindex bus lock prefixes, i386
4412 @cindex inhibiting interrupts, i386
4413 The bus lock prefix @samp{lock} inhibits interrupts during
4414 execution of the instruction it precedes. (This is only valid with
4415 certain instructions; see a 80386 manual for details).
4416
4417 @item
4418 @cindex coprocessor wait, i386
4419 The wait for coprocessor prefix @samp{wait} waits for the
4420 coprocessor to complete the current instruction. This should never be
4421 needed for the 80386/80387 combination.
4422
4423 @item
4424 @cindex repeat prefixes, i386
4425 The @samp{rep}, @samp{repe}, and @samp{repne} prefixes are added
4426 to string instructions to make them repeat @samp{%ecx} times.
4427 @end itemize
4428
4429 @node i386-Memory
4430 @subsection Memory References
4431
4432 @cindex i386 memory references
4433 @cindex memory references, i386
4434 An Intel syntax indirect memory reference of the form
4435
4436 @smallexample
4437 @var{section}:[@var{base} + @var{index}*@var{scale} + @var{disp}]
4438 @end smallexample
4439
4440 @noindent
4441 is translated into the AT&T syntax
4442
4443 @smallexample
4444 @var{section}:@var{disp}(@var{base}, @var{index}, @var{scale})
4445 @end smallexample
4446
4447 @noindent
4448 where @var{base} and @var{index} are the optional 32-bit base and
4449 index registers, @var{disp} is the optional displacement, and
4450 @var{scale}, taking the values 1, 2, 4, and 8, multiplies @var{index}
4451 to calculate the address of the operand. If no @var{scale} is
4452 specified, @var{scale} is taken to be 1. @var{section} specifies the
4453 optional section register for the memory operand, and may override the
4454 default section register (see a 80386 manual for section register
4455 defaults). Note that section overrides in AT&T syntax @emph{must} have
4456 be preceded by a @samp{%}. If you specify a section override which
4457 coincides with the default section register, @code{as} will @emph{not}
4458 output any section register override prefixes to assemble the given
4459 instruction. Thus, section overrides can be specified to emphasize which
4460 section register is used for a given memory operand.
4461
4462 Here are some examples of Intel and AT&T style memory references:
4463
4464 @table @asis
4465 @item AT&T: @samp{-4(%ebp)}, Intel: @samp{[ebp - 4]}
4466 @var{base} is @samp{%ebp}; @var{disp} is @samp{-4}. @var{section} is
4467 missing, and the default section is used (@samp{%ss} for addressing with
4468 @samp{%ebp} as the base register). @var{index}, @var{scale} are both missing.
4469
4470 @item AT&T: @samp{foo(,%eax,4)}, Intel: @samp{[foo + eax*4]}
4471 @var{index} is @samp{%eax} (scaled by a @var{scale} 4); @var{disp} is
4472 @samp{foo}. All other fields are missing. The section register here
4473 defaults to @samp{%ds}.
4474
4475 @item AT&T: @samp{foo(,1)}; Intel @samp{[foo]}
4476 This uses the value pointed to by @samp{foo} as a memory operand.
4477 Note that @var{base} and @var{index} are both missing, but there is only
4478 @emph{one} @samp{,}. This is a syntactic exception.
4479
4480 @item AT&T: @samp{%gs:foo}; Intel @samp{gs:foo}
4481 This selects the contents of the variable @samp{foo} with section
4482 register @var{section} being @samp{%gs}.
4483 @end table
4484
4485 Absolute (as opposed to PC relative) call and jump operands must be
4486 prefixed with @samp{*}. If no @samp{*} is specified, @code{as} will
4487 always choose PC relative addressing for jump/call labels.
4488
4489 Any instruction that has a memory operand @emph{must} specify its size (byte,
4490 word, or long) with an opcode suffix (@samp{b}, @samp{w}, or @samp{l},
4491 respectively).
4492
4493 @node i386-jumps
4494 @subsection Handling of Jump Instructions
4495
4496 @cindex jump optimization, i386
4497 @cindex i386 jump optimization
4498 Jump instructions are always optimized to use the smallest possible
4499 displacements. This is accomplished by using byte (8-bit) displacement
4500 jumps whenever the target is sufficiently close. If a byte displacement
4501 is insufficient a long (32-bit) displacement is used. We do not support
4502 word (16-bit) displacement jumps (i.e. prefixing the jump instruction
4503 with the @samp{addr16} opcode prefix), since the 80386 insists upon masking
4504 @samp{%eip} to 16 bits after the word displacement is added.
4505
4506 Note that the @samp{jcxz}, @samp{jecxz}, @samp{loop}, @samp{loopz},
4507 @samp{loope}, @samp{loopnz} and @samp{loopne} instructions only come in
4508 byte displacements, so that it is possible that use of these
4509 instructions (@code{gcc} does not use them) will cause the assembler to
4510 print an error message (and generate incorrect code). The AT&T 80386
4511 assembler tries to get around this problem by expanding @samp{jcxz foo} to
4512 @smallexample
4513 jcxz cx_zero
4514 jmp cx_nonzero
4515 cx_zero: jmp foo
4516 cx_nonzero:
4517 @end smallexample
4518
4519 @node i386-Float
4520 @subsection Floating Point
4521
4522 @cindex i386 floating point
4523 @cindex floating point, i386
4524 All 80387 floating point types except packed BCD are supported.
4525 (BCD support may be added without much difficulty). These data
4526 types are 16-, 32-, and 64- bit integers, and single (32-bit),
4527 double (64-bit), and extended (80-bit) precision floating point.
4528 Each supported type has an opcode suffix and a constructor
4529 associated with it. Opcode suffixes specify operand's data
4530 types. Constructors build these data types into memory.
4531
4532 @itemize @bullet
4533 @item
4534 @cindex @code{float} directive, i386
4535 @cindex @code{single} directive, i386
4536 @cindex @code{double} directive, i386
4537 @cindex @code{tfloat} directive, i386
4538 Floating point constructors are @samp{.float} or @samp{.single},
4539 @samp{.double}, and @samp{.tfloat} for 32-, 64-, and 80-bit formats.
4540 These correspond to opcode suffixes @samp{s}, @samp{l}, and @samp{t}.
4541 @samp{t} stands for temporary real, and that the 80387 only supports
4542 this format via the @samp{fldt} (load temporary real to stack top) and
4543 @samp{fstpt} (store temporary real and pop stack) instructions.
4544
4545 @item
4546 @cindex @code{word} directive, i386
4547 @cindex @code{long} directive, i386
4548 @cindex @code{int} directive, i386
4549 @cindex @code{quad} directive, i386
4550 Integer constructors are @samp{.word}, @samp{.long} or @samp{.int}, and
4551 @samp{.quad} for the 16-, 32-, and 64-bit integer formats. The corresponding
4552 opcode suffixes are @samp{s} (single), @samp{l} (long), and @samp{q}
4553 (quad). As with the temporary real format the 64-bit @samp{q} format is
4554 only present in the @samp{fildq} (load quad integer to stack top) and
4555 @samp{fistpq} (store quad integer and pop stack) instructions.
4556 @end itemize
4557
4558 Register to register operations do not require opcode suffixes,
4559 so that @samp{fst %st, %st(1)} is equivalent to @samp{fstl %st, %st(1)}.
4560
4561 @cindex i386 @code{fwait} instruction
4562 @cindex @code{fwait instruction}, i386
4563 Since the 80387 automatically synchronizes with the 80386 @samp{fwait}
4564 instructions are almost never needed (this is not the case for the
4565 80286/80287 and 8086/8087 combinations). Therefore, @code{as} suppresses
4566 the @samp{fwait} instruction whenever it is implicitly selected by one
4567 of the @samp{fn@dots{}} instructions. For example, @samp{fsave} and
4568 @samp{fnsave} are treated identically. In general, all the @samp{fn@dots{}}
4569 instructions are made equivalent to @samp{f@dots{}} instructions. If
4570 @samp{fwait} is desired it must be explicitly coded.
4571
4572 @node i386-Notes
4573 @subsection Notes
4574
4575 @cindex i386 @code{mul}, @code{imul} instructions
4576 @cindex @code{mul} instruction, i386
4577 @cindex @code{imul} instruction, i386
4578 There is some trickery concerning the @samp{mul} and @samp{imul}
4579 instructions that deserves mention. The 16-, 32-, and 64-bit expanding
4580 multiplies (base opcode @samp{0xf6}; extension 4 for @samp{mul} and 5
4581 for @samp{imul}) can be output only in the one operand form. Thus,
4582 @samp{imul %ebx, %eax} does @emph{not} select the expanding multiply;
4583 the expanding multiply would clobber the @samp{%edx} register, and this
4584 would confuse @code{gcc} output. Use @samp{imul %ebx} to get the
4585 64-bit product in @samp{%edx:%eax}.
4586
4587 We have added a two operand form of @samp{imul} when the first operand
4588 is an immediate mode expression and the second operand is a register.
4589 This is just a shorthand, so that, multiplying @samp{%eax} by 69, for
4590 example, can be done with @samp{imul $69, %eax} rather than @samp{imul
4591 $69, %eax, %eax}.
4592
4593 @node Z8000-Dependent
4594 @section Z8000 Dependent Features
4595
4596 @cindex Z8000 support
4597 @menu
4598 * Z8000 Options:: Options
4599 * Z8000 Syntax:: Syntax
4600 * Z8000 Directives:: Z8000 Machine Directives
4601 * Z8000 Opcodes:: Opcodes
4602 @end menu
4603
4604 @node Z8000 Options
4605 @subsection Options
4606
4607 @cindex Z8000 options
4608 @cindex options, Z8000
4609 @code{as} has no additional command-line options for the Zilog
4610 Z8000 family.
4611
4612 @node Z8000 Syntax
4613 @subsection Syntax
4614 @menu
4615 * Z8000-Chars:: Special Characters
4616 * Z8000-Regs:: Register Names
4617 * Z8000-Addressing:: Addressing Modes
4618 @end menu
4619
4620 @node Z8000-Chars
4621 @subsubsection Special Characters
4622
4623 @cindex line comment character, Z8000
4624 @cindex Z8000 line comment character
4625 @samp{!} is the line comment character.
4626
4627 @cindex line separator, Z8000
4628 @cindex statement separator, Z8000
4629 @cindex Z8000 line separator
4630 @samp{;} can be used instead of a newline to separate statements.
4631
4632 @node Z8000
4633 @subsubsection Register Names
4634
4635 @cindex Z8000 registers
4636 @cindex registers, Z8000
4637 The Z8000 has sixteen 16 bit registers, numbered 0 to 15. You can refer to different
4638 sized groups of registers with the prefix @samp{r} for 16 bit registers, @samp{rr}
4639 for 32 bit registers and @samp{rq} for 64 bit registers. The first eight of the sixteen
4640 16 bit registers may also be accessed by bytes. They are named @samp{r@var{n}h} and @samp{r@var{n}l}}.
4641 @example
4642 byte registers
4643 r0l r0h r1h r1l r2h r2l r3h r3l r4h r4l r5h r5l r6h r6l r7h r7l
4644
4645 word registers
4646 r0 r1 r2 r3 r4 r5 r6 r7 r8 r9 r10 r11 r12 r13 r14 r15
4647
4648 long word registers
4649 rr0 rr2 rr4 rr6 rr8 rr10 rr12 rr14
4650
4651 quad word registers
4652 rq0 rq4 rq8 rq12
4653 @end example
4654 @node Z8000-Addressing
4655 @subsubsection Addressing Modes
4656 @cindex addressing modes, Z8000
4657 @cindex Z800 addressing modes
4658 as understands the following addressing modes for the Z8000:
4659 @table @code
4660 @item r@var{n}
4661 Register direct
4662
4663 @item @@r@var{n}
4664 Indirect register
4665
4666 @item var{address}
4667 Direct: the 16/24 bit address of the operand is in the instruction.
4668
4669 @item address(r@var{n})
4670 Indexed: the 16/24 bit address is added to the 16 bit register to produce
4671 the final address in memory of the operand.
4672
4673 @item r@var{n}(#@var{imm})
4674 Base Address: the 16/24 bit register is added to the 16 bit sign extended immediate displacement to produce the final address in memory of the operand.
4675
4676 @item r@var{n}(r@var{m})
4677 Base Index: the 16/24 bit register r@var{n} is added to the sign extended
4678 16 bit index register r@var{m} to produce the final address in memory of the operand.
4679
4680 @item #@var{xx}
4681 Immediate data @var{xx}.
4682 @end table
4683 @node Z8000 Opcodes
4684 @subsection Opcodes
4685
4686 @cindex Z8000 opcode summary
4687 @cindex opcode summary, Z8000
4688 @cindex mnemonics, Z8000
4689 @cindex instruction summary, Z8000
4690 For detailed information on the Z8000 machine instruction set, see
4691 @cite{Z8000 Technical Manual}.
4692
4693 @cindex Z8000 pseudo ops
4694
4695 The Z8000 port of gas provides a superficial resemblance to YASM, and
4696 provides these YASM compatible pseudo ops:
4697 @table @code
4698 @item segm
4699 @cindex segm
4700 Generates code for the segmented Z8001.
4701 @item unsegm
4702 Generates code for the unsegmented Z8002.
4703 @item name
4704 Synonym for @code{.file}
4705 @item global
4706 Synonum for @code{.global}
4707 @item wval
4708 Synonym for .word
4709 @item lval
4710 Synonym for .long
4711 @item bval
4712 Synonym for .byte
4713 @item sval
4714 Assemble a string.
4715 @code {sval} expects one string literal, delimited by single quotes. It assembles each byte of the string into consecutive addresses. Single quote
4716 and other non-representable characters may be descrbed by escaping them
4717 with a percent sign and their ascii value as a two digit hex number.
4718
4719 @example
4720 char *a = "he said \"it's 50% off\"";
4721
4722 0000 68652073 sval 'he said %22it%27s 50%25 off%22%00'
4723 61696420
4724 22697427
4725 73203530
4726 25206F66
4727 662200
4728
4729 @end example
4730 @item rsect
4731 synonym for @code{.section}
4732 @item block
4733 synonym for @code{.space}
4734 @item even
4735 synonym for @code{.align 1}
4736 @end table
4737
4738 The following table summarizes the opcodes and their arguments:
4739 @c kluge due to lack of group outside example
4740 @page
4741 @group
4742 @smallexample
4743
4744 rs @r{16 bit source register}
4745 rd @r{16 bit destination register}
4746 rbs @r{8 bit source register}
4747 rbd @r{8 bit destination register}
4748 rrs @r{32 bit source register}
4749 rrd @r{32 bit destination register}
4750 rqs @r{64 bit source register}
4751 rqd @r{64 bit destination register}
4752 addr @r{16/24 bit address}
4753 imm @r{immediate data}
4754
4755 adc rd,rs clrb addr cpsir @@rd,@@rs,rr,cc
4756 adcb rbd,rbs clrb addr(rd) cpsirb @@rd,@@rs,rr,cc
4757 add rd,@@rs clrb rbd dab rbd
4758 add rd,addr com @@rd dbjnz rbd,disp7
4759 add rd,addr(rs) com addr dec @@rd,imm4m1
4760 add rd,imm16 com addr(rd) dec addr(rd),imm4m1
4761 add rd,rs com rd dec addr,imm4m1
4762 addb rbd,@@rs comb @@rd dec rd,imm4m1
4763 addb rbd,addr comb addr decb @@rd,imm4m1
4764 addb rbd,addr(rs) comb addr(rd) decb addr(rd),imm4m1
4765 addb rbd,imm8 comb rbd decb addr,imm4m1
4766 addb rbd,rbs comflg flags decb rbd,imm4m1
4767 addl rrd,@@rs cp @@rd,imm16 di i2
4768 addl rrd,addr cp addr(rd),imm16 div rrd,@@rs
4769 addl rrd,addr(rs) cp addr,imm16 div rrd,addr
4770 addl rrd,imm32 cp rd,@@rs div rrd,addr(rs)
4771 addl rrd,rrs cp rd,addr div rrd,imm16
4772 and rd,@@rs cp rd,addr(rs) div rrd,rs
4773 and rd,addr cp rd,imm16 divl rqd,@@rs
4774 and rd,addr(rs) cp rd,rs divl rqd,addr
4775 and rd,imm16 cpb @@rd,imm8 divl rqd,addr(rs)
4776 and rd,rs cpb addr(rd),imm8 divl rqd,imm32
4777 andb rbd,@@rs cpb addr,imm8 divl rqd,rrs
4778 andb rbd,addr cpb rbd,@@rs djnz rd,disp7
4779 andb rbd,addr(rs) cpb rbd,addr ei i2
4780 andb rbd,imm8 cpb rbd,addr(rs) ex rd,@@rs
4781 andb rbd,rbs cpb rbd,imm8 ex rd,addr
4782 bit @@rd,imm4 cpb rbd,rbs ex rd,addr(rs)
4783 bit addr(rd),imm4 cpd rd,@@rs,rr,cc ex rd,rs
4784 bit addr,imm4 cpdb rbd,@@rs,rr,cc exb rbd,@@rs
4785 bit rd,imm4 cpdr rd,@@rs,rr,cc exb rbd,addr
4786 bit rd,rs cpdrb rbd,@@rs,rr,cc exb rbd,addr(rs)
4787 bitb @@rd,imm4 cpi rd,@@rs,rr,cc exb rbd,rbs
4788 bitb addr(rd),imm4 cpib rbd,@@rs,rr,cc ext0e imm8
4789 bitb addr,imm4 cpir rd,@@rs,rr,cc ext0f imm8
4790 bitb rbd,imm4 cpirb rbd,@@rs,rr,cc ext8e imm8
4791 bitb rbd,rs cpl rrd,@@rs ext8f imm8
4792 bpt cpl rrd,addr exts rrd
4793 call @@rd cpl rrd,addr(rs) extsb rd
4794 call addr cpl rrd,imm32 extsl rqd
4795 call addr(rd) cpl rrd,rrs halt
4796 calr disp12 cpsd @@rd,@@rs,rr,cc in rd,@@rs
4797 clr @@rd cpsdb @@rd,@@rs,rr,cc in rd,imm16
4798 clr addr cpsdr @@rd,@@rs,rr,cc inb rbd,@@rs
4799 clr addr(rd) cpsdrb @@rd,@@rs,rr,cc inb rbd,imm16
4800 clr rd cpsi @@rd,@@rs,rr,cc inc @@rd,imm4m1
4801 clrb @@rd cpsib @@rd,@@rs,rr,cc inc addr(rd),imm4m1
4802 @end group
4803 @group
4804 inc addr,imm4m1 ldb rbd,rs(rx) mult rrd,addr(rs)
4805 inc rd,imm4m1 ldb rd(imm16),rbs mult rrd,imm16
4806 incb @@rd,imm4m1 ldb rd(rx),rbs mult rrd,rs
4807 incb addr(rd),imm4m1 ldctl ctrl,rs multl rqd,@@rs
4808 incb addr,imm4m1 ldctl rd,ctrl multl rqd,addr
4809 incb rbd,imm4m1 ldd @@rs,@@rd,rr multl rqd,addr(rs)
4810 ind @@rd,@@rs,ra lddb @@rs,@@rd,rr multl rqd,imm32
4811 indb @@rd,@@rs,rba lddr @@rs,@@rd,rr multl rqd,rrs
4812 inib @@rd,@@rs,ra lddrb @@rs,@@rd,rr neg @@rd
4813 inibr @@rd,@@rs,ra ldi @@rd,@@rs,rr neg addr
4814 iret ldib @@rd,@@rs,rr neg addr(rd)
4815 jp cc,@@rd ldir @@rd,@@rs,rr neg rd
4816 jp cc,addr ldirb @@rd,@@rs,rr negb @@rd
4817 jp cc,addr(rd) ldk rd,imm4 negb addr
4818 jr cc,disp8 ldl @@rd,rrs negb addr(rd)
4819 ld @@rd,imm16 ldl addr(rd),rrs negb rbd
4820 ld @@rd,rs ldl addr,rrs nop
4821 ld addr(rd),imm16 ldl rd(imm16),rrs or rd,@@rs
4822 ld addr(rd),rs ldl rd(rx),rrs or rd,addr
4823 ld addr,imm16 ldl rrd,@@rs or rd,addr(rs)
4824 ld addr,rs ldl rrd,addr or rd,imm16
4825 ld rd(imm16),rs ldl rrd,addr(rs) or rd,rs
4826 ld rd(rx),rs ldl rrd,imm32 orb rbd,@@rs
4827 ld rd,@@rs ldl rrd,rrs orb rbd,addr
4828 ld rd,addr ldl rrd,rs(imm16) orb rbd,addr(rs)
4829 ld rd,addr(rs) ldl rrd,rs(rx) orb rbd,imm8
4830 ld rd,imm16 ldm @@rd,rs,n orb rbd,rbs
4831 ld rd,rs ldm addr(rd),rs,n out @@rd,rs
4832 ld rd,rs(imm16) ldm addr,rs,n out imm16,rs
4833 ld rd,rs(rx) ldm rd,@@rs,n outb @@rd,rbs
4834 lda rd,addr ldm rd,addr(rs),n outb imm16,rbs
4835 lda rd,addr(rs) ldm rd,addr,n outd @@rd,@@rs,ra
4836 lda rd,rs(imm16) ldps @@rs outdb @@rd,@@rs,rba
4837 lda rd,rs(rx) ldps addr outib @@rd,@@rs,ra
4838 ldar rd,disp16 ldps addr(rs) outibr @@rd,@@rs,ra
4839 ldb @@rd,imm8 ldr disp16,rs pop @@rd,@@rs
4840 ldb @@rd,rbs ldr rd,disp16 pop addr(rd),@@rs
4841 ldb addr(rd),imm8 ldrb disp16,rbs pop addr,@@rs
4842 ldb addr(rd),rbs ldrb rbd,disp16 pop rd,@@rs
4843 ldb addr,imm8 ldrl disp16,rrs popl @@rd,@@rs
4844 ldb addr,rbs ldrl rrd,disp16 popl addr(rd),@@rs
4845 ldb rbd,@@rs mbit popl addr,@@rs
4846 ldb rbd,addr mreq rd popl rrd,@@rs
4847 ldb rbd,addr(rs) mres push @@rd,@@rs
4848 ldb rbd,imm8 mset push @@rd,addr
4849 ldb rbd,rbs mult rrd,@@rs push @@rd,addr(rs)
4850 ldb rbd,rs(imm16) mult rrd,addr push @@rd,imm16
4851 @end group
4852 @group
4853 push @@rd,rs set addr,imm4 subl rrd,imm32
4854 pushl @@rd,@@rs set rd,imm4 subl rrd,rrs
4855 pushl @@rd,addr set rd,rs tcc cc,rd
4856 pushl @@rd,addr(rs) setb @@rd,imm4 tccb cc,rbd
4857 pushl @@rd,rrs setb addr(rd),imm4 test @@rd
4858 res @@rd,imm4 setb addr,imm4 test addr
4859 res addr(rd),imm4 setb rbd,imm4 test addr(rd)
4860 res addr,imm4 setb rbd,rs test rd
4861 res rd,imm4 setflg imm4 testb @@rd
4862 res rd,rs sinb rbd,imm16 testb addr
4863 resb @@rd,imm4 sinb rd,imm16 testb addr(rd)
4864 resb addr(rd),imm4 sind @@rd,@@rs,ra testb rbd
4865 resb addr,imm4 sindb @@rd,@@rs,rba testl @@rd
4866 resb rbd,imm4 sinib @@rd,@@rs,ra testl addr
4867 resb rbd,rs sinibr @@rd,@@rs,ra testl addr(rd)
4868 resflg imm4 sla rd,imm8 testl rrd
4869 ret cc slab rbd,imm8 trdb @@rd,@@rs,rba
4870 rl rd,imm1or2 slal rrd,imm8 trdrb @@rd,@@rs,rba
4871 rlb rbd,imm1or2 sll rd,imm8 trib @@rd,@@rs,rbr
4872 rlc rd,imm1or2 sllb rbd,imm8 trirb @@rd,@@rs,rbr
4873 rlcb rbd,imm1or2 slll rrd,imm8 trtdrb @@ra,@@rb,rbr
4874 rldb rbb,rba sout imm16,rs trtib @@ra,@@rb,rr
4875 rr rd,imm1or2 soutb imm16,rbs trtirb @@ra,@@rb,rbr
4876 rrb rbd,imm1or2 soutd @@rd,@@rs,ra trtrb @@ra,@@rb,rbr
4877 rrc rd,imm1or2 soutdb @@rd,@@rs,rba tset @@rd
4878 rrcb rbd,imm1or2 soutib @@rd,@@rs,ra tset addr
4879 rrdb rbb,rba soutibr @@rd,@@rs,ra tset addr(rd)
4880 rsvd36 sra rd,imm8 tset rd
4881 rsvd38 srab rbd,imm8 tsetb @@rd
4882 rsvd78 sral rrd,imm8 tsetb addr
4883 rsvd7e srl rd,imm8 tsetb addr(rd)
4884 rsvd9d srlb rbd,imm8 tsetb rbd
4885 rsvd9f srll rrd,imm8 xor rd,@@rs
4886 rsvdb9 sub rd,@@rs xor rd,addr
4887 rsvdbf sub rd,addr xor rd,addr(rs)
4888 sbc rd,rs sub rd,addr(rs) xor rd,imm16
4889 sbcb rbd,rbs sub rd,imm16 xor rd,rs
4890 sc imm8 sub rd,rs xorb rbd,@@rs
4891 sda rd,rs subb rbd,@@rs xorb rbd,addr
4892 sdab rbd,rs subb rbd,addr xorb rbd,addr(rs)
4893 sdal rrd,rs subb rbd,addr(rs) xorb rbd,imm8
4894 sdl rd,rs subb rbd,imm8 xorb rbd,rbs
4895 sdlb rbd,rs subb rbd,rbs xorb rbd,rbs
4896 sdll rrd,rs subl rrd,@@rs
4897 set @@rd,imm4 subl rrd,addr
4898 set addr(rd),imm4 subl rrd,addr(rs)
4899 @end group
4900 @end smallexample
4901
4902
4903 @node Copying
4904 @unnumbered GNU GENERAL PUBLIC LICENSE
4905
4906 @cindex license
4907 @cindex GPL
4908 @cindex copying @code{as}
4909 @center Version 2, June 1991
4910
4911 @display
4912 Copyright @copyright{} 1989, 1991 Free Software Foundation, Inc.
4913 675 Mass Ave, Cambridge, MA 02139, USA
4914
4915 Everyone is permitted to copy and distribute verbatim copies
4916 of this license document, but changing it is not allowed.
4917 @end display
4918
4919 @unnumberedsec Preamble
4920
4921 The licenses for most software are designed to take away your
4922 freedom to share and change it. By contrast, the GNU General Public
4923 License is intended to guarantee your freedom to share and change free
4924 software---to make sure the software is free for all its users. This
4925 General Public License applies to most of the Free Software
4926 Foundation's software and to any other program whose authors commit to
4927 using it. (Some other Free Software Foundation software is covered by
4928 the GNU Library General Public License instead.) You can apply it to
4929 your programs, too.
4930
4931 When we speak of free software, we are referring to freedom, not
4932 price. Our General Public Licenses are designed to make sure that you
4933 have the freedom to distribute copies of free software (and charge for
4934 this service if you wish), that you receive source code or can get it
4935 if you want it, that you can change the software or use pieces of it
4936 in new free programs; and that you know you can do these things.
4937
4938 To protect your rights, we need to make restrictions that forbid
4939 anyone to deny you these rights or to ask you to surrender the rights.
4940 These restrictions translate to certain responsibilities for you if you
4941 distribute copies of the software, or if you modify it.
4942
4943 For example, if you distribute copies of such a program, whether
4944 gratis or for a fee, you must give the recipients all the rights that
4945 you have. You must make sure that they, too, receive or can get the
4946 source code. And you must show them these terms so they know their
4947 rights.
4948
4949 We protect your rights with two steps: (1) copyright the software, and
4950 (2) offer you this license which gives you legal permission to copy,
4951 distribute and/or modify the software.
4952
4953 Also, for each author's protection and ours, we want to make certain
4954 that everyone understands that there is no warranty for this free
4955 software. If the software is modified by someone else and passed on, we
4956 want its recipients to know that what they have is not the original, so
4957 that any problems introduced by others will not reflect on the original
4958 authors' reputations.
4959
4960 Finally, any free program is threatened constantly by software
4961 patents. We wish to avoid the danger that redistributors of a free
4962 program will individually obtain patent licenses, in effect making the
4963 program proprietary. To prevent this, we have made it clear that any
4964 patent must be licensed for everyone's free use or not licensed at all.
4965
4966 The precise terms and conditions for copying, distribution and
4967 modification follow.
4968
4969 @iftex
4970 @unnumberedsec TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
4971 @end iftex
4972 @ifinfo
4973 @center TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
4974 @end ifinfo
4975
4976 @enumerate
4977 @item
4978 This License applies to any program or other work which contains
4979 a notice placed by the copyright holder saying it may be distributed
4980 under the terms of this General Public License. The ``Program'', below,
4981 refers to any such program or work, and a ``work based on the Program''
4982 means either the Program or any derivative work under copyright law:
4983 that is to say, a work containing the Program or a portion of it,
4984 either verbatim or with modifications and/or translated into another
4985 language. (Hereinafter, translation is included without limitation in
4986 the term ``modification''.) Each licensee is addressed as ``you''.
4987
4988 Activities other than copying, distribution and modification are not
4989 covered by this License; they are outside its scope. The act of
4990 running the Program is not restricted, and the output from the Program
4991 is covered only if its contents constitute a work based on the
4992 Program (independent of having been made by running the Program).
4993 Whether that is true depends on what the Program does.
4994
4995 @item
4996 You may copy and distribute verbatim copies of the Program's
4997 source code as you receive it, in any medium, provided that you
4998 conspicuously and appropriately publish on each copy an appropriate
4999 copyright notice and disclaimer of warranty; keep intact all the
5000 notices that refer to this License and to the absence of any warranty;
5001 and give any other recipients of the Program a copy of this License
5002 along with the Program.
5003
5004 You may charge a fee for the physical act of transferring a copy, and
5005 you may at your option offer warranty protection in exchange for a fee.
5006
5007 @item
5008 You may modify your copy or copies of the Program or any portion
5009 of it, thus forming a work based on the Program, and copy and
5010 distribute such modifications or work under the terms of Section 1
5011 above, provided that you also meet all of these conditions:
5012
5013 @enumerate a
5014 @item
5015 You must cause the modified files to carry prominent notices
5016 stating that you changed the files and the date of any change.
5017
5018 @item
5019 You must cause any work that you distribute or publish, that in
5020 whole or in part contains or is derived from the Program or any
5021 part thereof, to be licensed as a whole at no charge to all third
5022 parties under the terms of this License.
5023
5024 @item
5025 If the modified program normally reads commands interactively
5026 when run, you must cause it, when started running for such
5027 interactive use in the most ordinary way, to print or display an
5028 announcement including an appropriate copyright notice and a
5029 notice that there is no warranty (or else, saying that you provide
5030 a warranty) and that users may redistribute the program under
5031 these conditions, and telling the user how to view a copy of this
5032 License. (Exception: if the Program itself is interactive but
5033 does not normally print such an announcement, your work based on
5034 the Program is not required to print an announcement.)
5035 @end enumerate
5036
5037 These requirements apply to the modified work as a whole. If
5038 identifiable sections of that work are not derived from the Program,
5039 and can be reasonably considered independent and separate works in
5040 themselves, then this License, and its terms, do not apply to those
5041 sections when you distribute them as separate works. But when you
5042 distribute the same sections as part of a whole which is a work based
5043 on the Program, the distribution of the whole must be on the terms of
5044 this License, whose permissions for other licensees extend to the
5045 entire whole, and thus to each and every part regardless of who wrote it.
5046
5047 Thus, it is not the intent of this section to claim rights or contest
5048 your rights to work written entirely by you; rather, the intent is to
5049 exercise the right to control the distribution of derivative or
5050 collective works based on the Program.
5051
5052 In addition, mere aggregation of another work not based on the Program
5053 with the Program (or with a work based on the Program) on a volume of
5054 a storage or distribution medium does not bring the other work under
5055 the scope of this License.
5056
5057 @item
5058 You may copy and distribute the Program (or a work based on it,
5059 under Section 2) in object code or executable form under the terms of
5060 Sections 1 and 2 above provided that you also do one of the following:
5061
5062 @enumerate a
5063 @item
5064 Accompany it with the complete corresponding machine-readable
5065 source code, which must be distributed under the terms of Sections
5066 1 and 2 above on a medium customarily used for software interchange; or,
5067
5068 @item
5069 Accompany it with a written offer, valid for at least three
5070 years, to give any third party, for a charge no more than your
5071 cost of physically performing source distribution, a complete
5072 machine-readable copy of the corresponding source code, to be
5073 distributed under the terms of Sections 1 and 2 above on a medium
5074 customarily used for software interchange; or,
5075
5076 @item
5077 Accompany it with the information you received as to the offer
5078 to distribute corresponding source code. (This alternative is
5079 allowed only for noncommercial distribution and only if you
5080 received the program in object code or executable form with such
5081 an offer, in accord with Subsection b above.)
5082 @end enumerate
5083
5084 The source code for a work means the preferred form of the work for
5085 making modifications to it. For an executable work, complete source
5086 code means all the source code for all modules it contains, plus any
5087 associated interface definition files, plus the scripts used to
5088 control compilation and installation of the executable. However, as a
5089 special exception, the source code distributed need not include
5090 anything that is normally distributed (in either source or binary
5091 form) with the major components (compiler, kernel, and so on) of the
5092 operating system on which the executable runs, unless that component
5093 itself accompanies the executable.
5094
5095 If distribution of executable or object code is made by offering
5096 access to copy from a designated place, then offering equivalent
5097 access to copy the source code from the same place counts as
5098 distribution of the source code, even though third parties are not
5099 compelled to copy the source along with the object code.
5100
5101 @item
5102 You may not copy, modify, sublicense, or distribute the Program
5103 except as expressly provided under this License. Any attempt
5104 otherwise to copy, modify, sublicense or distribute the Program is
5105 void, and will automatically terminate your rights under this License.
5106 However, parties who have received copies, or rights, from you under
5107 this License will not have their licenses terminated so long as such
5108 parties remain in full compliance.
5109
5110 @item
5111 You are not required to accept this License, since you have not
5112 signed it. However, nothing else grants you permission to modify or
5113 distribute the Program or its derivative works. These actions are
5114 prohibited by law if you do not accept this License. Therefore, by
5115 modifying or distributing the Program (or any work based on the
5116 Program), you indicate your acceptance of this License to do so, and
5117 all its terms and conditions for copying, distributing or modifying
5118 the Program or works based on it.
5119
5120 @item
5121 Each time you redistribute the Program (or any work based on the
5122 Program), the recipient automatically receives a license from the
5123 original licensor to copy, distribute or modify the Program subject to
5124 these terms and conditions. You may not impose any further
5125 restrictions on the recipients' exercise of the rights granted herein.
5126 You are not responsible for enforcing compliance by third parties to
5127 this License.
5128
5129 @item
5130 If, as a consequence of a court judgment or allegation of patent
5131 infringement or for any other reason (not limited to patent issues),
5132 conditions are imposed on you (whether by court order, agreement or
5133 otherwise) that contradict the conditions of this License, they do not
5134 excuse you from the conditions of this License. If you cannot
5135 distribute so as to satisfy simultaneously your obligations under this
5136 License and any other pertinent obligations, then as a consequence you
5137 may not distribute the Program at all. For example, if a patent
5138 license would not permit royalty-free redistribution of the Program by
5139 all those who receive copies directly or indirectly through you, then
5140 the only way you could satisfy both it and this License would be to
5141 refrain entirely from distribution of the Program.
5142
5143 If any portion of this section is held invalid or unenforceable under
5144 any particular circumstance, the balance of the section is intended to
5145 apply and the section as a whole is intended to apply in other
5146 circumstances.
5147
5148 It is not the purpose of this section to induce you to infringe any
5149 patents or other property right claims or to contest validity of any
5150 such claims; this section has the sole purpose of protecting the
5151 integrity of the free software distribution system, which is
5152 implemented by public license practices. Many people have made
5153 generous contributions to the wide range of software distributed
5154 through that system in reliance on consistent application of that
5155 system; it is up to the author/donor to decide if he or she is willing
5156 to distribute software through any other system and a licensee cannot
5157 impose that choice.
5158
5159 This section is intended to make thoroughly clear what is believed to
5160 be a consequence of the rest of this License.
5161
5162 @item
5163 If the distribution and/or use of the Program is restricted in
5164 certain countries either by patents or by copyrighted interfaces, the
5165 original copyright holder who places the Program under this License
5166 may add an explicit geographical distribution limitation excluding
5167 those countries, so that distribution is permitted only in or among
5168 countries not thus excluded. In such case, this License incorporates
5169 the limitation as if written in the body of this License.
5170
5171 @item
5172 The Free Software Foundation may publish revised and/or new versions
5173 of the General Public License from time to time. Such new versions will
5174 be similar in spirit to the present version, but may differ in detail to
5175 address new problems or concerns.
5176
5177 Each version is given a distinguishing version number. If the Program
5178 specifies a version number of this License which applies to it and ``any
5179 later version'', you have the option of following the terms and conditions
5180 either of that version or of any later version published by the Free
5181 Software Foundation. If the Program does not specify a version number of
5182 this License, you may choose any version ever published by the Free Software
5183 Foundation.
5184
5185 @item
5186 If you wish to incorporate parts of the Program into other free
5187 programs whose distribution conditions are different, write to the author
5188 to ask for permission. For software which is copyrighted by the Free
5189 Software Foundation, write to the Free Software Foundation; we sometimes
5190 make exceptions for this. Our decision will be guided by the two goals
5191 of preserving the free status of all derivatives of our free software and
5192 of promoting the sharing and reuse of software generally.
5193
5194 @iftex
5195 @heading NO WARRANTY
5196 @end iftex
5197 @ifinfo
5198 @center NO WARRANTY
5199 @end ifinfo
5200
5201 @item
5202 BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
5203 FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
5204 OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
5205 PROVIDE THE PROGRAM ``AS IS'' WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
5206 OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
5207 MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
5208 TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
5209 PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
5210 REPAIR OR CORRECTION.
5211
5212 @item
5213 IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
5214 WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
5215 REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
5216 INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
5217 OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
5218 TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
5219 YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
5220 PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
5221 POSSIBILITY OF SUCH DAMAGES.
5222 @end enumerate
5223
5224 @iftex
5225 @heading END OF TERMS AND CONDITIONS
5226 @end iftex
5227 @ifinfo
5228 @center END OF TERMS AND CONDITIONS
5229 @end ifinfo
5230
5231 @page
5232 @unnumberedsec Applying These Terms to Your New Programs
5233
5234 If you develop a new program, and you want it to be of the greatest
5235 possible use to the public, the best way to achieve this is to make it
5236 free software which everyone can redistribute and change under these terms.
5237
5238 To do so, attach the following notices to the program. It is safest
5239 to attach them to the start of each source file to most effectively
5240 convey the exclusion of warranty; and each file should have at least
5241 the ``copyright'' line and a pointer to where the full notice is found.
5242
5243 @smallexample
5244 @var{one line to give the program's name and an idea of what it does.}
5245 Copyright (C) 19@var{yy} @var{name of author}
5246
5247 This program is free software; you can redistribute it and/or
5248 modify it under the terms of the GNU General Public License
5249 as published by the Free Software Foundation; either version 2
5250 of the License, or (at your option) any later version.
5251
5252 This program is distributed in the hope that it will be useful,
5253 but WITHOUT ANY WARRANTY; without even the implied warranty of
5254 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5255 GNU General Public License for more details.
5256
5257 You should have received a copy of the GNU General Public License
5258 along with this program; if not, write to the
5259 Free Software Foundation, Inc., 675 Mass Ave,
5260 Cambridge, MA 02139, USA.
5261 @end smallexample
5262
5263 Also add information on how to contact you by electronic and paper mail.
5264
5265 If the program is interactive, make it output a short notice like this
5266 when it starts in an interactive mode:
5267
5268 @smallexample
5269 Gnomovision version 69, Copyright (C) 19@var{yy} @var{name of author}
5270 Gnomovision comes with ABSOLUTELY NO WARRANTY; for details
5271 type `show w'. This is free software, and you are welcome
5272 to redistribute it under certain conditions; type `show c'
5273 for details.
5274 @end smallexample
5275
5276 The hypothetical commands @samp{show w} and @samp{show c} should show
5277 the appropriate parts of the General Public License. Of course, the
5278 commands you use may be called something other than @samp{show w} and
5279 @samp{show c}; they could even be mouse-clicks or menu items---whatever
5280 suits your program.
5281
5282 You should also get your employer (if you work as a programmer) or your
5283 school, if any, to sign a ``copyright disclaimer'' for the program, if
5284 necessary. Here is a sample; alter the names:
5285
5286 @smallexample
5287 Yoyodyne, Inc., hereby disclaims all copyright interest in
5288 the program `Gnomovision' (which makes passes at compilers)
5289 written by James Hacker.
5290
5291 @var{signature of Ty Coon}, 1 April 1989
5292 Ty Coon, President of Vice
5293 @end smallexample
5294
5295 This General Public License does not permit incorporating your program into
5296 proprietary programs. If your program is a subroutine library, you may
5297 consider it more useful to permit linking proprietary applications with the
5298 library. If this is what you want to do, use the GNU Library General
5299 Public License instead of this License.
5300
5301 @node Index
5302 @unnumbered Index
5303
5304 @printindex cp
5305
5306 @summarycontents
5307 @contents
5308 @bye
This page took 0.15368 seconds and 4 git commands to generate.