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>
|
|
67 </para>
|
|
68 </section>
|
|
69
|
|
70 <section>
|
|
71 <title>Listing format</title>
|
|
72 <para>
|
|
73 </para>
|
|
74 </section>
|
|
75
|
|
76 <section>
|
|
77 <title>Section Location Counters</title>
|
|
78 <para>
|
|
79 </para>
|
|
80 </section>
|
|
81
|
|
82 <section>
|
|
83 <title>Section Directives</title>
|
|
84 <para>
|
|
85 </para>
|
|
86
|
|
87 <section>
|
|
88 <title>PSECT Directive</title>
|
|
89 <para>
|
563
|
90 The main difference between PSECT and MOD is that MOD sets up
|
|
91 information for OS-9 and PSECT sets up information for the
|
|
92 linker (c.link in the C compiler).
|
530
|
93 </para>
|
563
|
94 <informalexample>
|
|
95 <para>
|
|
96 PSECT {name,typelang,attrrev,edition,stacksize,entrypoint}
|
|
97 </para>
|
|
98 <informaltable frame="none">
|
|
99 <tgroup cols="2">
|
|
100 <colspec colwidth="1in">
|
|
101 <tbody>
|
|
102 <row>
|
|
103 <entry>name</entry>
|
|
104 <entry>Up to 20 bytes (any printable character except space
|
|
105 or comma) for a name to be used by the linker to
|
|
106 identify this PSECT. This name need not be distinct
|
|
107 from all other PSECTs linked together, but it helps
|
|
108 to identify PSECTs the linker has a problem with if
|
|
109 the names are different.</entry>
|
|
110 </row>
|
|
111 <row>
|
|
112 <entry>typelang</entry>
|
|
113 <entry></entry>
|
|
114 </row>
|
|
115 <row>
|
|
116 <entry>attrrev</entry>
|
|
117 <entry></entry>
|
|
118 </row>
|
|
119 <row>
|
|
120 <entry>edition</entry>
|
|
121 <entry></entry>
|
|
122 </row>
|
|
123 <row>
|
|
124 <entry>stacksize</entry>
|
|
125 <entry></entry>
|
|
126 </row>
|
|
127 <row>
|
|
128 <entry>entrypoint</entry>
|
|
129 <entry>word expression entrypoint offset for this PSECT.
|
|
130 If the PSECT is not a mainline odule, this should
|
|
131 be set to zero.</entry>
|
|
132 </row>
|
|
133 </tbody>
|
|
134 </tgroup>
|
|
135 </informaltable>
|
|
136 </informalexample>
|
530
|
137 </section>
|
|
138
|
|
139 <section>
|
|
140 <title>VSECT Directive</title>
|
|
141 <para>
|
|
142 </para>
|
|
143 </section>
|
|
144
|
|
145 <section>
|
|
146 <title>CSECT Directive</title>
|
|
147 <para>
|
|
148 </para>
|
|
149 </section>
|
|
150
|
|
151 <section>
|
|
152 <title>RZB statement</title>
|
|
153 <para>
|
|
154 </para>
|
|
155 </section>
|
|
156 </section>
|
|
157
|
|
158 <section>
|
|
159 <title>Comparison Between Assembly Programs for the Microware Interactive Assember
|
|
160 and the Relocating Macro Assembler</title>
|
|
161 <para>
|
|
162 The following two program examples simply fork a BASIC09. The
|
|
163 purpose of the examples are to show some of the differences in the
|
|
164 new relocating assembler. The differences are apparent.
|
|
165 </para>
|
|
166 <programlisting>
|
|
167 * this program forks a basic09
|
|
168 ifp1
|
|
169 use ..../defs/os9defs.a
|
|
170 endc
|
|
171
|
|
172
|
|
173 </programlisting>
|
|
174 <section>
|
|
175 <title>Macro Interactive Assembler Source</title>
|
|
176 <programlisting>
|
|
177 ifp1
|
|
178 use defsfile
|
|
179
|
|
180 prmsize equ *-prm
|
|
181
|
|
182 siz equ
|
|
183 </programlisting>
|
|
184 </section>
|
|
185 </section>
|
|
186
|
|
187 <section>
|
|
188 <title>Introduction to Macros</title>
|
|
189 <para>
|
|
190 </para>
|
|
191 </section>
|
|
192
|
|
193 <section>
|
|
194 <title>Operations</title>
|
|
195
|
|
196 <section>
|
|
197 <title>Macro Definition</title>
|
|
198 <para>
|
|
199 </para>
|
|
200 </section>
|
|
201
|
|
202 <section>
|
|
203 <title>Nested Macro Calls</title>
|
|
204 <para>
|
|
205 </para>
|
|
206 </section>
|
|
207
|
|
208 <section>
|
|
209 <title>Labels</title>
|
|
210 <para>
|
552
|
211 Sometimes it is necessary to use labels within a macro. Labels are
|
|
212 specified by <quote>\@</quote>. Each time the macro is called, a unique label
|
|
213 will be generated to avoid multiple definition errors. Within the
|
|
214 expanded code <quote>\@</quote> will take on the form <quote>@xxx</quote>, where xxx
|
|
215 will be a decimal number between 000 to 999.
|
|
216 </para>
|
|
217 <para>
|
|
218 More...
|
530
|
219 </para>
|
|
220 </section>
|
|
221
|
|
222 <section>
|
|
223 <title>Additional Pseudo-Instructions</title>
|
563
|
224 <variablelist>
|
|
225 <varlistentry><term>\n</term>
|
|
226 <listitem>
|
530
|
227 <para>
|
563
|
228 will return the number of arguments passed to the macro.
|
530
|
229 </para>
|
563
|
230 </listitem>
|
|
231 </varlistentry>
|
|
232
|
|
233 <varlistentry><term>\L<num></term>
|
|
234 <listitem>
|
|
235 <para>
|
|
236 will return the length of the ith argument
|
|
237 that is specified by <num>.
|
|
238 </para>
|
|
239 </listitem>
|
|
240 </varlistentry>
|
|
241
|
|
242 <varlistentry><term>FAIL</term>
|
|
243 <listitem>
|
|
244 <para>
|
|
245 Causes an error to be generated.
|
|
246 </para>
|
|
247 </listitem>
|
|
248 </varlistentry>
|
|
249
|
|
250 <varlistentry><term>REPT <num></term>
|
|
251 <listitem>
|
|
252 <para>
|
|
253 will repeat an instruction or group of instructions <num> times.
|
|
254 ENDR terminates REPT.
|
|
255 </para>
|
|
256 </listitem>
|
|
257 </varlistentry>
|
|
258
|
|
259 </variablelist>
|
530
|
260 </section>
|
|
261 </section>
|
466
|
262 </appendix>
|