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