Commit | Line | Data |
---|---|---|
d2964941 RH |
1 | .\" |
2 | .\" Copyright (c) 1982 Regents of the University of California | |
c603d1f7 | 3 | .\" @(#)asdocs3.me 1.6 %G% |
d2964941 | 4 | .\" |
a53a5533 RH |
5 | .EQ |
6 | delim $$ | |
7 | .EN | |
8 | .SH 1 "Pseudo-operations (Directives)" | |
9 | .pp | |
10 | The keywords listed below introduce directives or instructions, | |
11 | and influence the later behavior of the assembler for this statement. | |
12 | The metanotation | |
13 | .ce 1 | |
14 | [ stuff ] | |
15 | .ce 0 | |
16 | means that 0 or more instances of the given | |
17 | .q stuff | |
18 | may appear. | |
19 | .pp | |
20 | .b Boldface | |
21 | tokens must appear literally; | |
22 | words in | |
23 | .i italic | |
24 | words are substitutable. | |
25 | .pp | |
26 | The pseudo\-operations listed below | |
27 | are grouped into functional categories. | |
28 | .SH 2 "Interface to a Previous Pass" | |
c603d1f7 | 29 | .(b |
a53a5533 RH |
30 | .in -2n |
31 | .TS | |
32 | lb l. | |
33 | \&.ABORT | |
34 | .TE | |
35 | .in +2n | |
c603d1f7 | 36 | .)b |
a53a5533 RH |
37 | .pp |
38 | As soon as the assembler sees this directive, | |
39 | it ignores all further input | |
40 | (but it does read to the end of file), | |
41 | and aborts the assembly. | |
42 | No files are created. | |
43 | It is anticipated that this would be used in a pipe interconnected | |
44 | version of a compiler, | |
45 | where the first major syntax error would | |
46 | cause the compiler to issue this directive, | |
47 | saving unnecessary work in assembling code | |
48 | that would have to be discarded anyway. | |
c603d1f7 | 49 | .(b |
a53a5533 RH |
50 | .in -2n |
51 | .TS | |
52 | lb l. | |
53 | \&.file $string$ | |
54 | .TE | |
55 | .in +2n | |
c603d1f7 | 56 | .)b |
a53a5533 RH |
57 | .pp |
58 | This directive causes the assembler to think it is in file | |
59 | .i string , | |
60 | so error messages reflect the proper source file. | |
c603d1f7 | 61 | .(b |
a53a5533 RH |
62 | .in -2n |
63 | .TS | |
64 | lb l. | |
65 | \&.line $expression$ | |
66 | .TE | |
67 | .in +2n | |
c603d1f7 | 68 | .)b |
a53a5533 RH |
69 | .pp |
70 | This directive causes the assembler to think it is on line | |
71 | .i expression | |
72 | so error messages reflect the proper source file. | |
73 | .pp | |
74 | The only effect of assembling multiple files specified in the command string | |
75 | is to insert the | |
76 | .i file | |
77 | and | |
78 | .i line | |
79 | directives, | |
80 | with the appropriate values, | |
81 | at the beginning of the source from each file. | |
c603d1f7 | 82 | .(b |
a53a5533 RH |
83 | .in -2n |
84 | .TS | |
85 | lb l. | |
86 | # $expression$ $string$ | |
87 | # $expression$ | |
88 | .TE | |
89 | .in +2n | |
c603d1f7 | 90 | .)b |
a53a5533 RH |
91 | .pp |
92 | This is the only instance where a comment is meaningful to the assembler. | |
93 | The | |
94 | .q "#" | |
95 | .ul 1 | |
96 | must | |
97 | be in the first column. | |
98 | This meta comment causes the assembler | |
99 | to believe it is on line | |
100 | .i expression . | |
101 | The second argument, | |
102 | if included, | |
103 | causes the assembler to believe it is in file | |
104 | .i string , | |
105 | otherwise the current file name does not change. | |
106 | .SH 2 "Location Counter Control" | |
c603d1f7 | 107 | .(b |
a53a5533 RH |
108 | .in -2n |
109 | .TS | |
110 | lb l. | |
111 | \&.data [ $expression$ ] | |
112 | \&.text [ $expression$ ] | |
113 | .TE | |
114 | .in +2n | |
c603d1f7 | 115 | .)b |
a53a5533 RH |
116 | .pp |
117 | These two pseudo-operations cause the | |
118 | assembler to begin assembling into the indicated text or data | |
119 | subsegment. | |
120 | If specified, | |
121 | the | |
122 | .i expression | |
123 | must be defined and absolute; | |
124 | an omitted | |
125 | .i expression | |
126 | is treated as zero. | |
127 | The effect of a | |
128 | .b .data | |
129 | directive is treated | |
130 | as a | |
131 | .b .text | |
132 | directive if the | |
133 | .b \-R | |
134 | assembly flag is set. | |
135 | Assembly starts in the | |
136 | .b ".text" | |
137 | 0 subsegment. | |
138 | .pp | |
139 | The directives | |
140 | .b .align | |
141 | and | |
142 | .b .org | |
143 | also control the placement of the location counter. | |
144 | .sh 2 "Filled Data" | |
c603d1f7 | 145 | .(b |
a53a5533 RH |
146 | .in -2n |
147 | .TS | |
148 | lb l. | |
149 | \&.align $align\*(USexpr$ [ \fB,\fP $fill\*(USexpr$ ] | |
150 | .TE | |
151 | .in +2n | |
c603d1f7 | 152 | .)b |
a53a5533 RH |
153 | .pp |
154 | The location counter is adjusted | |
155 | so that the | |
156 | .i expression | |
157 | lowest bits of the location counter become zero. | |
158 | This is done by | |
159 | assembling from 0 to $2 sup align\*(USexpr$ bytes, | |
160 | taken from the low order byte of $fill\*(USexpr$. | |
161 | If present, | |
162 | $fill\*(USexpr$ must be absolute; | |
163 | otherwise it defaults to 0. | |
164 | Thus | |
165 | .q ".align 2" | |
166 | pads by null bytes to make the location counter | |
167 | evenly divisible by 4. | |
168 | The | |
169 | .i align_expr | |
170 | must be defined, | |
171 | absolute, nonnegative, | |
172 | and less than 16. | |
173 | .pp | |
174 | Warning: | |
175 | the subsegment concatenation convention | |
176 | and the current loader conventions | |
177 | may not preserve attempts at aligning | |
178 | to more than 2 low-order zero bits. | |
c603d1f7 | 179 | .(b |
a53a5533 RH |
180 | .in -2n |
181 | .TS | |
182 | lb l. | |
183 | \&.org $org\*(USexpr$ [ \fB,\fP $fill\*(USexpr$ ] | |
184 | .TE | |
185 | .in +2n | |
c603d1f7 | 186 | .)b |
a53a5533 RH |
187 | .pp |
188 | The location counter is set equal to the value of $org\*(USexpr$, | |
189 | which must be defined and absolute. | |
190 | The value of the $org\*(USexpr$ | |
191 | must be greater than the current value | |
192 | of the location counter. | |
193 | Space between the current value of the location counter | |
194 | and the desired value are filled with bytes taken from the | |
195 | low order byte of $fill\*(USexpr$, | |
196 | which must be absolute and defaults to 0. | |
c603d1f7 | 197 | .(b |
a53a5533 RH |
198 | .in -2n |
199 | .TS | |
200 | lb l. | |
201 | \&.space $space\*(USexpr$ [ \fB,\fP $fill\*(USexpr$ ] | |
202 | .TE | |
203 | .in +2n | |
c603d1f7 | 204 | .)b |
a53a5533 RH |
205 | .pp |
206 | The location counter is advanced by | |
207 | $space\*(USexpr$ bytes. | |
208 | $Space\*(USexpr$ must be defined and absolute. | |
209 | The space is filled in with bytes taken from the low order | |
210 | byte of $fill\*(USexpr$, | |
211 | which must be defined and absolute. | |
212 | $Fill\*(USexpr$ defaults to 0. | |
213 | The | |
214 | .b .fill | |
215 | directive is a more general way to accomplish the | |
216 | .b .space | |
217 | directive. | |
c603d1f7 | 218 | .(b |
a53a5533 RH |
219 | .in -2n |
220 | .TS | |
221 | lb l. | |
222 | \&.fill $rep\*(USexpr$\fB,\fP $size\*(USexpr$\fB,\fP $fill\*(USexpr$ | |
223 | .TE | |
224 | .in +2n | |
c603d1f7 | 225 | .)b |
a53a5533 RH |
226 | .pp |
227 | All three expressions must be absolute. | |
228 | .i fill\*(USexpr , | |
229 | treated as an expression of size | |
230 | .i size\*(USexpr | |
231 | bytes, | |
232 | is assembled and replicated | |
233 | .i rep\*(USexpr | |
234 | times. | |
235 | The effect is to advance the current location counter | |
236 | .i rep\*(USexpr | |
237 | \(** | |
238 | .i size\*(USexpr | |
239 | bytes. | |
240 | .i size\*(USexpr | |
241 | must be between 1 and 8. | |
242 | .SH 2 "Symbol Definitions" | |
243 | .SH 2 "Initialized Data" | |
c603d1f7 | 244 | .(b |
a53a5533 RH |
245 | .in -2n |
246 | .TS | |
247 | lb l. | |
248 | \&.byte $expr$ [ \fB,\fP $expr$ ] | |
249 | \&.word $expr$ [ \fB,\fP $expr$ ] | |
250 | \&.int $expr$ [ \fB,\fP $expr$ ] | |
251 | \&.long $expr$ [ \fB,\fP $expr$ ] | |
252 | .TE | |
253 | .in +2n | |
c603d1f7 | 254 | .)b |
a53a5533 RH |
255 | .pp |
256 | The | |
257 | .i expression s | |
258 | in the comma-separated | |
259 | list are truncated to the size indicated by the key word: | |
260 | .(b | |
261 | .in -2n | |
262 | .TS | |
263 | center; | |
264 | c l | |
1e8ea4c3 | 265 | cb n. |
a53a5533 RH |
266 | keyword length (bits) |
267 | _ | |
268 | \&.byte 8 | |
269 | \&.word 16 | |
270 | \&.int 32 | |
271 | \&.long 32 | |
272 | .TE | |
273 | .in +2n | |
274 | .)b | |
275 | and assembled in successive locations. | |
190b7e25 RH |
276 | The |
277 | .i expression s | |
278 | must be absolute. | |
279 | .pp | |
280 | Each | |
281 | .i expression | |
282 | may optionally be of the form: | |
283 | .(b | |
284 | .TS | |
285 | center; | |
1e8ea4c3 | 286 | l. |
190b7e25 RH |
287 | $expression sub 1$ : $expression sub 2$ |
288 | .TE | |
289 | .)b | |
290 | In this case, | |
291 | the value of $expression sub 2$ is truncated | |
292 | to $expression sub 1$ bits, | |
293 | and assembled in the next $expression sub 1$ bit field | |
294 | which fits in the natural data size being assembled. | |
295 | Bits which are skipped because a field does not fit are filled with zeros. | |
296 | Thus, | |
297 | .q "\fB.byte\fP 123" | |
1e8ea4c3 | 298 | is equivalent to |
190b7e25 RH |
299 | .q "\fB.byte\fP 8:123" , |
300 | and | |
301 | .q "\fB.byte\fP 3:1,2:1,5:1" | |
302 | assembles two bytes, containing the values 9 and 1. | |
303 | .pp | |
304 | .b NB: | |
305 | Bit field initialization with the colon operator is likely | |
306 | to disappear in future releases of the assembler. | |
c603d1f7 | 307 | .(b |
a53a5533 RH |
308 | .in -2n |
309 | .TS | |
310 | lb l. | |
311 | \&.quad $number$ [ , $number$ ] | |
312 | \&.octa $number$ [ , $number$ ] | |
313 | \&.float $number$ [ , $number$ ] | |
314 | \&.double $number$ [ , $number$ ] | |
315 | \&.ffloat $number$ [ , $number$ ] | |
316 | \&.dfloat $number$ [ , $number$ ] | |
317 | \&.gfloat $number$ [ , $number$ ] | |
318 | \&.hfloat $number$ [ , $number$ ] | |
319 | .TE | |
320 | .in +2n | |
c603d1f7 | 321 | .)b |
a53a5533 | 322 | .pp |
1e8ea4c3 | 323 | These initialize Bignums (see \(sc3.2.2) |
a53a5533 RH |
324 | in successive locations whose size is a function on the key word. |
325 | The type of the Bignums | |
326 | (determined by the exponent field, or lack thereof) | |
327 | may not agree with type implied by the key word. | |
328 | The following table shows the key words, | |
329 | their size, | |
330 | and the data types for the Bignums they expect. | |
331 | .(b | |
332 | .in -2n | |
333 | .TS | |
334 | center; | |
335 | c l l l | |
336 | rb n l l. | |
337 | keyword format length (bits) valid $number$(s) | |
338 | _ | |
339 | \&.quad quad scalar 64 scalar | |
340 | \&.octa octal scalar 128 scalar | |
341 | \&.float F float 32 F, D and scalar | |
342 | \&.ffloat F float 32 F, D and scalar | |
343 | \&.double D float 64 F, D and scalar | |
344 | \&.dfloat D float 64 F, D and scalar | |
345 | \&.gfloat G float 64 G scalar | |
346 | \&.hfloat H float 128 H scalar | |
347 | .TE | |
348 | .in +2n | |
349 | .)b | |
350 | .pp | |
351 | .i As | |
352 | will correctly perform other floating point conversions while initializing, | |
353 | but issues a warning message. | |
354 | .i As | |
355 | performs all floating point initializations and conversions | |
356 | using only the facilities defined | |
357 | in the original (native) architecture. | |
c603d1f7 | 358 | .(b |
a53a5533 RH |
359 | .in -2n |
360 | .TS | |
361 | lb l. | |
362 | \&.ascii $string$ [ , $string$] | |
363 | \&.asciz $string$ [ , $string$] | |
364 | .TE | |
365 | .in +2n | |
c603d1f7 | 366 | .)b |
a53a5533 RH |
367 | .pp |
368 | Each | |
369 | .i string | |
370 | in the list is assembled into successive locations, | |
371 | with the first letter in the string being placed | |
372 | into the first location, etc. | |
373 | The | |
374 | .b .ascii | |
375 | directive will not null pad the string; | |
376 | the | |
377 | .b .asciz | |
378 | directive will null pad the string. | |
379 | (Recall that strings are known by their length, | |
380 | and need not be terminated with a null, | |
381 | and that the \*(CL conventions for escaping are understood.) | |
382 | The | |
383 | .b .ascii | |
384 | directive is identical to: | |
1e8ea4c3 RH |
385 | .br |
386 | .b .byte | |
387 | $string sub 0$ | |
388 | .b , | |
389 | $string sub 1$ | |
390 | .b , | |
391 | $...$ | |
392 | .br | |
c603d1f7 | 393 | .(b |
a53a5533 RH |
394 | .in -2n |
395 | .TS | |
396 | lb l. | |
1e8ea4c3 | 397 | \&.comm $name$\fB,\fP $expression$ |
a53a5533 RH |
398 | .TE |
399 | .in +2n | |
c603d1f7 | 400 | .)b |
a53a5533 RH |
401 | .pp |
402 | Provided the | |
403 | .i name | |
404 | is not defined elsewhere, | |
405 | its type is made | |
406 | .q "undefined external" , | |
407 | and its value is | |
408 | .i expression . | |
409 | In fact the | |
410 | .i name | |
411 | behaves | |
412 | in the current assembly just like an | |
413 | undefined external. | |
414 | However, | |
415 | the link editor | |
416 | .i ld | |
417 | has been special-cased | |
418 | so that all external symbols which are not otherwise defined, | |
419 | and which have a non-zero value, | |
420 | are defined to lie in the bss segment, | |
421 | and enough space is left after the symbol to hold | |
422 | .i expression | |
423 | bytes. | |
c603d1f7 | 424 | .(b |
a53a5533 RH |
425 | .in -2n |
426 | .TS | |
427 | lb l. | |
1e8ea4c3 | 428 | \&.lcomm $name$\fB,\fP $expression$ |
a53a5533 RH |
429 | .TE |
430 | .in +2n | |
c603d1f7 | 431 | .)b |
a53a5533 RH |
432 | .pp |
433 | .i expression | |
434 | bytes will be allocated in the bss segment and | |
435 | .i name | |
436 | assigned the location of the first byte, | |
437 | but the | |
438 | .i name | |
439 | is not declared | |
440 | as global and hence will be unknown to the link editor. | |
c603d1f7 | 441 | .(b |
a53a5533 RH |
442 | .in -2n |
443 | .TS | |
444 | lb l. | |
445 | \&.globl $name$ | |
a53a5533 RH |
446 | .TE |
447 | .in +2n | |
c603d1f7 | 448 | .)b |
a53a5533 RH |
449 | .pp |
450 | This statement makes the | |
451 | .i name | |
452 | external. | |
453 | If it is otherwise defined (by | |
454 | .b .set | |
455 | or by | |
456 | appearance as a label) | |
457 | it acts within the assembly exactly as if | |
458 | the | |
459 | .b .globl | |
460 | statement were not given; | |
461 | however, | |
462 | the link editor may be used | |
463 | to combine this object module with other modules referring to this symbol. | |
464 | .pp | |
465 | Conversely, | |
466 | if the given symbol is not defined | |
467 | within the current assembly, | |
468 | the link editor can combine the output of this assembly | |
469 | with that of others which define the symbol. | |
470 | The assembler makes all otherwise | |
471 | undefined symbols external. | |
c603d1f7 | 472 | .(b |
a53a5533 RH |
473 | .in -2n |
474 | .TS | |
475 | lb l. | |
476 | \&.set $name$\fB,\fP $expression$ | |
477 | .TE | |
478 | .in +2n | |
c603d1f7 | 479 | .)b |
a53a5533 RH |
480 | .pp |
481 | The ($name$, $expression$) | |
482 | pair is entered into the symbol table. | |
483 | Multiple | |
484 | .b .set | |
485 | statements with the same name are legal; | |
486 | the most recent value replaces all previous values. | |
c603d1f7 | 487 | .(b |
a53a5533 RH |
488 | .in -2n |
489 | .TS | |
490 | lb l. | |
1e8ea4c3 | 491 | \&.lsym\& $name$\fB,\fP $expression$ |
a53a5533 RH |
492 | .TE |
493 | .in +2n | |
c603d1f7 | 494 | .)b |
a53a5533 | 495 | .pp |
1e8ea4c3 | 496 | A unique and otherwise unreferencable instance of the |
a53a5533 RH |
497 | ($name$, $expression$) |
498 | pair is created in the symbol table. | |
499 | The Fortran 77 compiler uses this mechanism to pass local symbol definitions | |
500 | to the link editor and debugger. | |
c603d1f7 | 501 | .(b |
a53a5533 RH |
502 | .in -2n |
503 | .TS | |
504 | lb l. | |
505 | \&.stabs $string$, $expr sub 1$, $expr sub 2$, $expr sub 3$, $expr sub 4$ | |
506 | \&.stabn $expr sub 1$, $expr sub 2$, $expr sub 3$, $expr sub 4$ | |
507 | \&.stabd $expr sub 1$, $expr sub 2$, $expr sub 3$ | |
508 | .TE | |
509 | .in +2n | |
c603d1f7 | 510 | .)b |
a53a5533 RH |
511 | .pp |
512 | The | |
513 | .i stab | |
514 | directives place symbols in the symbol table for the symbolic | |
515 | debugger, | |
516 | .i sdb \**. | |
517 | .(f | |
518 | \**Katseff, H.P. | |
519 | .i "Sdb: A Symbol Debugger." | |
520 | Bell Laboratories, Holmdel, | |
521 | NJ. April 12, 1979. | |
522 | .br | |
523 | Katseff, H.P. | |
524 | .i "Symbol Table Format for Sdb", | |
525 | File 39394, | |
1e8ea4c3 | 526 | Bell Laboratories, Holmdel, NJ. March 14, 1979. |
a53a5533 RH |
527 | .)f |
528 | A | |
529 | .q stab | |
530 | is a | |
531 | .i s ymbol | |
532 | .i tab le | |
533 | entry. | |
534 | The | |
535 | .b .stabs | |
536 | is a string stab, the | |
537 | .b .stabn | |
538 | is a stab not having a string, | |
539 | and the | |
540 | .b .stabd | |
541 | is a | |
542 | .q dot | |
543 | stab that implicitly references | |
544 | .q dot , | |
545 | the current location counter. | |
a53a5533 RH |
546 | .pp |
547 | The | |
548 | .i string | |
549 | in the | |
550 | .b .stabs | |
551 | directive is the name of a symbol. | |
552 | If the symbol name is zero, | |
553 | the | |
554 | .b .stabn | |
555 | directive may be used instead. | |
556 | .pp | |
557 | The other expressions are stored | |
558 | in the name list structure | |
559 | of the symbol table | |
560 | and preserved by the loader for reference by | |
561 | .i sdb ; | |
562 | the value of the expressions are peculiar to formats required by | |
563 | .i sdb . | |
564 | .nr ii \w'$expr sub 1$\ \ 'u | |
565 | .ip $expr sub 1$ | |
566 | is used as a symbol table tag | |
567 | (nlist field | |
568 | .i n\*(UStype ). | |
569 | .ip $expr sub 2$ | |
570 | seems to always be zero | |
571 | (nlist field | |
572 | .i n\*(USother ). | |
573 | .ip $expr sub 3$ | |
574 | is used for either the | |
575 | source line number, | |
576 | or for a nesting level | |
577 | (nlist field | |
578 | .i n\*(USdesc ). | |
579 | .ip $expr sub 4$ | |
580 | is used as tag specific information | |
581 | (nlist field | |
582 | .i n\*(USvalue ). | |
583 | In the | |
584 | case of the | |
585 | .b .stabd | |
1e8ea4c3 | 586 | directive, this expression is nonexistent, and |
a53a5533 RH |
587 | is taken to be the value of the location counter |
588 | at the following instruction. | |
589 | Since there is no associated name for a | |
590 | .b .stabd | |
591 | directive, | |
592 | it can | |
593 | only be used in circumstances where the name is zero. | |
594 | The effect of a | |
595 | .b .stabd | |
596 | directive can be achieved by one of the other | |
597 | .b .stab x | |
598 | directives in the following manner: | |
599 | .br | |
600 | $bold .stabn$ $expr sub 1$, $expr sub 2$, $expr sub 3$, $roman LL n$ | |
601 | .br | |
602 | $roman LL n bold :$ | |
603 | .pp | |
604 | The | |
605 | .b .stabd | |
1e8ea4c3 | 606 | directive is preferred, |
a53a5533 RH |
607 | because it does not clog the symbol |
608 | table with labels used only for the stab symbol entries. |