1 .\" $Id: uni_ass.6,v 2.7 1994/06/24 14:02:24 ceriel Exp $
2 .TH UNI_ASS 6 "$Revision: 2.7 $"
5 uni_ass \- universal assembler, assembler\-loader
7 ~em/lib.bin/\fImach\fP/as [options] argument ...
9 The universal assembler is a framework allowing easy
10 generation of an assembler for any byte oriented machine.
11 The framework includes common pseudo instructions for name
12 definition, label usage, storage allocation and initialization
13 and expression evaluation.
14 The resulting program assembles assembly modules.
15 For some machines, it also does the link-editing (loading).
16 Arguments may be flags, assembly language modules, or,
17 in the case of an assembler\-loader,
23 This option controls the listing. Default is no listing.
25 is interpreted as an octal number.
26 Each bit controls part of the listing as follows:
29 0001: addresses in pass 1
30 0002: generated code in pass 1
32 0010: addresses in pass 2
33 0020: generated code in pass 2
34 0040: source lines in pass 2
35 0100: addresses in pass 3
36 0200: generated code in pass 3
37 0400: source lines in pass 3
38 1000: force .list and ignore .nolist
41 Thus bits in 0 to 8 control the listing format and
42 bit 9 forces a complete listing.
45 is omitted or is 000 it is interpreted as 0700.
48 is 1000 it is interpreted as 1700.
50 Note that '-d' alone (unless it contains bit 9)
51 is not enough to get a listing.
52 A .list pseudo is also needed in each module to be listed.
53 Assemblers may be compiled with the listing facilities disabled.
55 This option controls the
56 amount of symbolic debug information generated.
58 is interpreted as an octal number.
59 The bits have the following meaning:
64 004: local, compiler generated labels
65 010: symbols defined in
76 Default is 073: all except local compiler labels.
78 Generate relocation information, for assemblers\-loaders that can.
79 Assemblers always produce relocation information.
81 Turn off branch optimization.
85 is taken as the name of the
87 The default name is \fBa.out\fP.
89 The assembler\-loaders assemble
90 and link together assembly language modules
92 from files and libraries,
93 producing an \fIack.out\fP(5) format file, without relocation information.
94 The assemblers produce a relocatable \fIack.out\fP(5) format file.
96 Two different types of arguments are allowed:
98 Assembly language modules
101 UNIX archives, as maintained by arch(1). These archives must
103 assembly language modules with \fI.define\fP as their first
105 These are only accepted by assembler\-loaders.
108 Note that assembler\-loaders cannot do a partial load;
109 loading starts from assembly language and produces binary
110 machine code. No relocation bits are produced.
111 On the other hand, assemblers produce a relocatable file, to be handled
113 .SH "SECTIONS and TYPES"
114 The statements allocating and initializing space,
115 like instructions and
116 some pseudo-instruction reserve that space in the current
118 The currently reigning type of section is determined by
119 the pseudo-instruction \fI.sect\fP.
120 Actually, the assembler knows nothing about section types. Sections have
121 numbers. The first section met gets number 0, the second gets number 1, etc.
122 Therefore, every assembly files should start with a line just mentioning the
123 sections used in the right order, so that no confusion can arise for \fIled\fP(1).
126 The syntax of expressions is identical to the C expression syntax,
127 except that square brackets are used for grouping.
128 Labels are followed by a colon, and are identifiers or
129 numbers between 0 and 9.
130 Numeric labels can be referenced using the label followed by 'b' of 'f'
131 determining the direction of search, backwards or forwards.
133 Both upper and lower case may be used and are seen as
135 The underscore '_' is considered to be a letter.
137 Identifiers are a sequence of letters and digits, starting with
138 a letter or a period '.'.
139 Identifiers can, only once, receive a value through assignment or a
142 Strings are enclosed in single "'" or double """ quotes.
143 The use of \eddd where ddd is an octal number and \en, \er,
144 \et, \eb and \ef is allowed and has the same meaning as in the
147 Numbers are a sequence of letters and digits, starting with a
149 No difference is made between small and capital letters.
151 The base of the number is determined in the following way:
153 if the number starts with '0x' it is hexadecimal else
154 if the number starts with '0' it is octal else
157 The range of numbers depends on the machine.
158 A rule of the thumb is that the width of the machine's registers
159 the same is as the number of bits allowed in numbers.
161 The character '!' denotes the start of comment, every character
162 up to the next newline is skipped.
163 Exclamation marks in strings are not recognized as the start of
166 Statements are separated by newlines and ';' and can be
167 preceded by label definitions.
168 Label definitions have the form "\fIidentifier\fP:" or
170 Statements can be: empty, an assignment, an instruction or a
173 An assignment has the form:
175 \fIidentifier\fP = \fIexpression\fP
177 The identifier receives the value and type of the expression.
179 The syntax of an instruction depends on the type of the target
181 .IP pseudo-instruction
188 .Pu ".extern \fIidentifier [, identifier]*\fP"
189 The identifiers mentioned in the list are exported and can be
190 used in other modules.
191 .Pu ".define \fIidentifier [, identifier]*\fP"
192 Used for modules that are to be part of a libary.
193 The .define pseudo's should be the first in such modules.
194 When scanning a module in a library the assembler\-loader
195 checks whether any of its unsatified external references is
196 mentioned in a .define list. If so, it includes that module in
198 The identifiers mentioned in the list are exported and can be
199 used in other modules.
200 .Pu ".data1 \fIexpression [, expression]*\fP"
201 Initialize a sequence of bytes.
202 This is not followed by automatic alignment.
203 .Pu ".data2 \fIexpression [, expression]*\fP"
204 Initialize a sequence of shorts (2-byte values).
205 This is not followed by automatic alignment.
206 .Pu ".data4 \fIexpression [, expression]*\fP"
207 Initialize a sequence of longs (4-byte values).
208 This is not followed by automatic alignment.
209 .Pu ".ascii \fIstring\fP"
210 Initialize a sequence of bytes with the value of the bytes in
212 This is not followed by automatic alignment.
213 .Pu ".asciz \fIstring\fP"
214 Initialize a sequence of bytes with the value of the bytes in
215 the string and terminate this with an extra zero byte.
216 This is not followed by automatic alignment.
217 .Pu ".align [\fIexpression\fP]"
218 Adjust the current position to a multiple of the value of the
220 The default is the word-size of the target machine.
221 .Pu ".space \fIexpression\fP"
222 Allocate the indicated amount of bytes.
223 The expression must be absolute.
224 .Pu ".comm \fIname\fP,\fIexpression\fP"
225 Allocate the indicated amount of bytes and assign the location of the first
230 is defined elsewhere.
233 is extern, then assemblers leave definition of
235 to the linkeditor \fIled\fP(1).
237 section name definition.
238 .Pu ".base \fIexpresssion\fP"
239 Set the starting address of the first of the consecutive segments
240 (text) to the value of the expression.
241 The expression must be absolute.
242 .Pu .assert \fIexpression\fP
243 assembly-time assertion checking. Stop with a fatal error message when
244 the value of the expression is zero.
245 .Pu .symb, .line, .file
251 ack(1), arch(1), ack.out(5)
253 Various diagnostics may be produced.
254 The most likely errors, however, are unresolved references,
255 probably caused by the omission of a library argument.
257 The alignment might give rise to internal assertion errors when
258 the alignment requestes is larger than the machine dependent
261 Identifiers declared as externals cannot be used as locals in
262 any following module. This only is a problem for assembler\-loaders.