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