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