|
|
1.1 root 1: .pa 1
2: .he '1/15/73''AS (I)'
3: .ti 0
4: NAME as -- assembler
5: .sp
6: .ti 0
7: SYNOPSIS as__ [ -_ ] name918 ...
8: .sp
9: .ti 0
10: DESCRIPTION as__
11: assembles the concatenation of name\d1\u, .... as__
12: is based on the DEC-provided assembler PAL-11R [1], although
13: it was coded locally.
14: Therefore, only the differences will be recorded.
15: .sp
16: If the optional first argument
17: -_ is used,
18: all undefined symbols in the assembly
19: are treated as global.
20: .sp
21: Character changes are:
22: .sp
23: for use
24: @ *
25: # $
26: ; /
27: .sp
28: In as__, the character ";" is a logical new line; several operations
29: may appear on one line if separated by ";".
30: Several new expression operators have been provided:
31: .sp
32: \\> right shift (logical)
33: \\< left shift
34: * multiplication
35: \\/ division
36: .nf
37: % remainder (no longer means "register")
38: | inclusive or
39: .fi
40: ! one's complement
41: [] parentheses for grouping
42: .nf
43: ^ result has value of left, type of right
44: .sp
45: .fi
46: For example location 0 (relocatable) can be written "0^.";
47: another way to denote register 2 is "2^r0".
48:
49: All of the preceding operators are binary; if
50: a left operand is missing, it is taken
51: to be 0.
52: The "!" operator adds its left operand to the one's
53: complement of its right operand.
54:
55: All operators evaluate left-to-right except for
56: the effect of brackets; all operators have the
57: same priority.
58:
59: There is a conditional assembly operation code different
60: from that of PAL-11R (whose conditionals are not provided):
61: .sp
62: .if expression
63: ...
64: .endif
65: .sp
66: If the expression__________ evaluates to non-zero, the section of
67: code between the ".if" and the ".endif" is assembled; otherwise
68: it is ignored. ".if"s may be nested.
69: .sp
70: Temporary labels like those introduced by Knuth [2] may
71: be employed.
72: A temporary label is defined as follows:
73: .sp
74: n:
75: .sp
76: where n_ is a digit 0 ... 9. Symbols of the form "n_f" refer to the
77: first label "n_:" following the use of the symbol; those
78: of the form "n_b" refer to the last "n_:". The same "n_" may
79: be used many times.
80: Labels of this form are less taxing both on the
81: imagination of the programmer and on the symbol table space
82: of the assembler.
83: .sp
84: The PAL-11R opcodes ".word", ".eot" and ".end" are redundant and are omitted.
85: .sp
86: The symbols
87: .sp
88: r0 ... r5
89: fr0 ... fr5 (floating-point registers)
90: sp
91: pc
92: ..
93: .sp
94: are predefined with appropriate values.
95: ".." is the relocation constant and is added to
96: each relocatable reference.
97: On a PDP-11 with relocation hardware, its value is
98: 0; on most systems without protection,
99: its value is 40000(8).
100: .sp
101: The new opcode "sys" is used to specify system
102: calls.
103: Names for system calls are predefined.
104: See section (II).
105: .sp
106: The opcodes "bes" (branch on error set)
107: and "bec" (branch on error clear)
108: are defined to test the error status bit
109: set on return from system calls.
110: .sp
111: Strings of characters may be assembled in a way more
112: convenient than PAL-11's ".ascii" operation (which is,
113: therefore, omitted). Strings are included between the
114: string quotes "<" and ">":
115: .sp
116: <here is a string>
117: .sp
118: Escape sequences exist to enter non graphic
119: and other difficult characters. These sequences are
120: also effective in single and double character constants introduced
121: by single (') and double (") quotes respectively.
122: .sp
123: use___ for___
124: \\n newline (012)
125: \\0 NULL (000)
126: \\> >
127: \\t TAB (011)
128: \\a ACK (006)
129: \\r CR (015)
130: \\p ESC (033)
131: \\\\ \\ (134)
132: .sp
133: as__ provides a primitive segmentation facility.
134: There are three segments: text____, data____ and
135: bss___.
136: The text segment is ordinarily used for
137: code. The data segment is provided
138: for initialized but variable data.
139: The bss segment cannot be initialized, but
140: symbols may be defined to lie within this
141: segment.
142: In the future, it is expected that the
143: text segment will be write-protected and sharable.
144: Assembly begins in the text segment.
145: The pseudo-operations
146:
147: .text
148: .data
149: .bss
150:
151: cause the assembler
152: to switch to the text, data, or bss segment respectively.
153: Segmentation is useful at present
154: for two reasons:
155: Non-initialized
156: tables and variables, if placed
157: in the bss segment, occupy no space in the
158: output file.
159: Also, alternative use of the
160: text and data segments provides a primitive
161: dual location-counter feature.
162:
163: In the output file, all text-segment information comes
164: first, followed by all data-segment information,
165: and finally bss information.
166: Within each segment, information appears in
167: the order written.
168:
169: Note:
170: since nothing explicit can be assembled
171: into the bss segment, the usual appearance
172: of this segment is in the following style:
173:
174: .bss
175: var1: .=.+2
176: tab1: .=.+100.
177: ...
178:
179: That is, space is reserved but nothing explicit
180: is placed in it.
181:
182: As is evident from the example, it is legal to
183: assign to the location counter ".".
184: It is also permissible in segments other than ".bss".
185: The restriction is made, however,
186: that the value so assigned must be defined
187: in the first pass and it must be a value
188: associated with the same segment as ".".
189:
190: The pseudo-op
191:
192: .comm symbol,expression
193:
194: makes symbol______ an undefined global symbol,
195: and places the value of the expression in
196: the value field of the symbol's definition.
197: Thus the above declaration is equivalent to
198:
199: .globl symbol
200: symbol = expression ^ symbol
201:
202: The treatment of such a symbol by the loader ld(I)
203: is as follows:
204: If another routine in the same load defines the symbol to be an ordinary
205: text, data, bss, or absolute symbol,
206: that definition takes precedence and the symbol
207: acts like a normal undefined external.
208: If however no other routine defines the symbol, the loader
209: defines it as an external bss-segment symbol
210: and reserves n_ bytes after its location,
211: where n_ is the value of the expression in the .comm
212: operation.
213: Thus ".comm x,100"
214: effectively declares x to be a common region 100
215: bytes long.
216: Note: all such declarations for the same symbol
217: in various routines should request the same amount
218: of space.
219: .sp
220: The binary output of the assembler is placed on the file "a.out" in the
221: current directory.
222: a.out_____ also contains the symbol table from the assembly
223: and relocation bits.
224: The output of the assembler is executable immediately
225: if the assembly was error-free and if there were no
226: unresolved external references.
227: The link editor ld__ may be used to combine several
228: assembly outputs and resolve global symbols.
229: .sp
230: The assembler does not produce a listing of the source program.
231: This is not a serious drawback; the debugger db__ discussed
232: below is sufficiently powerful to render a printed
233: octal translation of the source unnecessary.
234:
235: On the last pages of this section is a list of all the assembler's
236: built-in symbols.
237: In the case of instructions, the addressing modes
238: are as follows:
239:
240: .nf
241: src, dst source, destination
242: r general register
243: fsrc,fdst floating source, destination
244: fr floating register
245: exp expression
246:
247: .fi
248: The names of certain 11/45 opcodes are different
249: from those in the 11/45 manual
250: to draw analogies with existing 11/20 instructions.
251: ..pa +2
252:
253: .ti 0
254: FILES /etc/as2 pass 2 of the assembler
255: .br
256: /tmp/atm1? temporary
257: .br
258: /tmp/atm2? temporary
259: .br
260: /tmp/atm3? temporary
261: .br
262: a.out object
263: .sp
264: .ti 0
265: SEE ALSO ld(I),
266: nm(I),
267: sh(I),
268: un(I),
269: db(I),
270: a.out(V),
271: [1] PAL-11R Assembler;
272: DEC-11-ASDB-D,
273: [2] Knuth,
274: .ul
275: The Art of Computer Programming,
276: Vol. I; Fundamental Algorithms.,
277: "UNIX Assembler Manual" (in preparation).
278: .sp
279: .ti 0
280: DIAGNOSTICS When
281: an input file cannot be read, its name
282: followed by a question mark is typed and assembly
283: ceases.
284: When syntactic or semantic errors occur, a single-character diagnostic is typed out
285: together with the line number and the file name in which it
286: occurred. Errors in pass 1 cause cancellation of pass 2.
287: The possible errors are:
288: .sp
289: .in +6
290: .ti -6
291: ) parentheses error
292: .ti -6
293: ] parentheses error
294: .ti -6
295: < String not terminated properly
296: .ti -6
297: * Indirection ("*_") used illegally
298: .ti -6
299: .li
300: . Illegal assignment to "."
301: .ti -6
302: A error in A_ddress
303: .ti -6
304: B B_ranch instruction is odd or too remote
305: .ti -6
306: E error in E_xpression
307: .ti -6
308: F error in local ("F_" or "b") type symbol
309: .ti -6
310: G G_arbage (unknown) character
311: .ti -6
312: I End of file inside an If__
313: .ti -6
314: M M_ultiply defined symbol as label
315: .ti -6
316: O O_dd-- word quantity assembled at odd address
317: .ti -6
318: P P_hase error-- "." different in pass 1 and 2
319: .ti -6
320: R R_elocation error
321: .ti -6
322: U U_ndefined symbol
323: .ti -6
324: X syntaX_ error
325: .in -6
326: .sp
327: .ti 0
328: BUGS Symbol table overflow is not checked.
329: .sp
330: If "." is moved backwards by an odd number of bytes,
331: relocation bits are corrupted.
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.