annotate old-trunk/doc/manual.docbook.sgml @ 339:eb230fa7d28e

Prepare for migration to hg
author lost
date Fri, 19 Mar 2010 02:54:14 +0000
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
339
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1 <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook V4.5//EN">
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
2 <book>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
3 <bookinfo>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
4 <title>LW Tool Chain</title>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
5 <author><firstname>William</firstname><surname>Astle</surname></author>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
6 <copyright><year>2009</year><holder>William Astle</holder></copyright>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
7 </bookinfo>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
8 <chapter>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
9
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
10 <title>Introduction</title>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
11
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
12 <para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
13 The LW tool chain provides utilities for building binaries for MC6809 and
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
14 HD6309 CPUs. The tool chain includes a cross-assembler and a cross-linker
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
15 which support several styles of output.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
16 </para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
17
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
18 <section>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
19 <title>History</title>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
20 <para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
21 For a long time, I have had an interest in creating an operating system for
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
22 the Coco3. I finally started working on that project around the beginning of
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
23 2006. I had a number of assemblers I could choose from. Eventually, I settled
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
24 on one and started tinkering. After a while, I realized that assembler was not
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
25 going to be sufficient due to lack of macros and issues with forward references.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
26 Then I tried another which handled forward references correctly but still did
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
27 not support macros. I looked around at other assemblers and they all lacked
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
28 one feature or another that I really wanted for creating my operating system.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
29 </para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
30
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
31 <para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
32 The solution seemed clear at that point. I am a fair programmer so I figured
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
33 I could write an assembler that would do everything I wanted an assembler to
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
34 do. Thus the LWASM probject was born. After more than two years of on and off
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
35 work, version 1.0 of LWASM was released in October of 2008.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
36 </para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
37
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
38 <para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
39 As the aforementioned operating system project progressed further, it became
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
40 clear that while assembling the whole project through a single file was doable,
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
41 it was not practical. When I found myself playing some fancy games with macros
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
42 in a bid to simulate sections, I realized I needed a means of assembling
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
43 source files separately and linking them later. This spawned a major development
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
44 effort to add an object file support to LWASM. It also spawned the LWLINK
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
45 project to provide a means to actually link the files.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
46 </para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
47
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
48 </section>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
49
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
50 </chapter>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
51
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
52 <chapter>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
53 <title>Output Formats</title>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
54
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
55 <para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
56 The LW tool chain supports multiple output formats. Each format has its
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
57 advantages and disadvantages. Each format is described below.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
58 </para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
59
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
60 <section>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
61 <title>Raw Binaries</title>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
62 <para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
63 A raw binary is simply a string of bytes. There are no headers or other
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
64 niceties. Both LWLINK and LWASM support generating raw binaries. ORG directives
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
65 in the source code only serve to set the addresses that will be used for
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
66 symbols but otherwise have no direct impact on the resulting binary.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
67 </para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
68
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
69 </section>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
70 <section>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
71 <title>DECB Binaries</title>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
72
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
73 <para>A DECB binary is compatible with the LOADM command in Disk Extended
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
74 Color Basic on the CoCo. They are also compatible with CLOADM from Extended
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
75 Color Basic. These binaries include the load address of the binary as well
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
76 as encoding an execution address. These binaries may contain multiple loadable
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
77 sections, each of which has its own load address.</para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
78
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
79 <para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
80 Each binary starts with a preamble. Each preamble is five bytes long. The
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
81 first byte is zero. The next two bytes specify the number of bytes to load
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
82 and the last two bytes specify the address to load the bytes at. Then, a
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
83 string of bytes follows. After this string of bytes, there may be another
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
84 preamble or a postamble. A postamble is also five bytes in length. The first
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
85 byte of the postamble is $FF, the next two are zero, and the last two are
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
86 the execution address for the binary.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
87 </para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
88
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
89 <para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
90 Both LWASM and LWLINK can output this format.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
91 </para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
92 </section>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
93
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
94 <section>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
95 <title>OS9 Modules</title>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
96 <para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
97
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
98 Since version 2.5, LWASM is able to generate OS9 modules. The syntax is
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
99 basically the same as for other assemblers. A module starts with the MOD
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
100 directive and ends with the EMOD directive. The OS9 directive is provided
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
101 as a shortcut for writing system calls.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
102
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
103 </para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
104
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
105 <para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
106
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
107 LWASM does NOT provide an OS9Defs file. You must provide your own. Also note
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
108 that the common practice of using "ifp1" around the inclusion of the OS9Defs
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
109 file is discouraged as it is pointless and can lead to unintentional
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
110 problems and phasing errors. Because LWASM reads each file exactly once,
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
111 there is no benefit to restricting the inclusion to the first assembly pass.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
112
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
113 </para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
114
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
115 <para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
116
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
117 It is also critical to understand that unlike many OS9 assemblers, LWASM
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
118 does NOT maintain a separate data address counter. Thus, you must define
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
119 all your data offsets and so on outside of the mod/emod segment. It is,
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
120 therefore, likely that source code targeted at other assemblers will require
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
121 edits to build correctly.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
122
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
123 </para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
124
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
125 <para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
126
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
127 LWLINK does not, yet, have the ability to create OS9 modules from object
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
128 files.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
129
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
130 </para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
131 </section>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
132
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
133 <section>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
134 <title>Object Files</title>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
135 <para>LWASM supports generating a proprietary object file format which is
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
136 described in <xref linkend="objchap">. LWLINK is then used to link these
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
137 object files into a final binary in any of LWLINK's supported binary
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
138 formats.</para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
139
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
140 <para>Object files also support the concept of sections which are not valid
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
141 for other output types. This allows related code from each object file
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
142 linked to be collapsed together in the final binary.</para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
143
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
144 <para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
145 Object files are very flexible in that they allow references that are not
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
146 known at assembly time to be resolved at link time. However, because the
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
147 addresses of such references are not known at assembly time, there is no way
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
148 for the assembler to deduce that an eight bit addressing mode is possible.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
149 That means the assember will default to using sixteen bit addressing
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
150 whenever an external or cross-section reference is used.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
151 </para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
152
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
153 <para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
154 As of LWASM 2.4, it is possible to force direct page addressing for an
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
155 external reference. Care must be taken to ensure the resulting addresses
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
156 are really in the direct page since the linker does not know what the direct
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
157 page is supposed to be and does not emit errors for byte overflows.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
158 </para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
159
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
160 <para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
161 It is also possible to use external references in an eight bit immediate
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
162 mode instruction. In this case, only the low order eight bits will be used.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
163 Again, no byte overflows will be flagged.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
164 </para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
165
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
166
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
167 </section>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
168
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
169 </chapter>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
170
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
171 <chapter>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
172 <title>LWASM</title>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
173 <para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
174 The LWTOOLS assembler is called LWASM. This chapter documents the various
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
175 features of the assembler. It is not, however, a tutorial on 6x09 assembly
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
176 language programming.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
177 </para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
178
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
179 <section>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
180 <title>Command Line Options</title>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
181 <para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
182 The binary for LWASM is called "lwasm". Note that the binary is in lower
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
183 case. lwasm takes the following command line arguments.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
184 </para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
185
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
186 <variablelist>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
187
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
188 <varlistentry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
189 <term><option>--6309</option></term>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
190 <term><option>-3</option></term>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
191 <listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
192 <para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
193 This will cause the assembler to accept the additional instructions available
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
194 on the 6309 processor. This is the default mode; this option is provided for
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
195 completeness and to override preset command arguments.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
196 </para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
197 </listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
198 </varlistentry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
199
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
200 <varlistentry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
201 <term><option>--6809</option></term>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
202 <term><option>-9</option></term>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
203 <listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
204 <para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
205 This will cause the assembler to reject instructions that are only available
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
206 on the 6309 processor.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
207 </para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
208 </listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
209 </varlistentry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
210
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
211 <varlistentry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
212 <term><option>--decb</option></term>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
213 <term><option>-b</option></term>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
214 <listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
215 <para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
216 Select the DECB output format target. Equivalent to <option>--format=decb</option>.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
217 </para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
218 </listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
219 </varlistentry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
220
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
221 <varlistentry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
222 <term><option>--format=type</option></term>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
223 <term><option>-f type</option></term>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
224 <listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
225 <para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
226 Select the output format. Valid values are <option>obj</option> for the
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
227 object file target, <option>decb</option> for the DECB LOADM format,
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
228 <option>os9</option> for creating OS9 modules, and <option>raw</option> for
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
229 a raw binary.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
230 </para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
231 </listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
232 </varlistentry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
233
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
234 <varlistentry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
235 <term><option>--list[=file]</option></term>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
236 <term><option>-l[file]</option></term>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
237 <listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
238 <para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
239 Cause LWASM to generate a listing. If <option>file</option> is specified,
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
240 the listing will go to that file. Otherwise it will go to the standard output
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
241 stream. By default, no listing is generated.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
242 </para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
243 </listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
244 </varlistentry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
245
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
246 <varlistentry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
247 <term><option>--obj</option></term>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
248 <listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
249 <para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
250 Select the proprietary object file format as the output target.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
251 </para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
252 </listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
253 </varlistentry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
254
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
255 <varlistentry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
256 <term><option>--output=FILE</option></term>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
257 <term><option>-o FILE</option></term>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
258 <listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
259 <para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
260 This option specifies the name of the output file. If not specified, the
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
261 default is <option>a.out</option>.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
262 </para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
263 </listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
264 </varlistentry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
265
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
266 <varlistentry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
267 <term><option>--pragma=pragma</option></term>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
268 <term><option>-p pragma</option></term>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
269 <listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
270 <para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
271 Specify assembler pragmas. Multiple pragmas are separated by commas. The
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
272 pragmas accepted are the same as for the PRAGMA assembler directive described
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
273 below.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
274 </para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
275 </listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
276 </varlistentry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
277
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
278 <varlistentry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
279 <term><option>--raw</option></term>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
280 <term><option>-r</option></term>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
281 <listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
282 <para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
283 Select raw binary as the output target.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
284 </para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
285 </listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
286 </varlistentry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
287
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
288 <varlistentry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
289 <term><option>--help</option></term>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
290 <term><option>-?</option></term>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
291 <listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
292 <para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
293 Present a help screen describing the command line options.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
294 </para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
295 </listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
296 </varlistentry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
297
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
298 <varlistentry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
299 <term><option>--usage</option></term>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
300 <listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
301 <para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
302 Provide a summary of the command line options.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
303 </para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
304 </listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
305 </varlistentry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
306
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
307 <varlistentry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
308 <term><option>--version</option></term>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
309 <term><option>-V</option></term>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
310 <listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
311 <para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
312 Display the software version.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
313 </para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
314 </listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
315 </varlistentry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
316
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
317 <varlistentry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
318 <term><option>--debug</option></term>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
319 <term><option>-d</option></term>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
320 <listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
321 <para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
322 Increase the debugging level. Only really useful to people hacking on the
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
323 LWASM source code itself.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
324 </para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
325 </listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
326 </varlistentry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
327
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
328 </variablelist>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
329
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
330 </section>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
331
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
332 <section>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
333 <title>Dialects</title>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
334 <para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
335 LWASM supports all documented MC6809 instructions as defined by Motorola.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
336 It also supports all known HD6309 instructions. While there is general
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
337 agreement on the pneumonics for most of the 6309 instructions, there is some
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
338 variance with the block transfer instructions. TFM for all four variations
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
339 seems to have gained the most traction and, thus, this is the form that is
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
340 recommended for LWASM. However, it also supports COPY, COPY-, IMP, EXP,
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
341 TFRP, TFRM, TFRS, and TFRR. It further adds COPY+ as a synomym for COPY,
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
342 IMPLODE for IMP, and EXPAND for EXP.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
343 </para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
344
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
345 <para>By default, LWASM accepts 6309 instructions. However, using the
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
346 <parameter>--6809</parameter> parameter, you can cause it to throw errors on
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
347 6309 instructions instead.</para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
348
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
349 <para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
350 The standard addressing mode specifiers are supported. These are the
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
351 hash sign ("#") for immediate mode, the less than sign ("&lt;") for forced
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
352 eight bit modes, and the greater than sign ("&gt;") for forced sixteen bit modes.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
353 </para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
354
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
355 <para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
356 Additionally, LWASM supports using the asterisk ("*") to indicate
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
357 base page addressing. This should not be used in hand-written source code,
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
358 however, because it is non-standard and may or may not be present in future
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
359 versions of LWASM.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
360 </para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
361
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
362 </section>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
363
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
364 <section>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
365 <title>Source Format</title>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
366
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
367 <para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
368 LWASM accepts plain text files in a relatively free form. It can handle
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
369 lines terminated with CR, LF, CRLF, or LFCR which means it should be able
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
370 to assemble files on any platform on which it compiles.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
371 </para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
372 <para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
373 Each line may start with a symbol. If a symbol is present, there must not
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
374 be any whitespace preceding it. It is legal for a line to contain nothing
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
375 but a symbol.</para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
376 <para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
377 The op code is separated from the symbol by whitespace. If there is
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
378 no symbol, there must be at least one white space character preceding it.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
379 If applicable, the operand follows separated by whitespace. Following the
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
380 opcode and operand is an optional comment.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
381 </para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
382 <para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
383 A comment can also be introduced with a * or a ;. The comment character is
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
384 optional for end of statement comments. However, if a symbol is the only
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
385 thing present on the line other than the comment, the comment character is
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
386 mandatory to prevent the assembler from interpreting the comment as an opcode.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
387 </para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
388
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
389 <para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
390 For compatibility with the output generated by some C preprocessors, LWASM
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
391 will also ignore lines that begin with a #. This should not be used as a general
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
392 comment character, however.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
393 </para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
394
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
395 <para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
396 The opcode is not treated case sensitively. Neither are register names in
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
397 the operand fields. Symbols, however, are case sensitive.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
398 </para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
399
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
400 <para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
401 LWASM does not support line numbers in the file.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
402 </para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
403
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
404 </section>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
405
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
406 <section>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
407 <title>Symbols</title>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
408
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
409 <para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
410 Symbols have no length restriction. They may contain letters, numbers, dots,
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
411 dollar signs, and underscores. They must start with a letter, dot, or
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
412 underscore.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
413 </para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
414
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
415 <para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
416 LWASM also supports the concept of a local symbol. A local symbol is one
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
417 which contains either a "?" or a "@", which can appear anywhere in the symbol.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
418 The scope of a local symbol is determined by a number of factors. First,
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
419 each included file gets its own local symbol scope. A blank line will also
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
420 be considered a local scope barrier. Macros each have their own local symbol
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
421 scope as well (which has a side effect that you cannot use a local symbol
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
422 as an argument to a macro). There are other factors as well. In general,
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
423 a local symbol is restricted to the block of code it is defined within.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
424 </para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
425
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
426 <para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
427 By default, unless assembling to the os9 target, a "$" in the symbol will
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
428 also make it local. This can be controlled by the "dollarlocal" and
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
429 "nodollarlocal" pragmas. In the absence of a pragma to the contrary, For
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
430 the os9 target, a "$" in the symbol will not make it considered local while
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
431 for all other targets it will.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
432 </para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
433
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
434 </section>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
435
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
436 <section>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
437 <title>Numbers and Expressions</title>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
438 <para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
439
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
440 Numbers can be expressed in binary, octal, decimal, or hexadecimal. Binary
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
441 numbers may be prefixed with a "%" symbol or suffixed with a "b" or "B".
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
442 Octal numbers may be prefixed with "@" or suffixed with "Q", "q", "O", or
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
443 "o". Hexadecimal numbers may be prefixed with "$", "0x" or "0X", or suffixed
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
444 with "H". No prefix or suffix is required for decimal numbers but they can
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
445 be prefixed with "&amp;" if desired. Any constant which begins with a letter
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
446 must be expressed with the correct prefix base identifier or be prefixed
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
447 with a 0. Thus hexadecimal FF would have to be written either 0FFH or $FF.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
448 Numbers are not case sensitive.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
449
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
450 </para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
451
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
452 <para> A symbol may appear at any point where a number is acceptable. The
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
453 special symbol "*" can be used to represent the starting address of the
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
454 current source line within expressions. </para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
455
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
456 <para>The ASCII value of a character can be included by prefixing it with a
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
457 single quote ('). The ASCII values of two characters can be included by
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
458 prefixing the characters with a quote (").</para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
459
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
460 <para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
461
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
462 LWASM supports the following basic binary operators: +, -, *, /, and %.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
463 These represent addition, subtraction, multiplication, division, and
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
464 modulus. It also supports unary negation and unary 1's complement (- and ^
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
465 respectively). It is also possible to use ~ for the unary 1's complement
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
466 operator. For completeness, a unary positive (+) is supported though it is
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
467 a no-op. LWASM also supports using |, &, and ^ for bitwise or, bitwise and,
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
468 and bitwise exclusive or respectively.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
469
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
470 </para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
471
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
472 <para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
473
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
474 Operator precedence follows the usual rules. Multiplication, division, and
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
475 modulus take precedence over addition and subtraction. Unary operators take
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
476 precedence over binary operators. Bitwise operators are lower precdence
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
477 than addition and subtraction. To force a specific order of evaluation,
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
478 parentheses can be used in the usual manner.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
479
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
480 </para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
481
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
482 <para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
483
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
484 As of LWASM 2.5, the operators && and || are recognized for boolean and and
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
485 boolean or respectively. They will return either 0 or 1 (false or true).
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
486 They have the lowest precedence of all the binary operators.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
487
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
488 </para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
489
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
490 </section>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
491
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
492 <section>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
493 <title>Assembler Directives</title>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
494 <para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
495 Various directives can be used to control the behaviour of the
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
496 assembler or to include non-code/data in the resulting output. Those directives
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
497 that are not described in detail in other sections of this document are
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
498 described below.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
499 </para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
500
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
501 <section>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
502 <title>Data Directives</title>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
503 <variablelist>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
504 <varlistentry><term>FCB <parameter>expr[,...]</parameter></term>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
505 <term>.DB <parameter>expr[,...]</parameter></term>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
506 <term>.BYTE <parameter>expr[,...]</parameter></term>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
507 <listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
508 <para>Include one or more constant bytes (separated by commas) in the output.</para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
509 </listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
510 </varlistentry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
511
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
512 <varlistentry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
513 <term>FDB <parameter>expr[,...]</parameter></term>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
514 <term>.DW <parameter>expr[,...]</parameter></term>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
515 <term>.WORD <parameter>expr[,...]</parameter></term>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
516 <listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
517 <para>Include one or more words (separated by commas) in the output.</para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
518 </listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
519 </varlistentry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
520
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
521 <varlistentry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
522 <term>FQB <parameter>expr[,...]</parameter></term>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
523 <term>.QUAD <parameter>expr[,...]</parameter></term>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
524 <term>.4BYTE <parameter>expr[,...]</parameter></term>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
525 <listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
526 <para>Include one or more double words (separated by commas) in the output.</para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
527 </listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
528 </varlistentry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
529
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
530 <varlistentry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
531 <term>FCC <parameter>string</parameter></term>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
532 <term>.ASCII <parameter>string</parameter></term>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
533 <term>.STR <parameter>string</parameter></term>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
534 <listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
535 <para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
536 Include a string of text in the output. The first character of the operand
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
537 is the delimiter which must appear as the last character and cannot appear
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
538 within the string. The string is included with no modifications>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
539 </para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
540 </listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
541 </varlistentry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
542
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
543 <varlistentry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
544 <term>FCN <parameter>string</parameter></term>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
545 <term>.ASCIZ <parameter>string</parameter></term>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
546 <term>.STRZ <parameter>string</parameter></term>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
547 <listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
548 <para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
549 Include a NUL terminated string of text in the output. The first character of
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
550 the operand is the delimiter which must appear as the last character and
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
551 cannot appear within the string. A NUL byte is automatically appended to
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
552 the string.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
553 </para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
554 </listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
555 </varlistentry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
556
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
557 <varlistentry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
558 <term>FCS <parameter>string</parameter></term>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
559 <term>.ASCIS <parameter>string</parameter></term>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
560 <term>.STRS <parameter>string</parameter></term>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
561 <listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
562 <para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
563 Include a string of text in the output with bit 7 of the final byte set. The
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
564 first character of the operand is the delimiter which must appear as the last
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
565 character and cannot appear within the string.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
566 </para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
567 </listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
568 </varlistentry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
569
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
570 <varlistentry><term>ZMB <parameter>expr</parameter></term>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
571 <listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
572 <para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
573 Include a number of NUL bytes in the output. The number must be fully resolvable
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
574 during pass 1 of assembly so no forward or external references are permitted.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
575 </para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
576 </listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
577 </varlistentry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
578
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
579 <varlistentry><term>ZMD <parameter>expr</parameter></term>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
580 <listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
581 <para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
582 Include a number of zero words in the output. The number must be fully
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
583 resolvable during pass 1 of assembly so no forward or external references are
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
584 permitted.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
585 </para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
586 </listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
587 </varlistentry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
588
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
589 <varlistentry><term>ZMQ <parameter>expr<parameter></term>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
590 <listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
591 <para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
592 Include a number of zero double-words in the output. The number must be fully
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
593 resolvable during pass 1 of assembly so no forward or external references are
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
594 permitted.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
595 </para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
596 </listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
597 </varlistentry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
598
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
599 <varlistentry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
600 <term>RMB <parameter>expr</parameter></term>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
601 <term>.BLKB <parameter>expr</parameter></term>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
602 <term>.DS <parameter>expr</parameter></term>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
603 <term>.RS <parameter>expr</parameter></term>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
604 <listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
605 <para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
606 Reserve a number of bytes in the output. The number must be fully resolvable
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
607 during pass 1 of assembly so no forward or external references are permitted.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
608 The value of the bytes is undefined.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
609 </para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
610 </listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
611 </varlistentry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
612
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
613 <varlistentry><term>RMD <parameter>expr</parameter></term>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
614 <listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
615 <para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
616 Reserve a number of words in the output. The number must be fully
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
617 resolvable during pass 1 of assembly so no forward or external references are
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
618 permitted. The value of the words is undefined.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
619 </para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
620 </listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
621 </varlistentry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
622
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
623 <varlistentry><term>RMQ <parameter>expr</parameter></term>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
624 <listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
625 <para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
626 Reserve a number of double-words in the output. The number must be fully
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
627 resolvable during pass 1 of assembly so no forward or external references are
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
628 permitted. The value of the double-words is undefined.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
629 </para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
630 </listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
631 </varlistentry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
632
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
633 <varlistentry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
634 <term>INCLUDEBIN <parameter>filename</parameter></term>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
635 <listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
636 <para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
637 Treat the contents of <parameter>filename</parameter> as a string of bytes to
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
638 be included literally at the current assembly point. This has the same effect
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
639 as converting the file contents to a series of FCB statements and including
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
640 those at the current assembly point.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
641 </para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
642 </listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
643 </varlistentry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
644
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
645 </variablelist>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
646
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
647 </section>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
648
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
649 <section>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
650 <title>Address Definition</title>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
651 <para>The directives in this section all control the addresses of symbols
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
652 or the assembly process itself.</para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
653
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
654 <variablelist>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
655 <varlistentry><term>ORG <parameter>expr</parameter></term>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
656 <listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
657 <para>Set the assembly address. The address must be fully resolvable on the
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
658 first pass so no external or forward references are permitted. ORG is not
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
659 permitted within sections when outputting to object files. For the DECB
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
660 target, each ORG directive after which output is generated will cause
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
661 a new preamble to be output. ORG is only used to determine the addresses
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
662 of symbols when the raw target is used.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
663 </para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
664 </listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
665 </varlistentry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
666
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
667 <varlistentry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
668 <term><parameter>sym</parameter> EQU <parameter>expr</parameter></term>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
669 <term><parameter>sym</parameter> = <parameter>expr</parameter></term>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
670 <listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
671 <para>Define the value of <parameter>sym</parameter> to be <parameter>expr</parameter>.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
672 </listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
673 </varlistentry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
674
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
675 <varlistentry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
676 <term><parameter>sym</parameter> SET <parameter>expr</parameter></term>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
677 <listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
678 <para>Define the value of <parameter>sym</parameter> to be <parameter>expr</parameter>.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
679 Unlike EQU, SET permits symbols to be defined multiple times as long as SET
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
680 is used for all instances. Use of the symbol before the first SET statement
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
681 that sets its value is undefined.</para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
682 </listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
683 </varlistentry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
684
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
685 <varlistentry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
686 <term>SETDP <parameter>expr</parameter></term>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
687 <listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
688 <para>Inform the assembler that it can assume the DP register contains
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
689 <parameter>expr</parameter>. This directive is only advice to the assembler
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
690 to determine whether an address is in the direct page and has no effect
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
691 on the contents of the DP register. The value must be fully resolved during
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
692 the first assembly pass because it affects the sizes of subsequent instructions.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
693 </para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
694 <para>This directive has no effect in the object file target.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
695 </para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
696 </listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
697 </varlistentry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
698
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
699 <varlistentry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
700 <term>ALIGN <parameter>expr</parameter>[,<parameter>value</parameter>]</term>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
701 <listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
702
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
703 <para>Force the current assembly address to be a multiple of
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
704 <parameter>expr</parameter>. If <parameter>value</parameter> is not
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
705 specified, a series of NUL bytes is output to force the alignment, if
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
706 required. Otherwise, the low order 8 bits of <parameter>value</parameter>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
707 will be used as the fill. The alignment value must be fully resolved on the
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
708 first pass because it affects the addresses of subsquent instructions.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
709 However, <parameter>value</parameter> may include forward references; as
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
710 long as it resolves to a constant for the second pass, the value will be
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
711 accepted.</para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
712
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
713 <para>Unless <parameter>value</parameter> is specified as something like $12,
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
714 this directive is not suitable for inclusion in the middle of actual code.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
715 The default padding value is $00 which is intended to be used within data
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
716 blocks. </para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
717
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
718 </listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
719 </varlistentry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
720
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
721 </variablelist>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
722
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
723 </section>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
724
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
725 <section>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
726 <title>Conditional Assembly</title>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
727 <para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
728 Portions of the source code can be excluded or included based on conditions
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
729 known at assembly time. Conditionals can be nested arbitrarily deeply. The
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
730 directives associated with conditional assembly are described in this section.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
731 </para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
732 <para>All conditionals must be fully bracketed. That is, every conditional
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
733 statement must eventually be followed by an ENDC at the same level of nesting.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
734 </para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
735 <para>Conditional expressions are only evaluated on the first assembly pass.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
736 It is not possible to game the assembly process by having a conditional
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
737 change its value between assembly passes. Thus there is not and never will
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
738 be any equivalent of IFP1 or IFP2 as provided by other assemblers.</para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
739
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
740 <variablelist>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
741 <varlistentry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
742 <term>IFEQ <parameter>expr</parameter></term>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
743 <listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
744 <para>If <parameter>expr</parameter> evaluates to zero, the conditional
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
745 will be considered true.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
746 </para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
747 </listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
748 </varlistentry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
749
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
750 <varlistentry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
751 <term>IFNE <parameter>expr</parameter></term>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
752 <term>IF <parameter>expr</parameter></term>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
753 <listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
754 <para>If <parameter>expr</parameter> evaluates to a non-zero value, the conditional
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
755 will be considered true.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
756 </para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
757 </listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
758 </varlistentry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
759
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
760 <varlistentry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
761 <term>IFGT <parameter>expr</parameter></term>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
762 <listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
763 <para>If <parameter>expr</parameter> evaluates to a value greater than zero, the conditional
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
764 will be considered true.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
765 </para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
766 </listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
767 </varlistentry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
768
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
769 <varlistentry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
770 <term>IFGE <parameter>expr</parameter></term>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
771 <listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
772 <para>If <parameter>expr</parameter> evaluates to a value greater than or equal to zero, the conditional
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
773 will be considered true.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
774 </para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
775 </listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
776 </varlistentry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
777
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
778 <varlistentry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
779 <term>IFLT <parameter>expr</parameter></term>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
780 <listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
781 <para>If <parameter>expr</parameter> evaluates to a value less than zero, the conditional
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
782 will be considered true.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
783 </para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
784 </listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
785 </varlistentry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
786
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
787 <varlistentry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
788 <term>IFLE <parameter>expr</parameter></term>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
789 <listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
790 <para>If <parameter>expr</parameter> evaluates to a value less than or equal to zero , the conditional
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
791 will be considered true.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
792 </para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
793 </listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
794 </varlistentry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
795
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
796 <varlistentry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
797 <term>IFDEF <parameter>sym</parameter></term>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
798 <listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
799 <para>If <parameter>sym</parameter> is defined at this point in the assembly
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
800 process, the conditional
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
801 will be considered true.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
802 </para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
803 </listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
804 </varlistentry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
805
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
806 <varlistentry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
807 <term>IFNDEF <parameter>sym</parameter></term>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
808 <listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
809 <para>If <parameter>sym</parameter> is not defined at this point in the assembly
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
810 process, the conditional
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
811 will be considered true.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
812 </para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
813 </listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
814 </varlistentry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
815
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
816 <varlistentry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
817 <term>ELSE</term>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
818 <listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
819 <para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
820 If the preceding conditional at the same level of nesting was false, the
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
821 statements following will be assembled. If the preceding conditional at
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
822 the same level was true, the statements following will not be assembled.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
823 Note that the preceding conditional might have been another ELSE statement
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
824 although this behaviour is not guaranteed to be supported in future versions
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
825 of LWASM.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
826 </para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
827 </listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
828
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
829 <varlistentry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
830 <term>ENDC</term>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
831 <listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
832 <para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
833 This directive marks the end of a conditional construct. Every conditional
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
834 construct must end with an ENDC directive.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
835 </para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
836 </listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
837 </varlistentry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
838
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
839 </variablelist>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
840 </section>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
841
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
842 <section>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
843 <title>OS9 Target Directives</title>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
844
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
845 <para>This section includes directives that apply solely to the OS9
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
846 target.</para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
847
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
848 <variablelist>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
849
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
850 <varlistentry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
851 <term>OS9 <parameter>syscall</parameter></term>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
852 <listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
853 <para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
854
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
855 This directive generates a call to the specified system call. <parameter>syscall</parameter> may be an arbitrary expression.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
856
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
857 </para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
858 </listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
859 </varlistentry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
860
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
861 <varlistentry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
862 <term>MOD <parameter>size</parameter>,<parameter>name</parameter>,<parameter>type</parameter>,<parameter>flags</parameter>,<parameter>execoff</parameter>,<parameter>datasize</parameter></term>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
863 <listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
864 <para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
865
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
866 This tells LWASM that the beginning of the actual module is here. It will
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
867 generate a module header based on the parameters specified. It will also
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
868 begin calcuating the module CRC.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
869
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
870 </para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
871
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
872 <para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
873
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
874 The precise meaning of the various parameters is beyond the scope of this
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
875 document since it is not a tutorial on OS9 module programming.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
876
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
877 </para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
878
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
879 </listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
880 </varlistentry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
881
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
882 <varlistentry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
883 <term>EMOD</term>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
884 <listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
885 <para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
886
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
887 This marks the end of a module and causes LWASM to emit the calculated CRC
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
888 for the module.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
889
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
890 </para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
891 </varlistentry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
892
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
893 </variablelist>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
894 </section>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
895
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
896 <section>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
897 <title>Miscelaneous Directives</title>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
898
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
899 <para>This section includes directives that do not fit into the other
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
900 categories.</para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
901
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
902 <variablelist>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
903
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
904 <varlistentry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
905 <term>INCLUDE <parameter>filename</parameter></term>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
906 <term>USE <parameter>filename</parameter></term>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
907
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
908 <listitem> <para> Include the contents of <parameter>filename</parameter> at
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
909 this point in the assembly as though it were a part of the file currently
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
910 being processed. Note that if whitespace appears in the name of the file,
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
911 you must enclose <parameter>filename</parameter> in quotes.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
912 </para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
913
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
914 <para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
915 Note that the USE variation is provided only for compatibility with other
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
916 assemblers. It is recommended to use the INCLUDE variation.</para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
917
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
918 </listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
919 </varlistentry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
920
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
921 <varlistentry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
922 <term>END <parameter>[expr]</parameter></term>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
923 <listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
924 <para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
925 This directive causes the assembler to stop assembling immediately as though
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
926 it ran out of input. For the DECB target only, <parameter>expr</parameter>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
927 can be used to set the execution address of the resulting binary. For all
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
928 other targets, specifying <parameter>expr</parameter> will cause an error.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
929 </para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
930 </listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
931 </varlistentry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
932
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
933 <varlistentry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
934 <term>ERROR <parameter>string</parameter></term>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
935 <listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
936 <para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
937 Causes a custom error message to be printed at this line. This will cause
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
938 assembly to fail. This directive is most useful inside conditional constructs
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
939 to cause assembly to fail if some condition that is known bad happens.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
940 </para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
941 </listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
942 </varlistentry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
943
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
944 <varlistentry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
945 <term>.MODULE <parameter>string</parameter></term>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
946 <listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
947 <para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
948 This directive is ignored for most output targets. If the output target
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
949 supports encoding a module name into it, <parameter>string</parameter>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
950 will be used as the module name.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
951 </para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
952 <para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
953 As of version 2.2, no supported output targets support this directive.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
954 </para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
955 </listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
956 </varlistentry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
957
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
958 </variablelist>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
959 </section>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
960
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
961 </section>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
962
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
963 <section>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
964 <title>Macros</title>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
965 <para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
966 LWASM is a macro assembler. A macro is simply a name that stands in for a
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
967 series of instructions. Once a macro is defined, it is used like any other
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
968 assembler directive. Defining a macro can be considered equivalent to adding
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
969 additional assembler directives.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
970 </para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
971 <para>Macros my accept parameters. These parameters are referenced within
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
972 a macro by the a backslash ("\") followed by a digit 1 through 9 for the first
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
973 through ninth parameters. They may also be referenced by enclosing the
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
974 decimal parameter number in braces ("{num}"). These parameter references
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
975 are replaced with the verbatim text of the parameter passed to the macro. A
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
976 reference to a non-existent parameter will be replaced by an empty string.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
977 Macro parameters are expanded everywhere on each source line. That means
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
978 the parameter to a macro could be used as a symbol or it could even appear
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
979 in a comment or could cause an entire source line to be commented out
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
980 when the macro is expanded.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
981 </para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
982 <para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
983 Parameters passed to a macro are separated by commas and the parameter list
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
984 is terminated by any whitespace. This means that neither a comma nor whitespace
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
985 may be included in a macro parameter.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
986 </para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
987 <para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
988 Macro expansion is done recursively. That is, within a macro, macros are
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
989 expanded. This can lead to infinite loops in macro expansion. If the assembler
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
990 hangs for a long time while assembling a file that uses macros, this may be
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
991 the reason.</para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
992
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
993 <para>Each macro expansion receives its own local symbol context which is not
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
994 inherited by any macros called by it nor is it inherited from the context
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
995 the macro was instantiated in. That means it is possible to use local symbols
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
996 within macros without having them collide with symbols in other macros or
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
997 outside the macro itself. However, this also means that using a local symbol
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
998 as a parameter to a macro, while legal, will not do what it would seem to do
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
999 as it will result in looking up the local symbol in the macro's symbol context
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1000 rather than the enclosing context where it came from, likely yielding either
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1001 an undefined symbol error or bizarre assembly results.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1002 </para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1003 <para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1004 Note that there is no way to define a macro as local to a symbol context. All
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1005 macros are part of the global macro namespace. However, macros have a separate
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1006 namespace from symbols so it is possible to have a symbol with the same name
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1007 as a macro.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1008 </para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1009
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1010 <para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1011 Macros are defined only during the first pass. Macro expansion also
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1012 only occurs during the first pass. On the second pass, the macro
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1013 definition is simply ignored. Macros must be defined before they are used.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1014 </para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1015
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1016 <para>The following directives are used when defining macros.</para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1017
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1018 <variablelist>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1019 <varlistentry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1020 <term><parameter>macroname</parameter> MACRO</term>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1021 <listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1022 <para>This directive is used to being the definition of a macro called
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1023 <parameter>macroname</parameter>. If <parameter>macroname</parameter> already
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1024 exists, it is considered an error. Attempting to define a macro within a
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1025 macro is undefined. It may work and it may not so the behaviour should not
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1026 be relied upon.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1027 </para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1028 </listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1029 </varlistentry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1030
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1031 <varlistentry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1032 <term>ENDM</term>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1033 <listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1034 <para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1035 This directive indicates the end of the macro currently being defined. It
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1036 causes the assembler to resume interpreting source lines as normal.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1037 </para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1038 </listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1039 </variablelist>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1040
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1041 </section>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1042
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1043 <section>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1044 <title>Object Files and Sections</title>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1045 <para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1046 The object file target is very useful for large project because it allows
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1047 multiple files to be assembled independently and then linked into the final
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1048 binary at a later time. It allows only the small portion of the project
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1049 that was modified to be re-assembled rather than requiring the entire set
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1050 of source code to be available to the assembler in a single assembly process.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1051 This can be particularly important if there are a large number of macros,
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1052 symbol definitions, or other metadata that uses resources at assembly time.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1053 By far the largest benefit, however, is keeping the source files small enough
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1054 for a mere mortal to find things in them.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1055 </para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1056
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1057 <para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1058 With multi-file projects, there needs to be a means of resolving references to
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1059 symbols in other source files. These are known as external references. The
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1060 addresses of these symbols cannot be known until the linker joins all the
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1061 object files into a single binary. This means that the assembler must be
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1062 able to output the object code without knowing the value of the symbol. This
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1063 places some restrictions on the code generated by the assembler. For
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1064 example, the assembler cannot generate direct page addressing for instructions
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1065 that reference external symbols because the address of the symbol may not
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1066 be in the direct page. Similarly, relative branches and PC relative addressing
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1067 cannot be used in their eight bit forms. Everything that must be resolved
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1068 by the linker must be assembled to use the largest address size possible to
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1069 allow the linker to fill in the correct value at link time. Note that the
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1070 same problem applies to absolute address references as well, even those in
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1071 the same source file, because the address is not known until link time.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1072 </para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1073
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1074 <para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1075 It is often desired in multi-file projects to have code of various types grouped
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1076 together in the final binary generated by the linker as well. The same applies
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1077 to data. In order for the linker to do that, the bits that are to be grouped
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1078 must be tagged in some manner. This is where the concept of sections comes in.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1079 Each chunk of code or data is part of a section in the object file. Then,
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1080 when the linker reads all the object files, it coalesces all sections of the
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1081 same name into a single section and then considers it as a unit.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1082 </para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1083
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1084 <para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1085 The existence of sections, however, raises a problem for symbols even
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1086 within the same source file. Thus, the assembler must treat symbols from
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1087 different sections within the same source file in the same manner as external
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1088 symbols. That is, it must leave them for the linker to resolve at link time,
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1089 with all the limitations that entails.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1090 </para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1091
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1092 <para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1093 In the object file target mode, LWASM requires all source lines that
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1094 cause bytes to be output to be inside a section. Any directives that do
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1095 not cause any bytes to be output can appear outside of a section. This includes
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1096 such things as EQU or RMB. Even ORG can appear outside a section. ORG, however,
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1097 makes no sense within a section because it is the linker that determines
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1098 the starting address of the section's code, not the assembler.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1099 </para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1100
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1101 <para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1102 All symbols defined globally in the assembly process are local to the
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1103 source file and cannot be exported. All symbols defined within a section are
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1104 considered local to the source file unless otherwise explicitly exported.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1105 Symbols referenced from external source files must be declared external,
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1106 either explicitly or by asking the assembler to assume that all undefined
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1107 symbols are external.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1108 </para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1109
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1110 <para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1111 It is often handy to define a number of memory addresses that will be
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1112 used for data at run-time but which need not be included in the binary file.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1113 These memory addresses are not initialized until run-time, either by the
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1114 program itself or by the program loader, depending on the operating environment.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1115 Such sections are often known as BSS sections. LWASM supports generating
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1116 sections with a BSS attribute set which causes the section definition including
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1117 symbols exported from that section and those symbols required to resolve
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1118 references from the local file, but with no actual code in the object file.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1119 It is illegal for any source lines within a BSS flagged section to cause any
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1120 bytes to be output.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1121 </para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1122
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1123 <para>The following directives apply to section handling.</para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1124
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1125 <variablelist>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1126 <varlistentry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1127 <term>SECTION <parameter>name[,flags]</parameter></term>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1128 <term>SECT <parameter>name[,flags]</parameter></term>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1129 <term>.AREA <parameter>name[,flags]</parameter></term>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1130 <listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1131 <para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1132 Instructs the assembler that the code following this directive is to be
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1133 considered part of the section <parameter>name</parameter>. A section name
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1134 may appear multiple times in which case it is as though all the code from
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1135 all the instances of that section appeared adjacent within the source file.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1136 However, <parameter>flags</parameter> may only be specified on the first
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1137 instance of the section.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1138 </para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1139 <para>There is a single flag supported in <parameter>flags</parameter>. The
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1140 flag <parameter>bss</parameter> will cause the section to be treated as a BSS
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1141 section and, thus, no code will be included in the object file nor will any
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1142 bytes be permitted to be output.</para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1143 <para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1144 If the section name is "bss" or ".bss" in any combination of upper and
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1145 lower case, the section is assumed to be a BSS section. In that case,
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1146 the flag <parameter>!bss</parameter> can be used to override this assumption.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1147 </para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1148 <para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1149 If assembly is already happening within a section, the section is implicitly
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1150 ended and the new section started. This is not considered an error although
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1151 it is recommended that all sections be explicitly closed.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1152 </para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1153 </listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1154 </varlistentry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1155
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1156 <varlistentry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1157 <term>ENDSECTION</term>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1158 <term>ENDSECT</term>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1159 <term>ENDS</term>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1160 <listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1161 <para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1162 This directive ends the current section. This puts assembly outside of any
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1163 sections until the next SECTION directive.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1164 </listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1165 </varlistentry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1166
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1167 <varlistentry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1168 <term><parameter>sym</parameter> EXTERN</term>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1169 <term><parameter>sym</parameter> EXTERNAL</term>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1170 <term><parameter>sym</parameter> IMPORT</term>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1171 <listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1172 <para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1173 This directive defines <parameter>sym</parameter> as an external symbol.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1174 This directive may occur at any point in the source code. EXTERN definitions
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1175 are resolved on the first pass so an EXTERN definition anywhere in the
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1176 source file is valid for the entire file. The use of this directive is
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1177 optional when the assembler is instructed to assume that all undefined
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1178 symbols are external. In fact, in that mode, if the symbol is referenced
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1179 before the EXTERN directive, an error will occur.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1180 </para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1181 </listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1182 </varlistentry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1183
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1184 <varlistentry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1185 <term><parameter>sym</parameter> EXPORT</term>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1186 <term><parameter>sym</parameter> .GLOBL</term>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1187
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1188 <term>EXPORT <parameter>sym</parameter></term>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1189 <term>.GLOBL <parameter>sym</parameter></term>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1190
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1191 <listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1192 <para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1193 This directive defines <parameter>sym</parameter> as an exported symbol.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1194 This directive may occur at any point in the source code, even before the
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1195 definition of the exported symbol.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1196 </para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1197 <para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1198 Note that <parameter>sym</parameter> may appear as the operand or as the
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1199 statement's symbol. If there is a symbol on the statement, that will
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1200 take precedence over any operand that is present.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1201 </para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1202 </listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1203 </varlistentry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1204
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1205 </variablelist>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1206
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1207 </section>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1208
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1209 <section>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1210 <title>Assembler Modes and Pragmas</title>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1211 <para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1212 There are a number of options that affect the way assembly is performed.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1213 Some of these options can only be specified on the command line because
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1214 they determine something absolute about the assembly process. These include
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1215 such things as the output target. Other things may be switchable during
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1216 the assembly process. These are known as pragmas and are, by definition,
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1217 not portable between assemblers.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1218 </para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1219
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1220 <para>LWASM supports a number of pragmas that affect code generation or
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1221 otherwise affect the behaviour of the assembler. These may be specified by
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1222 way of a command line option or by assembler directives. The directives
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1223 are as follows.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1224 </para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1225
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1226 <variablelist>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1227 <varlistentry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1228 <term>PRAGMA <parameter>pragma[,...]</parameter></term>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1229 <listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1230 <para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1231 Specifies that the assembler should bring into force all <parameter>pragma</parameter>s
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1232 specified. Any unrecognized pragma will cause an assembly error. The new
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1233 pragmas will take effect immediately. This directive should be used when
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1234 the program will assemble incorrectly if the pragma is ignored or not supported.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1235 </para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1236 </listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1237 </varlistentry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1238
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1239 <varlistentry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1240 <term>*PRAGMA <parameter>pragma[,...]</parameter></term>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1241 <listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1242 <para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1243 This is identical to the PRAGMA directive except no error will occur with
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1244 unrecognized or unsupported pragmas. This directive, by virtue of starting
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1245 with a comment character, will also be ignored by assemblers that do not
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1246 support this directive. Use this variation if the pragma is not required
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1247 for correct functioning of the code.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1248 </para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1249 </listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1250 </varlistentry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1251 </variablelist>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1252
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1253 <para>Each pragma supported has a positive version and a negative version.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1254 The positive version enables the pragma while the negative version disables
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1255 it. The negatitve version is simply the positive version with "no" prefixed
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1256 to it. For instance, "pragma" vs. "nopragma". Only the positive version is
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1257 listed below.</para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1258
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1259 <para>Pragmas are not case sensitive.</para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1260
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1261 <variablelist>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1262 <varlistentry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1263 <term>index0tonone</term>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1264 <listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1265 <para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1266 When in force, this pragma enables an optimization affecting indexed addressing
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1267 modes. When the offset expression in an indexed mode evaluates to zero but is
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1268 not explicity written as 0, this will replace the operand with the equivalent
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1269 no offset mode, thus creating slightly faster code. Because of the advantages
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1270 of this optimization, it is enabled by default.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1271 </para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1272 </listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1273 </varlistentry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1274
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1275 <varlistentry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1276 <term>cescapes</term>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1277 <listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1278 <para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1279 This pragma will cause strings in the FCC, FCS, and FCN pseudo operations to
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1280 have C-style escape sequences interpreted. The one departure from the official
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1281 spec is that unrecognized escape sequences will return either the character
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1282 immediately following the backslash or some undefined value. Do not rely
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1283 on the behaviour of undefined escape sequences.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1284 </para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1285 </listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1286 </varlistentry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1287
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1288 <varlistentry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1289 <term>importundefexport</term>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1290 <listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1291 <para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1292 This pragma is only valid for targets that support external references. When
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1293 in force, it will cause the EXPORT directive to act as IMPORT if the symbol
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1294 to be exported is not defined. This is provided for compatibility with the
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1295 output of gcc6809 and should not be used in hand written code. Because of
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1296 the confusion this pragma can cause, it is disabled by default.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1297 </para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1298 </listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1299 </varlistentry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1300
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1301 <varlistentry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1302 <term>undefextern</term>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1303 <listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1304 <para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1305 This pragma is only valid for targets that support external references. When in
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1306 force, if the assembler sees an undefined symbol on the second pass, it will
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1307 automatically define it as an external symbol. This automatic definition will
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1308 apply for the remainder of the assembly process, even if the pragma is
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1309 subsequently turned off. Because this behaviour would be potentially surprising,
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1310 this pragma defaults to off.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1311 </para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1312 <para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1313 The primary use for this pragma is for projects that share a large number of
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1314 symbols between source files. In such cases, it is impractical to enumerate
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1315 all the external references in every source file. This allows the assembler
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1316 and linker to do the heavy lifting while not preventing a particular source
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1317 module from defining a local symbol of the same name as an external symbol
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1318 if it does not need the external symbol. (This pragma will not cause an
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1319 automatic external definition if there is already a locally defined symbol.)
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1320 </para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1321 <para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1322 This pragma will often be specified on the command line for large projects.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1323 However, depending on the specific dynamics of the project, it may be sufficient
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1324 for one or two files to use this pragma internally.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1325 </para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1326 </listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1327 </varlistentry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1328
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1329 <varlistentry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1330 <term>dollarlocal</term>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1331 <listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1332
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1333 <para>When set, a "$" in a symbol makes it local. When not set, "$" does not
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1334 cause a symbol to be local. It is set by default except when using the OS9
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1335 target.</para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1336
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1337 </listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1338 </varlistentry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1339
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1340 <varlistentry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1341 <term>dollarnotlocal</term>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1342 <listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1343
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1344 <para> This is the same as the "dollarlocal" pragma except its sense is
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1345 reversed. That is, "dollarlocal" and "nodollarnotlocal" are equivalent and
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1346 "nodollarlocal" and "dollarnotlocal" are equivalent. </para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1347
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1348 </listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1349 </varlistentry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1350
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1351 </variablelist>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1352
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1353 </section>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1354
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1355 </chapter>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1356
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1357 <chapter>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1358 <title>LWLINK</title>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1359 <para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1360 The LWTOOLS linker is called LWLINK. This chapter documents the various features
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1361 of the linker.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1362 </para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1363
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1364 <section>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1365 <title>Command Line Options</title>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1366 <para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1367 The binary for LWLINK is called "lwlink". Note that the binary is in lower
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1368 case. lwlink takes the following command line arguments.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1369 </para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1370 <variablelist>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1371 <varlistentry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1372 <term><option>--decb</option></term>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1373 <term><option>-b</option></term>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1374 <listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1375 <para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1376 Selects the DECB output format target. This is equivalent to <option>--format=decb</option>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1377 </para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1378 </listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1379 </varlistentry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1380
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1381 <varlistentry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1382 <term><option>--output=FILE</option></term>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1383 <term><option>-o FILE</option></term>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1384 <listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1385 <para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1386 This option specifies the name of the output file. If not specified, the
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1387 default is <option>a.out</option>.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1388 </para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1389 </listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1390 </varlistentry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1391
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1392 <varlistentry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1393 <term><option>--format=TYPE</option></term>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1394 <term><option>-f TYPE</option></term>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1395 <listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1396 <para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1397 This option specifies the output format. Valid values are <option>decb</option>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1398 and <option>raw</option>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1399 </para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1400 </listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1401 </varlistentry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1402
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1403 <varlistentry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1404 <term><option>--raw</option></term>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1405 <term><option>-r</option></term>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1406 <listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1407 <para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1408 This option specifies the raw output format.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1409 It is equivalent to <option>--format=raw</option>.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1410 and <option>raw</option>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1411 </para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1412 </listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1413 </varlistentry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1414
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1415 <varlistentry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1416 <term><option>--script=FILE</option></term>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1417 <term><option>-s</option></term>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1418 <listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1419 <para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1420 This option allows specifying a linking script to override the linker's
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1421 built in defaults.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1422 </para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1423 </listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1424 </varlistentry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1425
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1426 <varlistentry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1427 <term><option>--section-base=SECT=BASE</option></term>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1428 <listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1429 <para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1430 Cause section SECT to load at base address BASE. This will be prepended
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1431 to the built-in link script. It is ignored if a link script is provided.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1432 </para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1433 </listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1434 </varlistentry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1435
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1436 <varlistentry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1437 <term><option>--map=FILE</option></term>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1438 <term><option>-m FILE</option></term>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1439 <listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1440 <para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1441 This will output a description of the link result to FILE.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1442 </para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1443 </listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1444 </varlistentry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1445
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1446 <varlistentry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1447 <term><option>--library=LIBSPEC</option></term>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1448 <term><option>-l LIBSPEC</option></term>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1449 <listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1450 <para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1451 Load a library using the library search path. LIBSPEC will have "lib" prepended
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1452 and ".a" appended.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1453 </para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1454 </listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1455 </varlistentry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1456
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1457 <varlistentry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1458 <term><option>--library-path=DIR</option></term>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1459 <term><option>-L DIR</option></term>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1460 <listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1461 <para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1462 Add DIR to the library search path.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1463 </para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1464 </listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1465 </varlistentry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1466
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1467 <varlistentry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1468 <term><option>--debug</option></term>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1469 <term><option>-d</option></term>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1470 <listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1471 <para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1472 This option increases the debugging level. It is only useful for LWTOOLS
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1473 developers.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1474 </para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1475 </listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1476 </varlistentry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1477
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1478 <varlistentry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1479 <term><option>--help</option></term>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1480 <term><option>-?</option></term>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1481 <listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1482 <para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1483 This provides a listing of command line options and a brief description
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1484 of each.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1485 </para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1486 </listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1487 </varlistentry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1488
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1489 <varlistentry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1490 <term><option>--usage</option></term>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1491 <listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1492 <para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1493 This will display a usage summary.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1494 of each.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1495 </para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1496 </listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1497 </varlistentry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1498
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1499
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1500 <varlistentry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1501 <term><option>--version</option></term>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1502 <term><option>-V</option></term>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1503 <listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1504 <para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1505 This will display the version of LWLINK.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1506 </para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1507 </listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1508 </varlistentry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1509
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1510 </section>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1511
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1512 <section>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1513 <title>Linker Operation</title>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1514
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1515 <para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1516
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1517 LWLINK takes one or more files in supported input formats and links them
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1518 into a single binary. Currently supported formats are the LWTOOLS object
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1519 file format and the archive format used by LWAR. While the precise method is
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1520 slightly different, linking can be conceptualized as the following steps.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1521
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1522 </para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1523
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1524 <orderedlist>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1525 <listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1526 <para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1527 First, the linker loads a linking script. If no script is specified, it
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1528 loads a built-in default script based on the output format selected. This
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1529 script tells the linker how to lay out the various sections in the final
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1530 binary.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1531 </para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1532 </listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1533
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1534 <listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1535 <para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1536 Next, the linker reads all the input files into memory. At this time, it
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1537 flags any format errors in those files. It constructs a table of symbols
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1538 for each object at this time.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1539 </para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1540 </listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1541
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1542 <listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1543 <para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1544 The linker then proceeds with organizing the sections loaded from each file
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1545 according to the linking script. As it does so, it is able to assign addresses
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1546 to each symbol defined in each object file. At this time, the linker may
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1547 also collapse different instances of the same section name into a single
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1548 section by appending the data from each subsequent instance of the section
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1549 to the first instance of the section.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1550 </para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1551 </listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1552
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1553 <listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1554 <para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1555 Next, the linker looks through every object file for every incomplete reference.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1556 It then attempts to fully resolve that reference. If it cannot do so, it
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1557 throws an error. Once a reference is resolved, the value is placed into
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1558 the binary code at the specified section. It should be noted that an
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1559 incomplete reference can reference either a symbol internal to the object
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1560 file or an external symbol which is in the export list of another object
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1561 file.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1562 </para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1563 </listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1564
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1565 <listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1566 <para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1567 If all of the above steps are successful, the linker opens the output file
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1568 and actually constructs the binary.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1569 </para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1570 </listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1571 </orderedlist>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1572
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1573 </section>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1574
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1575 <section
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1576 <title>Linking Scripts</title>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1577 <para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1578 A linker script is used to instruct the linker about how to assemble the
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1579 various sections into a completed binary. It consists of a series of
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1580 directives which are considered in the order they are encountered.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1581 </para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1582 <para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1583 The sections will appear in the resulting binary in the order they are
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1584 specified in the script file. If a referenced section is not found, the linker will behave as though the
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1585 section did exist but had a zero size, no relocations, and no exports.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1586 A section should only be referenced once. Any subsequent references will have
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1587 an undefined effect.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1588 </para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1589
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1590 <para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1591 All numbers are in linking scripts are specified in hexadecimal. All directives
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1592 are case sensitive although the hexadecimal numbers are not.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1593 </para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1594
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1595 <para>A section name can be specified as a "*", then any section not
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1596 already matched by the script will be matched. The "*" can be followed
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1597 by a comma and a flag to narrow the section down slightly, also.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1598 If the flag is "!bss", then any section that is not flagged as a bss section
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1599 will be matched. If the flag is "bss", then any section that is flagged as
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1600 bss will be matched.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1601 </para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1602
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1603 <para>The following directives are understood in a linker script.</para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1604 <variablelist>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1605 <varlistentry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1606 <term>section <parameter>name</parameter> load <parameter>addr</parameter></term>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1607 <listitem><para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1608
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1609 This causes the section <parameter>name</parameter> to load at
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1610 <parameter>addr</parameter>. For the raw target, only one "load at" entry is
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1611 allowed for non-bss sections and it must be the first one. For raw targets,
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1612 it affects the addresses the linker assigns to symbols but has no other
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1613 affect on the output. bss sections may all have separate load addresses but
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1614 since they will not appear in the binary anyway, this is okay.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1615 </para><para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1616 For the decb target, each "load" entry will cause a new "block" to be
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1617 output to the binary which will contain the load address. It is legal for
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1618 sections to overlap in this manner - the linker assumes the loader will sort
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1619 everything out.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1620 </para></listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1621 </varlistentry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1622
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1623 <varlistentry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1624 <term>section <parameter>name</parameter></term>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1625 <listitem><para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1626
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1627 This will cause the section <parameter>name</parameter> to load after the previously listed
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1628 section.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1629 </para></listitem></varlistentry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1630 <varlistentry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1631 <term>exec <parameter>addr or sym</parameter></term>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1632 <listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1633 <para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1634 This will cause the execution address (entry point) to be the address
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1635 specified (in hex) or the specified symbol name. The symbol name must
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1636 match a symbol that is exported by one of the object files being linked.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1637 This has no effect for targets that do not encode the entry point into the
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1638 resulting file. If not specified, the entry point is assumed to be address 0
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1639 which is probably not what you want. The default link scripts for targets
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1640 that support this directive automatically starts at the beginning of the
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1641 first section (usually "init" or "code") that is emitted in the binary.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1642 </para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1643 </listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1644 </varlistentry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1645
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1646 <varlistentry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1647 <term>pad <parameter>size</parameter></term>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1648 <listitem><para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1649 This will cause the output file to be padded with NUL bytes to be exactly
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1650 <parameter>size</parameter> bytes in length. This only makes sense for a raw target.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1651 </para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1652 </listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1653 </varlistentry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1654 </variablelist>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1655
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1656
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1657
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1658 </section>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1659
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1660 </chapter>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1661
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1662 <chapter>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1663 <title>Libraries and LWAR</title>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1664
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1665 <para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1666 LWTOOLS also includes a tool for managing libraries. These are analogous to
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1667 the static libraries created with the "ar" tool on POSIX systems. Each library
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1668 file contains one or more object files. The linker will treat the object
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1669 files within a library as though they had been specified individually on
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1670 the command line except when resolving external references. External references
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1671 are looked up first within the object files within the library and then, if
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1672 not found, the usual lookup based on the order the files are specified on
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1673 the command line occurs.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1674 </para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1675
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1676 <para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1677 The tool for creating these libary files is called LWAR.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1678 </para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1679
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1680 <section>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1681 <title>Command Line Options</title>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1682 <para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1683 The binary for LWAR is called "lwar". Note that the binary is in lower
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1684 case. The options lwar understands are listed below. For archive manipulation
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1685 options, the first non-option argument is the name of the archive. All other
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1686 non-option arguments are the names of files to operate on.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1687 </para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1688
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1689 <variablelist>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1690 <varlistentry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1691 <term><option>--add</option></term>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1692 <term><option>-a</option></term>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1693 <listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1694 <para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1695 This option specifies that an archive is going to have files added to it.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1696 If the archive does not already exist, it is created. New files are added
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1697 to the end of the archive.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1698 </para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1699 </listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1700 </varlistentry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1701
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1702 <varlistentry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1703 <term><option>--create</option></term>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1704 <term><option>-c</option></term>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1705 <listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1706 <para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1707 This option specifies that an archive is going to be created and have files
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1708 added to it. If the archive already exists, it is truncated.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1709 </para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1710 </listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1711 </varlistentry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1712
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1713 <varlistentry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1714 <term><option>--merge</option></term>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1715 <term><option>-m</option></term>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1716 <listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1717 <para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1718 If specified, any files specified to be added to an archive will be checked
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1719 to see if they are archives themselves. If so, their constituent members are
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1720 added to the archive. This is useful for avoiding archives containing archives.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1721 </para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1722 </listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1723 </varlistentry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1724
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1725 <varlistentry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1726 <term><option>--list</option></term>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1727 <term><option>-l</option></term>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1728 <listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1729 <para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1730 This will display a list of the files contained in the archive.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1731 </para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1732 </listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1733 </varlistentry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1734
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1735 <varlistentry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1736 <term><option>--debug</option></term>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1737 <term><option>-d</option></term>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1738 <listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1739 <para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1740 This option increases the debugging level. It is only useful for LWTOOLS
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1741 developers.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1742 </para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1743 </listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1744 </varlistentry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1745
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1746 <varlistentry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1747 <term><option>--help</option></term>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1748 <term><option>-?</option></term>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1749 <listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1750 <para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1751 This provides a listing of command line options and a brief description
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1752 of each.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1753 </para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1754 </listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1755 </varlistentry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1756
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1757 <varlistentry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1758 <term><option>--usage</option></term>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1759 <listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1760 <para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1761 This will display a usage summary.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1762 of each.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1763 </para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1764 </listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1765 </varlistentry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1766
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1767
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1768 <varlistentry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1769 <term><option>--version</option></term>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1770 <term><option>-V</option></term>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1771 <listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1772 <para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1773 This will display the version of LWLINK.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1774 of each.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1775 </para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1776 </listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1777 </varlistentry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1778
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1779 </section>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1780
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1781 </chapter>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1782
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1783 <chapter id="objchap">
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1784 <title>Object Files</title>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1785 <para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1786 LWTOOLS uses a proprietary object file format. It is proprietary in the sense
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1787 that it is specific to LWTOOLS, not that it is a hidden format. It would be
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1788 hard to keep it hidden in an open source tool chain anyway. This chapter
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1789 documents the object file format.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1790 </para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1791
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1792 <para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1793 An object file consists of a series of sections each of which contains a
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1794 list of exported symbols, a list of incomplete references, and a list of
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1795 "local" symbols which may be used in calculating incomplete references. Each
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1796 section will obviously also contain the object code.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1797 </para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1798
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1799 <para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1800 Exported symbols must be completely resolved to an address within the
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1801 section it is exported from. That is, an exported symbol must be a constant
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1802 rather than defined in terms of other symbols.</para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1803
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1804 <para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1805 Each object file starts with a magic number and version number. The magic
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1806 number is the string "LWOBJ16" for this 16 bit object file format. The only
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1807 defined version number is currently 0. Thus, the first 8 bytes of the object
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1808 file are <code>4C574F424A313600</code>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1809 </para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1810
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1811 <para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1812 Each section has the following items in order:
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1813 </para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1814
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1815 <itemizedlist>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1816 <listitem><para>section name</para></listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1817 <listitem><para>flags</para></listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1818 <listitem><para>list of local symbols (and addresses within the section)</para></listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1819 <listitem><para>list of exported symbols (and addresses within the section)</para></listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1820 <listitem><para>list of incomplete references along with the expressions to calculate them</para></listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1821 <listitem><para>the actual object code (for non-BSS sections)</para></listitem>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1822 </itemizedlist>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1823
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1824 <para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1825 The section starts with the name of the section with a NUL termination
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1826 followed by a series of flag bytes terminated by NUL. There are only two
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1827 flag bytes defined. A NUL (0) indicates no more flags and a value of 1
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1828 indicates the section is a BSS section. For a BSS section, no actual
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1829 code is included in the object file.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1830 </para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1831
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1832 <para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1833 Either a NULL section name or end of file indicate the presence of no more
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1834 sections.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1835 </para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1836
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1837 <para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1838 Each entry in the exported and local symbols table consists of the symbol
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1839 (NUL terminated) followed by two bytes which contain the value in big endian
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1840 order. The end of a symbol table is indicated by a NULL symbol name.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1841 </para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1842
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1843 <para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1844 Each entry in the incomplete references table consists of an expression
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1845 followed by a 16 bit offset where the reference goes. Expressions are
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1846 defined as a series of terms up to an "end of expression" term. Each term
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1847 consists of a single byte which identifies the type of term (see below)
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1848 followed by any data required by the term. Then end of the list is flagged
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1849 by a NULL expression (only an end of expression term).
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1850 </para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1851
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1852 <table frame="all"><title>Object File Term Types</title>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1853 <tgroup cols="2">
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1854 <thead>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1855 <row>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1856 <entry>TERMTYPE</entry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1857 <entry>Meaning</entry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1858 </row>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1859 </thead>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1860 <tbody>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1861 <row>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1862 <entry>00</entry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1863 <entry>end of expression</entry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1864 </row>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1865
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1866 <row>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1867 <entry>01</entry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1868 <entry>integer (16 bit in big endian order follows)</entry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1869 </row>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1870 <row>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1871 <entry>02</entry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1872 <entry> external symbol reference (NUL terminated symbol name follows)</entry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1873 </row>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1874
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1875 <row>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1876 <entry>03</entry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1877 <entry>local symbol reference (NUL terminated symbol name follows)</entry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1878 </row>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1879
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1880 <row>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1881 <entry>04</entry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1882 <entry>operator (1 byte operator number)</entry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1883 </row>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1884 <row>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1885 <entry>05</entry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1886 <entry>section base address reference</entry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1887 </row>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1888
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1889 <row>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1890 <entry>FF</entry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1891 <entry>This term will set flags for the expression. Each one of these terms will set a single flag. All of them should be specified first in an expression. If they are not, the behaviour is undefined. The byte following is the flag. There is currently only one flag defined. Flag 01 indicates an 8 bit relocation.</entry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1892 </row>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1893 </tbody>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1894 </tgroup>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1895 </table>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1896
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1897
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1898 <para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1899 External references are resolved using other object files while local
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1900 references are resolved using the local symbol table(s) from this file. This
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1901 allows local symbols that are not exported to have the same names as
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1902 exported symbols or external references.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1903 </para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1904
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1905 <table frame="all"><title>Object File Operator Numbers</title>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1906 <tgroup cols="2">
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1907 <thead>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1908 <row>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1909 <entry>Number</entry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1910 <entry>Operator</entry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1911 </row>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1912 </thead>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1913 <tbody>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1914 <row>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1915 <entry>01</entry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1916 <entry>addition (+)</entry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1917 </row>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1918 <row>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1919 <entry>02</entry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1920 <entry>subtraction (-)</entry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1921 </row>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1922 <row>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1923 <entry>03</entry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1924 <entry>multiplication (*)</entry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1925 </row>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1926 <row>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1927 <entry>04</entry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1928 <entry>division (/)</entry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1929 </row>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1930 <row>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1931 <entry>05</entry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1932 <entry>modulus (%)</entry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1933 </row>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1934 <row>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1935 <entry>06</entry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1936 <entry>integer division (\) (same as division)</entry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1937 </row>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1938
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1939 <row>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1940 <entry>07</entry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1941 <entry>bitwise and</entry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1942 </row>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1943
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1944 <row>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1945 <entry>08</entry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1946 <entry>bitwise or</entry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1947 </row>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1948
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1949 <row>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1950 <entry>09</entry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1951 <entry>bitwise xor</entry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1952 </row>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1953
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1954 <row>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1955 <entry>0A</entry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1956 <entry>boolean and</entry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1957 </row>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1958
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1959 <row>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1960 <entry>0B</entry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1961 <entry>boolean or</entry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1962 </row>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1963
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1964 <row>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1965 <entry>0C</entry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1966 <entry>unary negation, 2's complement (-)</entry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1967 </row>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1968
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1969 <row>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1970 <entry>0D</entry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1971 <entry>unary 1's complement (^)</entry>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1972 </row>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1973 </tbody>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1974 </tgroup>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1975 </table>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1976
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1977 <para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1978 An expression is represented in a postfix manner with both operands for
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1979 binary operators preceding the operator and the single operand for unary
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1980 operators preceding the operator.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1981 </para>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1982
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1983 </chapter>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1984 </book>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1985