466
|
1 <appendix>
|
|
2 <title>Relocating Macro Assembler Reference</title>
|
|
3 <para>
|
468
|
4 This appendix gives a summary of the operation of the "Relocating
|
|
5 Macro Assembler" (named c.asm as distributed with the C Compiler).
|
|
6 This appendix and the example assembly source files supplied with
|
|
7 the C compiler should provide the basic information on how to use the
|
|
8 "Relocating Macro Assembler" to create relocatable-object format
|
|
9 files (ROF). It is further assumed that you are familiar with the
|
|
10 6809 instruction set and mnemonics. See the Microware Relocating
|
|
11 Assembler Manual for a more detailed description. The main function
|
|
12 of this appendix is to enable the reader to understand the output
|
|
13 produced by c.asm. The Relocating Macro Assembler allows programs
|
|
14 to be compiled separately and then linked together, and it also
|
|
15 allows macros to be defined within programs.
|
|
16 </para>
|
|
17 <para>
|
|
18 Differences between the Relocating Macro Assembler (RMA) and the
|
|
19 Microware Interactive Assembler (MIA):
|
|
20 </para>
|
|
21 <blockquote>
|
|
22 <para>
|
|
23 RMA does not have an interactive mode. Only a disk file is
|
|
24 allowed as input.
|
466
|
25 </para>
|
468
|
26 <para>
|
|
27 RMA output is an ROF file. The ROF file must be processed by
|
|
28 the linker to produce an executable OS9 memory module. The
|
|
29 layout of the ROF file is described later.
|
|
30 </para>
|
|
31 <para>
|
|
32 RMA has a number of new directives to control the placement of
|
|
33 code and data in the executable module. Since RMA does not
|
|
34 produce memory modules, the MIA directives "mod" and "emod" are
|
|
35 not present. Instead, new directives PSECT and VSECT control
|
|
36 the allocation of code and data areas by the linker.
|
|
37 </para>
|
|
38 <para>
|
|
39 RMA has no equivalent to the MIA "setdp" directive. Data (and
|
|
40 DP) allocation is handled by the linker.
|
|
41 </para>
|
|
42 </blockquote>
|
|
43 <section>
|
530
|
44 <title>Symbolic Names</title>
|
468
|
45 <para>
|
|
46 A symbolic name is valid if it consists of from one to nine
|
|
47 uppercase or lowercase characters, decimal digits or the characters
|
|
48 "$", "_", "." or "@". RMA does not fold lowercase letters to
|
|
49 uppercase. The names "Hi.you" and "HI.YOU" are distinct names.
|
|
50 </para>
|
|
51 </section>
|
530
|
52
|
|
53 <section>
|
|
54 <title>Label field</title>
|
|
55 <para>
|
|
56 If a symbolic name in the label field of a source statement is
|
|
57 followed by a <quote>:</quote> (colon), the name will be known
|
|
58 <emphasis>globally</emphasis> (by all modules linked together).
|
|
59 If no colon appears, the name will be known only in the PSECT
|
|
60 in which it was defined. PSECT will be described later.
|
|
61 </para>
|
|
62 </section>
|
|
63
|
|
64 <section>
|
|
65 <title>Undefined names</title>
|
|
66 <para>
|
651
|
67 If a symbolic name is used in an expression and hasn't been defined,
|
|
68 RMA assumes the name is external to the PSECT. RMA will record
|
|
69 information about the reference so the linker can adjust the operand
|
|
70 accordingly. External names cannot appear in operand expressions
|
|
71 for assembler directives.
|
530
|
72 </para>
|
|
73 </section>
|
|
74
|
|
75 <section>
|
|
76 <title>Listing format</title>
|
651
|
77 <programlisting>
|
|
78 00098 0032 59 + rolb
|
|
79 00117 0045=17ffb8 label lbsr _dmove Comment
|
|
80 ^ ^ ^^ ^ ^ ^ ^ ^
|
|
81 | | || | | | | Start of comment
|
|
82 | | || | | | Start of operand
|
|
83 | | || | | Start of mnemonic
|
|
84 | | || | Start of label
|
|
85 | | || A "+" indicates a line generated by a macro
|
|
86 | | || expansion.
|
|
87 | | |Start of object code bytes.
|
|
88 | | An "=" here indicates that the operand contains an
|
|
89 | | external reference.
|
|
90 | Location counter value
|
|
91 Line number.
|
|
92 </programlisting>
|
530
|
93 </section>
|
|
94
|
|
95 <section>
|
|
96 <title>Section Location Counters</title>
|
|
97 <para>
|
|
98 </para>
|
|
99 </section>
|
|
100
|
|
101 <section>
|
|
102 <title>Section Directives</title>
|
|
103 <para>
|
|
104 </para>
|
|
105
|
|
106 <section>
|
|
107 <title>PSECT Directive</title>
|
|
108 <para>
|
563
|
109 The main difference between PSECT and MOD is that MOD sets up
|
|
110 information for OS-9 and PSECT sets up information for the
|
|
111 linker (c.link in the C compiler).
|
530
|
112 </para>
|
563
|
113 <informalexample>
|
|
114 <para>
|
|
115 PSECT {name,typelang,attrrev,edition,stacksize,entrypoint}
|
|
116 </para>
|
|
117 <informaltable frame="none">
|
|
118 <tgroup cols="2">
|
633
|
119 <colspec colwidth="0.8in"/>
|
|
120 <colspec colwidth="3.2in"/>
|
563
|
121 <tbody>
|
|
122 <row>
|
|
123 <entry>name</entry>
|
|
124 <entry>Up to 20 bytes (any printable character except space
|
|
125 or comma) for a name to be used by the linker to
|
|
126 identify this PSECT. This name need not be distinct
|
|
127 from all other PSECTs linked together, but it helps
|
|
128 to identify PSECTs the linker has a problem with if
|
|
129 the names are different.</entry>
|
|
130 </row>
|
|
131 <row>
|
|
132 <entry>typelang</entry>
|
|
133 <entry></entry>
|
|
134 </row>
|
|
135 <row>
|
|
136 <entry>attrrev</entry>
|
|
137 <entry></entry>
|
|
138 </row>
|
|
139 <row>
|
|
140 <entry>edition</entry>
|
|
141 <entry></entry>
|
|
142 </row>
|
|
143 <row>
|
|
144 <entry>stacksize</entry>
|
|
145 <entry></entry>
|
|
146 </row>
|
|
147 <row>
|
|
148 <entry>entrypoint</entry>
|
|
149 <entry>word expression entrypoint offset for this PSECT.
|
|
150 If the PSECT is not a mainline odule, this should
|
|
151 be set to zero.</entry>
|
|
152 </row>
|
|
153 </tbody>
|
|
154 </tgroup>
|
|
155 </informaltable>
|
|
156 </informalexample>
|
530
|
157 </section>
|
|
158
|
|
159 <section>
|
|
160 <title>VSECT Directive</title>
|
|
161 <para>
|
|
162 </para>
|
|
163 </section>
|
|
164
|
|
165 <section>
|
|
166 <title>CSECT Directive</title>
|
|
167 <para>
|
|
168 </para>
|
|
169 </section>
|
|
170
|
|
171 <section>
|
|
172 <title>RZB statement</title>
|
|
173 <para>
|
|
174 </para>
|
|
175 </section>
|
|
176 </section>
|
|
177
|
|
178 <section>
|
|
179 <title>Comparison Between Assembly Programs for the Microware Interactive Assember
|
|
180 and the Relocating Macro Assembler</title>
|
|
181 <para>
|
|
182 The following two program examples simply fork a BASIC09. The
|
|
183 purpose of the examples are to show some of the differences in the
|
|
184 new relocating assembler. The differences are apparent.
|
|
185 </para>
|
|
186 <programlisting>
|
|
187 * this program forks a basic09
|
|
188 ifp1
|
|
189 use ..../defs/os9defs.a
|
|
190 endc
|
|
191
|
|
192
|
|
193 </programlisting>
|
|
194 <section>
|
|
195 <title>Macro Interactive Assembler Source</title>
|
|
196 <programlisting>
|
|
197 ifp1
|
|
198 use defsfile
|
|
199
|
|
200 prmsize equ *-prm
|
|
201
|
|
202 siz equ
|
|
203 </programlisting>
|
|
204 </section>
|
|
205 </section>
|
|
206
|
|
207 <section>
|
|
208 <title>Introduction to Macros</title>
|
|
209 <para>
|
|
210 </para>
|
|
211 </section>
|
|
212
|
|
213 <section>
|
|
214 <title>Operations</title>
|
|
215
|
|
216 <section>
|
|
217 <title>Macro Definition</title>
|
|
218 <para>
|
|
219 </para>
|
|
220 </section>
|
|
221
|
|
222 <section>
|
|
223 <title>Nested Macro Calls</title>
|
|
224 <para>
|
|
225 </para>
|
|
226 </section>
|
|
227
|
|
228 <section>
|
|
229 <title>Labels</title>
|
|
230 <para>
|
552
|
231 Sometimes it is necessary to use labels within a macro. Labels are
|
|
232 specified by <quote>\@</quote>. Each time the macro is called, a unique label
|
|
233 will be generated to avoid multiple definition errors. Within the
|
|
234 expanded code <quote>\@</quote> will take on the form <quote>@xxx</quote>, where xxx
|
|
235 will be a decimal number between 000 to 999.
|
|
236 </para>
|
|
237 <para>
|
|
238 More...
|
530
|
239 </para>
|
|
240 </section>
|
|
241
|
|
242 <section>
|
|
243 <title>Additional Pseudo-Instructions</title>
|
563
|
244 <variablelist>
|
|
245 <varlistentry><term>\n</term>
|
|
246 <listitem>
|
530
|
247 <para>
|
563
|
248 will return the number of arguments passed to the macro.
|
530
|
249 </para>
|
563
|
250 </listitem>
|
|
251 </varlistentry>
|
|
252
|
|
253 <varlistentry><term>\L<num></term>
|
|
254 <listitem>
|
|
255 <para>
|
|
256 will return the length of the ith argument
|
|
257 that is specified by <num>.
|
|
258 </para>
|
|
259 </listitem>
|
|
260 </varlistentry>
|
|
261
|
|
262 <varlistentry><term>FAIL</term>
|
|
263 <listitem>
|
|
264 <para>
|
|
265 Causes an error to be generated.
|
|
266 </para>
|
|
267 </listitem>
|
|
268 </varlistentry>
|
|
269
|
|
270 <varlistentry><term>REPT <num></term>
|
|
271 <listitem>
|
|
272 <para>
|
|
273 will repeat an instruction or group of instructions <num> times.
|
|
274 ENDR terminates REPT.
|
|
275 </para>
|
|
276 </listitem>
|
|
277 </varlistentry>
|
|
278
|
|
279 </variablelist>
|
530
|
280 </section>
|
|
281 </section>
|
466
|
282 </appendix>
|