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