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