annotate doc/manual.docbook.sgml @ 145:afe30454382f

Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
author lost
date Thu, 29 Jan 2009 06:13:00 +0000
parents f21a5593a661
children 6c0a30278982
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
109
f21a5593a661 Updated docs
lost
parents:
diff changeset
1 <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook V4.5//EN">
f21a5593a661 Updated docs
lost
parents:
diff changeset
2 <book>
f21a5593a661 Updated docs
lost
parents:
diff changeset
3 <bookinfo>
f21a5593a661 Updated docs
lost
parents:
diff changeset
4 <title>LW Tool Chain</title>
f21a5593a661 Updated docs
lost
parents:
diff changeset
5 <author><firstname>William</firstname><surname>Astle</surname></author>
f21a5593a661 Updated docs
lost
parents:
diff changeset
6 <copyright><year>2009</year><holder>William Astle</holder></copyright>
f21a5593a661 Updated docs
lost
parents:
diff changeset
7 </bookinfo>
f21a5593a661 Updated docs
lost
parents:
diff changeset
8 <chapter>
f21a5593a661 Updated docs
lost
parents:
diff changeset
9
f21a5593a661 Updated docs
lost
parents:
diff changeset
10 <title>Introduction</title>
f21a5593a661 Updated docs
lost
parents:
diff changeset
11
f21a5593a661 Updated docs
lost
parents:
diff changeset
12 <para>
f21a5593a661 Updated docs
lost
parents:
diff changeset
13 The LW tool chain provides utilities for building binaries for MC6809 and
f21a5593a661 Updated docs
lost
parents:
diff changeset
14 HD6309 CPUs. The tool chain includes a cross-assembler and a cross-linker
f21a5593a661 Updated docs
lost
parents:
diff changeset
15 which support several styles of output.
f21a5593a661 Updated docs
lost
parents:
diff changeset
16 </para>
f21a5593a661 Updated docs
lost
parents:
diff changeset
17
f21a5593a661 Updated docs
lost
parents:
diff changeset
18 <section>
f21a5593a661 Updated docs
lost
parents:
diff changeset
19 <title>History</title>
f21a5593a661 Updated docs
lost
parents:
diff changeset
20 <para>
f21a5593a661 Updated docs
lost
parents:
diff changeset
21 For a long time, I have had an interest in creating an operating system for
f21a5593a661 Updated docs
lost
parents:
diff changeset
22 the Coco3. I finally started working on that project around the beginning of
f21a5593a661 Updated docs
lost
parents:
diff changeset
23 2006. I had a number of assemblers I could choose from. Eventually, I settled
f21a5593a661 Updated docs
lost
parents:
diff changeset
24 on one and started tinkering. After a while, I realized that assembler was not
f21a5593a661 Updated docs
lost
parents:
diff changeset
25 going to be sufficient due to lack of macros and issues with forward references.
f21a5593a661 Updated docs
lost
parents:
diff changeset
26 Then I tried another which handled forward references correctly but still did
f21a5593a661 Updated docs
lost
parents:
diff changeset
27 not support macros. I looked around at other assemblers and they all lacked
f21a5593a661 Updated docs
lost
parents:
diff changeset
28 one feature or another that I really wanted for creating my operating system.
f21a5593a661 Updated docs
lost
parents:
diff changeset
29 </para>
f21a5593a661 Updated docs
lost
parents:
diff changeset
30
f21a5593a661 Updated docs
lost
parents:
diff changeset
31 <para>
f21a5593a661 Updated docs
lost
parents:
diff changeset
32 The solution seemed clear at that point. I am a fair programmer so I figured
f21a5593a661 Updated docs
lost
parents:
diff changeset
33 I could write an assembler that would do everything I wanted an assembler to
f21a5593a661 Updated docs
lost
parents:
diff changeset
34 do. Thus the LWASM probject was born. After more than two years of on and off
f21a5593a661 Updated docs
lost
parents:
diff changeset
35 work, version 1.0 of LWASM was released in October of 2008.
f21a5593a661 Updated docs
lost
parents:
diff changeset
36 </para>
f21a5593a661 Updated docs
lost
parents:
diff changeset
37
f21a5593a661 Updated docs
lost
parents:
diff changeset
38 <para>
f21a5593a661 Updated docs
lost
parents:
diff changeset
39 As the aforementioned operating system project progressed further, it became
f21a5593a661 Updated docs
lost
parents:
diff changeset
40 clear that while assembling the whole project through a single file was doable,
f21a5593a661 Updated docs
lost
parents:
diff changeset
41 it was not practical. When I found myself playing some fancy games with macros
f21a5593a661 Updated docs
lost
parents:
diff changeset
42 in a bid to simulate sections, I realized I needed a means of assembling
f21a5593a661 Updated docs
lost
parents:
diff changeset
43 source files separately and linking them later. This spawned a major development
f21a5593a661 Updated docs
lost
parents:
diff changeset
44 effort to add an object file support to LWASM. It also spawned the LWLINK
f21a5593a661 Updated docs
lost
parents:
diff changeset
45 project to provide a means to actually link the files.
f21a5593a661 Updated docs
lost
parents:
diff changeset
46 </para>
f21a5593a661 Updated docs
lost
parents:
diff changeset
47
f21a5593a661 Updated docs
lost
parents:
diff changeset
48 </section>
f21a5593a661 Updated docs
lost
parents:
diff changeset
49
f21a5593a661 Updated docs
lost
parents:
diff changeset
50 </chapter>
f21a5593a661 Updated docs
lost
parents:
diff changeset
51
f21a5593a661 Updated docs
lost
parents:
diff changeset
52 <chapter>
f21a5593a661 Updated docs
lost
parents:
diff changeset
53 <title>Output Formats</title>
f21a5593a661 Updated docs
lost
parents:
diff changeset
54
f21a5593a661 Updated docs
lost
parents:
diff changeset
55 <para>
f21a5593a661 Updated docs
lost
parents:
diff changeset
56 The LW tool chain supports multiple output formats. Each format has its
f21a5593a661 Updated docs
lost
parents:
diff changeset
57 advantages and disadvantages. Each format is described below.
f21a5593a661 Updated docs
lost
parents:
diff changeset
58 </para>
f21a5593a661 Updated docs
lost
parents:
diff changeset
59
f21a5593a661 Updated docs
lost
parents:
diff changeset
60 <section>
f21a5593a661 Updated docs
lost
parents:
diff changeset
61 <title>Raw Binaries</title>
f21a5593a661 Updated docs
lost
parents:
diff changeset
62 <para>
f21a5593a661 Updated docs
lost
parents:
diff changeset
63 A raw binary is simply a string of bytes. There are no headers or other
f21a5593a661 Updated docs
lost
parents:
diff changeset
64 niceties. Both LWLINK and LWASM support generating raw binaries. ORG directives
f21a5593a661 Updated docs
lost
parents:
diff changeset
65 in the source code only serve to set the addresses that will be used for
f21a5593a661 Updated docs
lost
parents:
diff changeset
66 symbols but otherwise have no direct impact on the resulting binary.
f21a5593a661 Updated docs
lost
parents:
diff changeset
67 </para>
f21a5593a661 Updated docs
lost
parents:
diff changeset
68
f21a5593a661 Updated docs
lost
parents:
diff changeset
69 </section>
f21a5593a661 Updated docs
lost
parents:
diff changeset
70 <section>
f21a5593a661 Updated docs
lost
parents:
diff changeset
71 <title>DECB Binaries</title>
f21a5593a661 Updated docs
lost
parents:
diff changeset
72
f21a5593a661 Updated docs
lost
parents:
diff changeset
73 <para>A DECB binary is compatible with the LOADM command in Disk Extended
f21a5593a661 Updated docs
lost
parents:
diff changeset
74 Color Basic on the CoCo. They are also compatible with CLOADM from Extended
f21a5593a661 Updated docs
lost
parents:
diff changeset
75 Color Basic. These binaries include the load address of the binary as well
f21a5593a661 Updated docs
lost
parents:
diff changeset
76 as encoding an execution address. These binaries may contain multiple loadable
f21a5593a661 Updated docs
lost
parents:
diff changeset
77 sections, each of which has its own load address.</para>
f21a5593a661 Updated docs
lost
parents:
diff changeset
78
f21a5593a661 Updated docs
lost
parents:
diff changeset
79 <para>
f21a5593a661 Updated docs
lost
parents:
diff changeset
80 Each binary starts with a preamble. Each preamble is five bytes long. The
f21a5593a661 Updated docs
lost
parents:
diff changeset
81 first byte is zero. The next two bytes specify the number of bytes to load
f21a5593a661 Updated docs
lost
parents:
diff changeset
82 and the last two bytes specify the address to load the bytes at. Then, a
f21a5593a661 Updated docs
lost
parents:
diff changeset
83 string of bytes follows. After this string of bytes, there may be another
f21a5593a661 Updated docs
lost
parents:
diff changeset
84 preamble or a postamble. A postamble is also five bytes in length. The first
f21a5593a661 Updated docs
lost
parents:
diff changeset
85 byte of the postamble is $FF, the next two are zero, and the last two are
f21a5593a661 Updated docs
lost
parents:
diff changeset
86 the execution address for the binary.
f21a5593a661 Updated docs
lost
parents:
diff changeset
87 </para>
f21a5593a661 Updated docs
lost
parents:
diff changeset
88
f21a5593a661 Updated docs
lost
parents:
diff changeset
89 <para>
f21a5593a661 Updated docs
lost
parents:
diff changeset
90 Both LWASM and LWLINK can output this format.
f21a5593a661 Updated docs
lost
parents:
diff changeset
91 </para>
f21a5593a661 Updated docs
lost
parents:
diff changeset
92 </section>
f21a5593a661 Updated docs
lost
parents:
diff changeset
93
f21a5593a661 Updated docs
lost
parents:
diff changeset
94 <section>
f21a5593a661 Updated docs
lost
parents:
diff changeset
95 <title>Object Files</title>
f21a5593a661 Updated docs
lost
parents:
diff changeset
96 <para>LWASM supports generating a proprietary object file format which is
f21a5593a661 Updated docs
lost
parents:
diff changeset
97 described in <xref linkend="objchap">. LWLINK is then used to link these
f21a5593a661 Updated docs
lost
parents:
diff changeset
98 object files into a final binary in any of LWLINK's supported binary
f21a5593a661 Updated docs
lost
parents:
diff changeset
99 formats.</para>
f21a5593a661 Updated docs
lost
parents:
diff changeset
100
f21a5593a661 Updated docs
lost
parents:
diff changeset
101 <para>Object files are very flexible in that they allow references that are not
f21a5593a661 Updated docs
lost
parents:
diff changeset
102 known at assembly time to be resolved at link time. However, because the
f21a5593a661 Updated docs
lost
parents:
diff changeset
103 addresses of such references are not known, there is no way for the assembler
f21a5593a661 Updated docs
lost
parents:
diff changeset
104 has to use sixteen bit addressing modes for these references. The linker
f21a5593a661 Updated docs
lost
parents:
diff changeset
105 will always use sixteen bits when resolving a reference which means any
f21a5593a661 Updated docs
lost
parents:
diff changeset
106 instruction that requires an eight bit operand cannot use external references.
f21a5593a661 Updated docs
lost
parents:
diff changeset
107 </para>
f21a5593a661 Updated docs
lost
parents:
diff changeset
108
f21a5593a661 Updated docs
lost
parents:
diff changeset
109 <para>Object files also support the concept of sections which are not valid
f21a5593a661 Updated docs
lost
parents:
diff changeset
110 for other output types. This allows related code from each object file
f21a5593a661 Updated docs
lost
parents:
diff changeset
111 linked to be collapsed together in the final binary.</para>
f21a5593a661 Updated docs
lost
parents:
diff changeset
112
f21a5593a661 Updated docs
lost
parents:
diff changeset
113 </section>
f21a5593a661 Updated docs
lost
parents:
diff changeset
114
f21a5593a661 Updated docs
lost
parents:
diff changeset
115 </chapter>
f21a5593a661 Updated docs
lost
parents:
diff changeset
116
145
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
117 <chapter>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
118 <title>LWASM</title>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
119 <para>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
120 The LWTOOLS assembler is called LWASM. This chapter documents the various
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
121 features of the assembler. It is not, however, a tutorial on 6x09 assembly
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
122 language programming.
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
123 </para>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
124
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
125 <section>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
126 <title>Command Line Options</title>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
127 <para>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
128 The binary for LWASM is called "lwasm". Note that the binary is in lower
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
129 case. lwasm takes the following command line arguments.
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
130 </para>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
131
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
132 <variablelist>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
133 <varlistentry>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
134 <term><option>--decb</option></term>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
135 <term><option>-b</option></term>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
136 <listitem>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
137 <para>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
138 Select the DECB output format target. Equivalent to <option>--format=decb</option>.
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
139 </para>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
140 </listitem>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
141 </varlistentry>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
142
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
143 <varlistentry>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
144 <term><option>--debug</option></term>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
145 <term><option>-d</option></term>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
146 <listitem>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
147 <para>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
148 Increase the debugging level. Only really useful to people hacking on the
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
149 LWASM source code itself.
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
150 </para>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
151 </listitem>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
152 </varlistentry>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
153
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
154 <varlistentry>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
155 <term><option>--format=type</option></term>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
156 <term><option>-f type</option></term>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
157 <listitem>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
158 <para>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
159 Select the output format. Valid values are <option>obj</option> for the object
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
160 file target, <option>decb</option> for the DECB LOADM format, and <option>raw</option>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
161 for a raw binary.
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
162 </para>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
163 </listitem>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
164 </varlistentry>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
165
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
166
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
167 <varlistentry>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
168 <term><option>--list[=file]</option></term>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
169 <term><option>-l[file]</option></term>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
170 <listitem>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
171 <para>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
172 Cause LWASM to generate a listing. If <option>file</option> is specified,
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
173 the listing will go to that file. Otherwise it will go to the standard output
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
174 stream. By default, no listing is generated.
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
175 </para>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
176 </listitem>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
177 </varlistentry>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
178
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
179 <varlistentry>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
180 <term><option>--obj</option></term>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
181 <listitem>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
182 <para>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
183 Select the proprietary object file format as the output target.
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
184 </para>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
185 </listitem>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
186 </varlistentry>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
187
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
188 <varlistentry>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
189 <term><option>--pragma=pragma</option></term>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
190 <term><option>-p pragma</option></term>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
191 <listitem>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
192 <para>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
193 Specify assembler pragmas. Multiple pragmas are separated by commas. The
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
194 pragmas accepted are the same as for the PRAGMA assembler directive described
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
195 below.
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
196 </para>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
197 </listitem>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
198 </varlistentry>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
199
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
200 <varlistentry>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
201 <term><option>--raw</option></term>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
202 <term><option>-r</option></term>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
203 <listitem>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
204 <para>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
205 Select raw binary as the output target.
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
206 </para>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
207 </listitem>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
208 </varlistentry>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
209
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
210 <varlistentry>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
211 <term><option>--help</option></term>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
212 <term><option>-?</option></term>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
213 <listitem>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
214 <para>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
215 Present a help screen describing the command line options.
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
216 </para>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
217 </listitem>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
218 </varlistentry>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
219
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
220 <varlistentry>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
221 <term><option>--usage</option></term>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
222 <listitem>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
223 <para>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
224 Provide a summary of the command line options.
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
225 </para>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
226 </listitem>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
227 </varlistentry>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
228
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
229 <varlistentry>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
230 <term><option>--version</option></term>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
231 <term><option>-V</option></term>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
232 <listitem>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
233 <para>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
234 Display the software version.
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
235 </para>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
236 </listitem>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
237 </varlistentry>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
238
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
239 </variablelist>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
240
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
241 </section>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
242
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
243 <section>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
244 <title>Dialects</title>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
245 <para>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
246 LWASM supports all documented MC6809 instructions as defined by Motorola.
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
247 It also supports all known HD6309 instructions. There is some variation,
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
248 however, in the pneumonics used for the block transfer instructions. LWASM
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
249 uses TFM for all four of them as do several other assemblers. Others, such
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
250 as CCASM, use four separate opcodes for it (compare: copy+, copy-, implode,
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
251 and explode). There are advantages to both methods. However, it seems like
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
252 TFM has the most traction and thus, this is what LWASM supports. Support
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
253 for such variations may be added in the future.
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
254 </para>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
255
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
256 <para>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
257 The standard addressing mode specifiers are supported. These are the
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
258 hash sign ("#") for immediate mode, the less than sign ("&lt;") for forced
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
259 eight bit modes, and the greater than sign ("&gt;") for forced sixteen bit modes.
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
260 </para>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
261
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
262 </section>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
263
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
264 <section>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
265 <title>Source Format</title>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
266
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
267 <para>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
268 LWASM accepts plain text files in a relatively free form. It can handle
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
269 lines terminated with CR, LF, CRLF, or LFCR which means it should be able
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
270 to assemble files on any platform on which it compiles.
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
271 </para>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
272 <para>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
273 Each line may start with a symbol. If a symbol is present, there must not
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
274 be any whitespace preceding it. It is legal for a line to contain nothing
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
275 but a symbol.</para>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
276 <para>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
277 The op code is separated from the symbol by whitespace. If there is
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
278 no symbol, there must be at least one white space character preceding it.
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
279 If applicable, the operand follows separated by whitespace. Following the
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
280 opcode and operand is an optional comment.
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
281 </para>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
282 <para>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
283 A comment can also be introduced with a * or a ;. The comment character is
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
284 optional for end of statement comments. However, if a symbol is the only
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
285 thing present on the line other than the comment, the comment character is
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
286 mandatory to prevent the assembler from interpreting the comment as an opcode.
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
287 </para>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
288
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
289 <para>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
290 The opcode is not treated case sensitively. Neither are register names in
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
291 the operand fields. Symbols, however, are case sensitive.
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
292 </para>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
293
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
294 <para>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
295 LWASM does not support line numbers in the file.
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
296 </para>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
297
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
298 </section>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
299
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
300 <section>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
301 <title>Symbols</title>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
302
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
303 <para>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
304 Symbols have no length restriction. They may contain letters, numbers, dots,
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
305 dollar signs, and underscores. They must start with a letter, dot, or
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
306 underscore.
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
307 </para>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
308
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
309 <para>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
310 LWASM also supports the concept of a local symbol. A local symbol is one
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
311 which contains either a "?" or a "@", which can appear anywhere in the symbol.
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
312 The scope of a local symbol is determined by a number of factors. First,
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
313 each included file gets its own local symbol scope. A blank line will also
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
314 be considered a local scope barrier. Macros each have their own local symbol
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
315 scope as well (which has a side effect that you cannot use a local symbol
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
316 as an argument to a macro). There are other factors as well. In general,
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
317 a local symbol is restricted to the block of code it is defined within.
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
318 </para>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
319
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
320 </section>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
321
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
322 <section>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
323 <title>Numbers and Expressions</title>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
324 <para>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
325 Numbers can be expressed in binary, octal, decimal, or hexadecimal.
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
326 Binary numbers may be prefixed with a "%" symbol or suffixed with a
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
327 "b" or "B". Octal numbers may be prefixed with "@" or suffixed with
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
328 "Q", "q", "O", or "o". Hexadecimal numbers may be prefixed with "$" or
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
329 suffixed with "H". No prefix or suffix is required for decimal numbers but
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
330 they can be prefixed with "&amp;" if desired. Any constant which begins with
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
331 a letter must be expressed with the correct prefix base identifier or be
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
332 prefixed with a 0. Thus hexadecimal FF would have to be written either 0FFH
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
333 or $FF. Numbers are not case sensitive.
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
334 </para>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
335
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
336 <para> A symbol may appear at any point where a number is acceptable. The
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
337 special symbol "*" can be used to represent the starting address of the
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
338 current source line within expressions. </para>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
339
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
340 <para>The ASCII value of a character can be included by prefixing it with a
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
341 single quote ('). The ASCII values of two characters can be included by
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
342 prefixing the characters with a quote (").</para>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
343
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
344 <para>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
345 LWASM supports the following basic binary operators: +, -, *, /, and %.
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
346 These represent addition, subtraction, multiplication, division, and modulus.
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
347 It also supports unary negation and unary 1's complement (- and ^ respectively).
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
348 For completeness, a unary positive (+) is supported though it is a no-op.
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
349 </para>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
350
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
351 <para>Operator precedence follows the usual rules. multiplication, division,
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
352 and modulus take precedence over addition and subtraction. Unary operators
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
353 take precedence over binary operators. To force a specific order of evaluation,
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
354 parentheses can be used in the usual manner.
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
355 </para>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
356 </section>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
357
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
358 <section>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
359 <title>Assembler Directives</title>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
360 <para>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
361 Various directives can be used to control the behaviour of the
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
362 assembler or to include non-code/data in the resulting output. Those directives
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
363 that are not described in detail in other sections of this document are
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
364 described below.
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
365 </para>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
366
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
367 <section>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
368 <title>Data Directives</title>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
369 <variablelist>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
370 <varlistentry><term>FCB <parameter>expr[,...]</parameter></term>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
371 <listitem>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
372 <para>Include one or more constant bytes (separated by commas) in the output.</para>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
373 </listitem>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
374 </varlistentry>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
375
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
376 <varlistentry><term>FDB <parameter>expr[,...]</parameter></term>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
377 <listitem>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
378 <para>Include one or more words (separated by commas) in the output.</para>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
379 </listitem>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
380 </varlistentry>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
381
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
382 <varlistentry><term>FQB <parameter>expr[,...]</parameter></term>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
383 <listitem>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
384 <para>Include one or more double words (separated by commas) in the output.</para>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
385 </listitem>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
386 </varlistentry>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
387
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
388 <varlistentry><term>FCC <parameter>string</parameter></term>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
389 <listitem>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
390 <para>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
391 Include a string of text in the output. The first character of the operand
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
392 is the delimiter which must appear as the last character and cannot appear
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
393 within the string. The string is included with no modifications>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
394 </para>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
395 </listitem>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
396 </varlistentry>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
397
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
398 <varlistentry><term>FCN <parameter>string</parameter></term>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
399 <listitem>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
400 <para>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
401 Include a NUL terminated string of text in the output. The first character of
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
402 the operand is the delimiter which must appear as the last character and
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
403 cannot appear within the string. A NUL byte is automatically appended to
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
404 the string.
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
405 </para>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
406 </listitem>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
407 </varlistentry>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
408
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
409 <varlistentry><term>FCS <parameter>string</parameter></term>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
410 <listitem>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
411 <para>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
412 Include a string of text in the output with bit 7 of the final byte set. The
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
413 first character of the operand is the delimiter which must appear as the last
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
414 character and cannot appear within the string.
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
415 </para>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
416 </listitem>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
417 </varlistentry>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
418
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
419 <varlistentry><term>ZMB <parameter>expr</parameter></term>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
420 <listitem>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
421 <para>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
422 Include a number of NUL bytes in the output. The number must be fully resolvable
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
423 during pass 1 of assembly so no forward or external references are permitted.
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
424 </para>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
425 </listitem>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
426 </varlistentry>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
427
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
428 <varlistentry><term>ZMD <parameter>expr</parameter></term>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
429 <listitem>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
430 <para>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
431 Include a number of zero words in the output. The number must be fully
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
432 resolvable during pass 1 of assembly so no forward or external references are
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
433 permitted.
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
434 </para>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
435 </listitem>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
436 </varlistentry>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
437
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
438 <varlistentry><term>ZMQ <parameter>expr<parameter></term>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
439 <listitem>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
440 <para>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
441 Include a number of zero double-words in the output. The number must be fully
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
442 resolvable during pass 1 of assembly so no forward or external references are
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
443 permitted.
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
444 </para>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
445 </listitem>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
446 </varlistentry>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
447
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
448 <varlistentry><term>RMB <parameter>expr</parameter></term>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
449 <listitem>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
450 <para>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
451 Reserve a number of bytes in the output. The number must be fully resolvable
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
452 during pass 1 of assembly so no forward or external references are permitted.
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
453 The value of the bytes is undefined.
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
454 </para>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
455 </listitem>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
456 </varlistentry>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
457
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
458 <varlistentry><term>RMD <parameter>expr</parameter></term>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
459 <listitem>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
460 <para>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
461 Reserve a number of words in the output. The number must be fully
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
462 resolvable during pass 1 of assembly so no forward or external references are
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
463 permitted. The value of the words is undefined.
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
464 </para>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
465 </listitem>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
466 </varlistentry>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
467
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
468 <varlistentry><term>RMQ <parameter>expr</parameter></term>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
469 <listitem>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
470 <para>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
471 Reserve a number of double-words in the output. The number must be fully
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
472 resolvable during pass 1 of assembly so no forward or external references are
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
473 permitted. The value of the double-words is undefined.
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
474 </para>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
475 </listitem>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
476 </varlistentry>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
477 </variablelist>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
478
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
479 </section>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
480
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
481 <section>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
482 <title>Address Definition</title>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
483 <para>The directives in this section all control the addresses of symbols
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
484 or the assembly process itself.</para>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
485
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
486 <variablelist>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
487 <varlistentry><term>ORG <parameter>expr</parameter></term>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
488 <listitem>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
489 <para>Set the assembly address. The address must be fully resolvable on the
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
490 first pass so no external or forward references are permitted. ORG is not
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
491 permitted within sections when outputting to object files. For the DECB
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
492 target, each ORG directive after which output is generated will cause
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
493 a new preamble to be output. ORG is only used to determine the addresses
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
494 of symbols when the raw target is used.
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
495 </para>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
496 </listitem>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
497 </varlistentry>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
498
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
499 <varlistentry>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
500 <term><parameter>sym</parameter> EQU <parameter>expr</parameter></term>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
501 <term><parameter>sym</parameter> = <parameter>expr</parameter></term>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
502 <listitem>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
503 <para>Define the value of <parameter>sym</parameter> to be <parameter>expr</parameter>.
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
504 </listitem>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
505 </varlistentry>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
506
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
507 <varlistentry>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
508 <term><parameter>sym</parameter> SET <parameter>expr</parameter></term>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
509 <listitem>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
510 <para>Define the value of <parameter>sym</parameter> to be <parameter>expr</parameter>.
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
511 Unlike EQU, SET permits symbols to be defined multiple times as long as SET
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
512 is used for all instances. Use of the symbol before the first SET statement
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
513 that sets its value is undefined.</para>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
514 </listitem>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
515 </varlistentry>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
516
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
517 <varlistentry>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
518 <term>SETDP <parameter>expr</parameter></term>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
519 <listitem>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
520 <para>Inform the assembler that it can assume the DP register contains
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
521 <parameter>expr</parameter>. This directive is only advice to the assembler
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
522 to determine whether an address is in the direct page and has no effect
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
523 on the contents of the DP register. The value must be fully resolved during
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
524 the first assembly pass because it affects the sizes of subsequent instructions.
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
525 </para>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
526 <para>This directive has no effect in the object file target.
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
527 </para>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
528 </listitem>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
529 </varlistentry>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
530
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
531 <varlistentry>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
532 <term>ALIGN <parameter>expr</parameter></term>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
533 <listitem>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
534 <para>Force the current assembly address to be a multiple of <parameter>expr</parameter>.
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
535 A series of NUL bytes is output to force the alignment, if required. The
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
536 alignment value must be fully resolved on the first pass because it affects
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
537 the addresses of subsquent instructions.</para>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
538 <para>This directive is not suitable for inclusion in the middle of actual
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
539 code. It is intended to appear where the bytes output will not be executed.
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
540 </para>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
541 </listitem>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
542 </varlistentry>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
543
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
544 </variablelist>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
545
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
546 </section>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
547
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
548 <section>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
549 <title>Conditional Assembly</title>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
550 <para>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
551 Portions of the source code can be excluded or included based on conditions
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
552 known at assembly time. Conditionals can be nested arbitrarily deeply. The
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
553 directives associated with conditional assembly are described in this section.
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
554 </para>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
555 <para>All conditionals must be fully bracketed. That is, every conditional
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
556 statement must eventually be followed by an ENDC at the same level of nesting.
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
557 </para>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
558 <para>Conditional expressions are only evaluated on the first assembly pass.
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
559 It is not possible to game the assembly process by having a conditional
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
560 change its value between assembly passes. Thus there is not and never will
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
561 be any equivalent of IFP1 or IFP2 as provided by other assemblers.</para>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
562
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
563 <variablelist>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
564 <varlistentry>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
565 <term>IFEQ <parameter>expr</parameter></term>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
566 <listitem>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
567 <para>If <parameter>expr</parameter> evaluates to zero, the conditional
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
568 will be considered true.
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
569 </para>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
570 </listitem>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
571 </varlistentry>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
572
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
573 <varlistentry>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
574 <term>IFNE <parameter>expr</parameter></term>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
575 <term>IF <parameter>expr</parameter></term>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
576 <listitem>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
577 <para>If <parameter>expr</parameter> evaluates to a non-zero value, the conditional
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
578 will be considered true.
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
579 </para>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
580 </listitem>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
581 </varlistentry>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
582
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
583 <varlistentry>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
584 <term>IFGT <parameter>expr</parameter></term>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
585 <listitem>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
586 <para>If <parameter>expr</parameter> evaluates to a value greater than zero, the conditional
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
587 will be considered true.
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
588 </para>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
589 </listitem>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
590 </varlistentry>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
591
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
592 <varlistentry>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
593 <term>IFGE <parameter>expr</parameter></term>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
594 <listitem>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
595 <para>If <parameter>expr</parameter> evaluates to a value greater than or equal to zero, the conditional
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
596 will be considered true.
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
597 </para>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
598 </listitem>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
599 </varlistentry>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
600
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
601 <varlistentry>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
602 <term>IFLT <parameter>expr</parameter></term>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
603 <listitem>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
604 <para>If <parameter>expr</parameter> evaluates to a value less than zero, the conditional
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
605 will be considered true.
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
606 </para>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
607 </listitem>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
608 </varlistentry>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
609
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
610 <varlistentry>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
611 <term>IFLE <parameter>expr</parameter></term>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
612 <listitem>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
613 <para>If <parameter>expr</parameter> evaluates to a value less than or equal to zero , the conditional
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
614 will be considered true.
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
615 </para>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
616 </listitem>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
617 </varlistentry>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
618
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
619 <varlistentry>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
620 <term>IFDEF <parameter>sym</parameter></term>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
621 <listitem>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
622 <para>If <parameter>sym</parameter> is defined at this point in the assembly
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
623 process, the conditional
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
624 will be considered true.
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
625 </para>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
626 </listitem>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
627 </varlistentry>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
628
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
629 <varlistentry>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
630 <term>IFNDEF <parameter>sym</parameter></term>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
631 <listitem>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
632 <para>If <parameter>sym</parameter> is not defined at this point in the assembly
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
633 process, the conditional
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
634 will be considered true.
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
635 </para>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
636 </listitem>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
637 </varlistentry>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
638
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
639 <varlistentry>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
640 <term>ELSE</term>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
641 <listitem>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
642 <para>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
643 If the preceding conditional at the same level of nesting was false, the
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
644 statements following will be assembled. If the preceding conditional at
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
645 the same level was true, the statements following will not be assembled.
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
646 Note that the preceding conditional might have been another ELSE statement
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
647 although this behaviour is not guaranteed to be supported in future versions
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
648 of LWASM.
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
649 </para>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
650 </listitem>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
651
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
652 <varlistentry>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
653 <term>ENDC</term>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
654 <listitem>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
655 <para>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
656 This directive marks the end of a conditional construct. Every conditional
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
657 construct must end with an ENDC directive.
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
658 </para>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
659 </listitem>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
660 </varlistentry>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
661
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
662 </variablelist>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
663 </section>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
664
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
665 <section>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
666 <title>Miscelaneous Directives</title>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
667
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
668 <para>This section includes directives that do not fit into the other
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
669 categories.</para>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
670
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
671 <variablelist>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
672
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
673 <varlistentry>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
674 <term>INCLUDE <parameter>filename</parameter></term>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
675 <listitem>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
676 <para>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
677 Include the contents of <parameter>filename</parameter> at this point in
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
678 the assembly as though it were a part of the file currently being processed.
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
679 Note that whitespace cannot appear in the name of the file.
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
680 </para>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
681 </listitem>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
682 </varlistentry>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
683
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
684 <varlistentry>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
685 <term>END <parameter>[expr]</parameter></term>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
686 <listitem>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
687 <para>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
688 This directive causes the assembler to stop assembling immediately as though
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
689 it ran out of input. For the DECB target only, <parameter>expr</parameter>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
690 can be used to set the execution address of the resulting binary. For all
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
691 other targets, specifying <parameter>expr</parameter> will cause an error.
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
692 </para>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
693 </listitem>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
694 </varlistentry>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
695
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
696 <varlistentry>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
697 <term>ERROR <parameter>string</parameter></term>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
698 <listitem>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
699 <para>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
700 Causes a custom error message to be printed at this line. This will cause
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
701 assembly to fail. This directive is most useful inside conditional constructs
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
702 to cause assembly to fail if some condition that is known bad happens.
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
703 </para>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
704 </listitem>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
705 </varlistentry>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
706
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
707 </variablelist>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
708 </section>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
709
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
710 </section>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
711
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
712 <section>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
713 <title>Macros</title>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
714 <para>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
715 LWASM is a macro assembler. A macro is simply a name that stands in for a
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
716 series of instructions. Once a macro is defined, it is used like any other
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
717 assembler directive. Defining a macro can be considered equivalent to adding
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
718 additional assembler directives.
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
719 </para>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
720 <para>Macros my accept parameters. These parameters are referenced within
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
721 a macro by the a backslash ("\") followed by a digit 1 through 9 for the first
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
722 through ninth parameters. They may also be referenced by enclosing the
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
723 decimal parameter number in braces ("{num}"). These parameter references
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
724 are replaced with the verbatim text of the parameter passed to the macro. A
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
725 reference to a non-existent parameter will be replaced by an empty string.
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
726 Macro parameters are expanded everywhere on each source line. That means
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
727 the parameter to a macro could be used as a symbol or it could even appear
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
728 in a comment or could cause an entire source line to be commented out
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
729 when the macro is expanded.
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
730 </para>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
731 <para>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
732 Parameters passed to a macro are separated by commas and the parameter list
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
733 is terminated by any whitespace. This means that neither a comma nor whitespace
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
734 may be included in a macro parameter.
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
735 </para>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
736 <para>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
737 Macro expansion is done recursively. That is, within a macro, macros are
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
738 expanded. This can lead to infinite loops in macro expansion. If the assembler
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
739 hangs for a long time while assembling a file that uses macros, this may be
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
740 the reason.</para>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
741
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
742 <para>Each macro expansion receives its own local symbol context which is not
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
743 inherited by any macros called by it nor is it inherited from the context
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
744 the macro was instantiated in. That means it is possible to use local symbols
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
745 within macros without having them collide with symbols in other macros or
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
746 outside the macro itself. However, this also means that using a local symbol
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
747 as a parameter to a macro, while legal, will not do what it would seem to do
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
748 as it will result in looking up the local symbol in the macro's symbol context
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
749 rather than the enclosing context where it came from, likely yielding either
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
750 an undefined symbol error or bizarre assembly results.
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
751 </para>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
752 <para>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
753 Note that there is no way to define a macro as local to a symbol context. All
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
754 macros are part of the global macro namespace. However, macros have a separate
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
755 namespace from symbols so it is possible to have a symbol with the same name
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
756 as a macro.
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
757 </para>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
758
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
759 <para>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
760 Macros are defined only during the first pass. Macro expansion also
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
761 only occurs during the first pass. On the second pass, the macro
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
762 definition is simply ignored. Macros must be defined before they are used.
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
763 </para>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
764
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
765 <para>The following directives are used when defining macros.</para>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
766
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
767 <variablelist>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
768 <varlistentry>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
769 <term><parameter>macroname</parameter> MACRO</term>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
770 <listitem>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
771 <para>This directive is used to being the definition of a macro called
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
772 <parameter>macroname</parameter>. If <parameter>macroname</parameter> already
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
773 exists, it is considered an error. Attempting to define a macro within a
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
774 macro is undefined. It may work and it may not so the behaviour should not
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
775 be relied upon.
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
776 </para>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
777 </listitem>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
778 </varlistentry>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
779
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
780 <varlistentry>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
781 <term>ENDM</term>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
782 <listitem>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
783 <para>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
784 This directive indicates the end of the macro currently being defined. It
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
785 causes the assembler to resume interpreting source lines as normal.
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
786 </para>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
787 </listitem>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
788 </variablelist>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
789
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
790 </section>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
791
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
792 <section>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
793 <title>Object Files and Sections</title>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
794 <para>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
795 The object file target is very useful for large project because it allows
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
796 multiple files to be assembled independently and then linked into the final
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
797 binary at a later time. It allows only the small portion of the project
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
798 that was modified to be re-assembled rather than requiring the entire set
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
799 of source code to be available to the assembler in a single assembly process.
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
800 This can be particularly important if there are a large number of macros,
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
801 symbol definitions, or other metadata that uses resources at assembly time.
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
802 By far the largest benefit, however, is keeping the source files small enough
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
803 for a mere mortal to find things in them.
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
804 </para>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
805
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
806 <para>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
807 With multi-file projects, there needs to be a means of resolving references to
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
808 symbols in other source files. These are known as external references. The
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
809 addresses of these symbols cannot be known until the linker joins all the
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
810 object files into a single binary. This means that the assembler must be
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
811 able to output the object code without knowing the value of the symbol. This
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
812 places some restrictions on the code generated by the assembler. For
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
813 example, the assembler cannot generate direct page addressing for instructions
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
814 that reference external symbols because the address of the symbol may not
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
815 be in the direct page. Similarly, relative branches and PC relative addressing
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
816 cannot be used in their eight bit forms. Everything that must be resolved
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
817 by the linker must be assembled to use the largest address size possible to
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
818 allow the linker to fill in the correct value at link time. Note that the
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
819 same problem applies to absolute address references as well, even those in
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
820 the same source file, because the address is not known until link time.
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
821 </para>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
822
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
823 <para>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
824 It is often desired in multi-file projects to have code of various types grouped
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
825 together in the final binary generated by the linker as well. The same applies
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
826 to data. In order for the linker to do that, the bits that are to be grouped
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
827 must be tagged in some manner. This is where the concept of sections comes in.
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
828 Each chunk of code or data is part of a section in the object file. Then,
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
829 when the linker reads all the object files, it coalesces all sections of the
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
830 same name into a single section and then considers it as a unit.
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
831 </para>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
832
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
833 <para>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
834 The existence of sections, however, raises a problem for symbols even
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
835 within the same source file. Thus, the assembler must treat symbols from
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
836 different sections within the same source file in the same manner as external
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
837 symbols. That is, it must leave them for the linker to resolve at link time,
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
838 with all the limitations that entails.
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
839 </para>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
840
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
841 <para>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
842 In the object file target mode, LWASM requires all source lines that
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
843 cause bytes to be output to be inside a section. Any directives that do
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
844 not cause any bytes to be output can appear outside of a section. This includes
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
845 such things as EQU or RMB. Even ORG can appear outside a section. ORG, however,
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
846 makes no sense within a section because it is the linker that determines
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
847 the starting address of the section's code, not the assembler.
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
848 </para>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
849
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
850 <para>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
851 All symbols defined globally in the assembly process are local to the
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
852 source file and cannot be exported. All symbols defined within a section are
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
853 considered local to the source file unless otherwise explicitly exported.
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
854 Symbols referenced from external source files must be declared external,
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
855 either explicitly or by asking the assembler to assume that all undefined
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
856 symbols are external.
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
857 </para>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
858
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
859 <para>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
860 It is often handy to define a number of memory addresses that will be
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
861 used for data at run-time but which need not be included in the binary file.
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
862 These memory addresses are not initialized until run-time, either by the
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
863 program itself or by the program loader, depending on the operating environment.
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
864 Such sections are often known as BSS sections. LWASM supports generating
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
865 sections with a BSS attribute set which causes the section definition including
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
866 symbols exported from that section and those symbols required to resolve
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
867 references from the local file, but with no actual code in the object file.
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
868 It is illegal for any source lines within a BSS flagged section to cause any
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
869 bytes to be output.
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
870 </para>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
871
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
872 <para>The following directives apply to section handling.</para>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
873
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
874 <variablelist>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
875 <varlistentry>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
876 <term>SECTION <parameter>name[,flags]</parameter></term>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
877 <term>SECT <parameter>name[,flags]</parameter></term>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
878 <listitem>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
879 <para>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
880 Instructs the assembler that the code following this directive is to be
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
881 considered part of the section <parameter>name</parameter>. A section name
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
882 may appear multiple times in which case it is as though all the code from
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
883 all the instances of that section appeared adjacent within the source file.
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
884 However, <parameter>flags</parameter> may only be specified on the first
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
885 instance of the section.
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
886 </para>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
887 <para>There is a single flag supported in <parameter>flags</parameter>. The
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
888 flag <parameter>bss</parameter> will cause the section to be treated as a BSS
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
889 section and, thus, no code will be included in the object file nor will any
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
890 bytes be permitted to be output.</para>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
891 <para>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
892 If assembly is already happening within a section, the section is implicitly
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
893 ended and the new section started. This is not considered an error although
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
894 it is recommended that all sections be explicitly closed.
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
895 </para>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
896 </listitem>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
897 </varlistentry>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
898
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
899 <varlistentry>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
900 <term>ENDSECTION</term>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
901 <term>ENDSECT</term>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
902 <term>ENDS</term>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
903 <listitem>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
904 <para>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
905 This directive ends the current section. This puts assembly outside of any
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
906 sections until the next SECTION directive.
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
907 </listitem>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
908 </varlistentry>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
909
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
910 <varlistentry>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
911 <term><parameter>sym</parameter> EXTERN</term>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
912 <term><parameter>sym</parameter> EXTERNAL</term>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
913 <term><parameter>sym</parameter> IMPORT</term>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
914 <listitem>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
915 <para>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
916 This directive defines <parameter>sym</parameter> as an external symbol.
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
917 This directive may occur at any point in the source code. EXTERN definitions
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
918 are resolved on the first pass so an EXTERN definition anywhere in the
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
919 source file is valid for the entire file. The use of this directive is
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
920 optional when the assembler is instructed to assume that all undefined
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
921 symbols are external. In fact, in that mode, if the symbol is referenced
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
922 before the EXTERN directive, an error will occur.
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
923 </para>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
924 </listitem>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
925 </varlistentry>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
926
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
927 <varlistentry>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
928 <term><parameter>sym</parameter> EXPORT</term>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
929 <listitem>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
930 <para>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
931 This directive defines <parameter>sym</parameter> as an exported symbol.
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
932 This directive may occur at any point in the source code, even before the
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
933 definition of the exported symbol.
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
934 </para>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
935 </listitem>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
936 </varlistentry>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
937
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
938 </variablelist>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
939
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
940 </section>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
941
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
942 <section>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
943 <title>Assembler Modes and Pragmas</title>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
944 <para>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
945 There are a number of options that affect the way assembly is performed.
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
946 Some of these options can only be specified on the command line because
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
947 they determine something absolute about the assembly process. These include
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
948 such things as the output target. Other things may be switchable during
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
949 the assembly process. These are known as pragmas and are, by definition,
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
950 not portable between assemblers.
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
951 </para>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
952
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
953 <para>LWASM supports a number of pragmas that affect code generation or
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
954 otherwise affect the behaviour of the assembler. These may be specified by
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
955 way of a command line option or by assembler directives. The directives
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
956 are as follows.
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
957 </para>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
958
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
959 <variablelist>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
960 <varlistentry>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
961 <term>PRAGMA <parameter>pragma[,...]</parameter></term>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
962 <listitem>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
963 <para>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
964 Specifies that the assembler should bring into force all <parameter>pragma</parameter>s
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
965 specified. Any unrecognized pragma will cause an assembly error. The new
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
966 pragmas will take effect immediately. This directive should be used when
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
967 the program will assemble incorrectly if the pragma is ignored or not supported.
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
968 </para>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
969 </listitem>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
970 </varlistentry>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
971
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
972 <varlistentry>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
973 <term>*PRAGMA <parameter>pragma[,...]</parameter></term>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
974 <listitem>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
975 <para>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
976 This is identical to the PRAGMA directive except no error will occur with
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
977 unrecognized or unsupported pragmas. This directive, by virtue of starting
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
978 with a comment character, will also be ignored by assemblers that do not
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
979 support this directive. Use this variation if the pragma is not required
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
980 for correct functioning of the code.
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
981 </para>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
982 </listitem>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
983 </varlistentry>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
984 </variablelist>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
985
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
986 <para>Each pragma supported has a positive version and a negative version.
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
987 The positive version enables the pragma while the negative version disables
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
988 it. The negatitve version is simply the positive version with "no" prefixed
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
989 to it. For instance, "pragma" vs. "nopragma". Only the positive version is
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
990 listed below.</para>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
991
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
992 <para>Pragmas are not case sensitive.</para>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
993
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
994 <variablelist>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
995 <varlistentry>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
996 <term>index0tonone</term>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
997 <listitem>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
998 <para>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
999 When in force, this pragma enables an optimization affecting indexed addressing
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
1000 modes. When the offset expression in an indexed mode evaluates to zero but is
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
1001 not explicity written as 0, this will replace the operand with the equivalent
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
1002 no offset mode, thus creating slightly faster code. Because of the advantages
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
1003 of this optimization, it is enabled by default.
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
1004 </para>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
1005 </listitem>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
1006 </varlistentry>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
1007
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
1008 <varlistentry>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
1009 <term>undefextern</term>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
1010 <listitem>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
1011 <para>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
1012 This pragma is only valid for targets that support external references. When in
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
1013 force, if the assembler sees an undefined symbol on the second pass, it will
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
1014 automatically define it as an external symbol. This automatic definition will
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
1015 apply for the remainder of the assembly process, even if the pragma is
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
1016 subsequently turned off. Because this behaviour would be potentially surprising,
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
1017 this pragma defaults to off.
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
1018 </para>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
1019 <para>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
1020 The primary use for this pragma is for projects that share a large number of
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
1021 symbols between source files. In such cases, it is impractical to enumerate
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
1022 all the external references in every source file. This allows the assembler
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
1023 and linker to do the heavy lifting while not preventing a particular source
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
1024 module from defining a local symbol of the same name as an external symbol
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
1025 if it does not need the external symbol. (This pragma will not cause an
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
1026 automatic external definition if there is already a locally defined symbol.)
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
1027 </para>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
1028 <para>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
1029 This pragma will often be specified on the command line for large projects.
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
1030 However, depending on the specific dynamics of the project, it may be sufficient
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
1031 for one or two files to use this pragma internally.
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
1032 </para>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
1033 </listitem>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
1034 </varlistentry>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
1035 </variablelist>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
1036
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
1037 </section>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
1038
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
1039 </chapter>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
1040
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
1041 <chapter>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
1042 <title>LWLINK</title>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
1043 <para>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
1044 </para>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
1045 </chapter>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
1046
109
f21a5593a661 Updated docs
lost
parents:
diff changeset
1047 <chapter id="objchap">
f21a5593a661 Updated docs
lost
parents:
diff changeset
1048 <title>Object Files</title>
145
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
1049 <para>
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
1050 LWTOOLS uses a proprietary object file format. It is proprietary in the sense
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
1051 that it is specific to LWTOOLS, not that it is a hidden format. It would be
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
1052 hard to keep it hidden in an open source tool chain anyway. This chapter
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
1053 documents the object file format.
afe30454382f Made development version of LWASM be 2.1, not 3.0, because the next release will be an incremental feature release
lost
parents: 109
diff changeset
1054 </para>
109
f21a5593a661 Updated docs
lost
parents:
diff changeset
1055 </chapter>
f21a5593a661 Updated docs
lost
parents:
diff changeset
1056 </book>
f21a5593a661 Updated docs
lost
parents:
diff changeset
1057