Mercurial > hg-old > index.cgi
annotate doc/manual/x580.html @ 442:a9521955554f 3.0
Added pragma pcaspcr to treat PC as PCR; additional fixes for PCR addressing modes
author | lost@l-w.ca |
---|---|
date | Sat, 30 Oct 2010 12:15:00 -0600 |
parents | b8bf63962a99 |
children |
rev | line source |
---|---|
434 | 1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN""http://www.w3.org/TR/html4/loose.dtd"> |
2 <HTML | |
3 ><HEAD | |
4 ><TITLE | |
5 >Assembler Modes and Pragmas</TITLE | |
6 ><META | |
7 NAME="GENERATOR" | |
8 CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK | |
9 REL="HOME" | |
10 TITLE="LW Tool Chain" | |
11 HREF="index.html"><LINK | |
12 REL="UP" | |
13 TITLE="LWASM" | |
14 HREF="c43.html"><LINK | |
15 REL="PREVIOUS" | |
16 TITLE="Object Files and Sections" | |
17 HREF="x517.html"><LINK | |
18 REL="NEXT" | |
19 TITLE="LWLINK" | |
442
a9521955554f
Added pragma pcaspcr to treat PC as PCR; additional fixes for PCR addressing modes
lost@l-w.ca
parents:
434
diff
changeset
|
20 HREF="c629.html"></HEAD |
434 | 21 ><BODY |
22 CLASS="SECTION" | |
23 BGCOLOR="#FFFFFF" | |
24 TEXT="#000000" | |
25 LINK="#0000FF" | |
26 VLINK="#840084" | |
27 ALINK="#0000FF" | |
28 ><DIV | |
29 CLASS="NAVHEADER" | |
30 ><TABLE | |
31 SUMMARY="Header navigation table" | |
32 WIDTH="100%" | |
33 BORDER="0" | |
34 CELLPADDING="0" | |
35 CELLSPACING="0" | |
36 ><TR | |
37 ><TH | |
38 COLSPAN="3" | |
39 ALIGN="center" | |
40 >LW Tool Chain</TH | |
41 ></TR | |
42 ><TR | |
43 ><TD | |
44 WIDTH="10%" | |
45 ALIGN="left" | |
46 VALIGN="bottom" | |
47 ><A | |
48 HREF="x517.html" | |
49 ACCESSKEY="P" | |
50 >Prev</A | |
51 ></TD | |
52 ><TD | |
53 WIDTH="80%" | |
54 ALIGN="center" | |
55 VALIGN="bottom" | |
56 >Chapter 3. LWASM</TD | |
57 ><TD | |
58 WIDTH="10%" | |
59 ALIGN="right" | |
60 VALIGN="bottom" | |
61 ><A | |
442
a9521955554f
Added pragma pcaspcr to treat PC as PCR; additional fixes for PCR addressing modes
lost@l-w.ca
parents:
434
diff
changeset
|
62 HREF="c629.html" |
434 | 63 ACCESSKEY="N" |
64 >Next</A | |
65 ></TD | |
66 ></TR | |
67 ></TABLE | |
68 ><HR | |
69 ALIGN="LEFT" | |
70 WIDTH="100%"></DIV | |
71 ><DIV | |
72 CLASS="SECTION" | |
73 ><H1 | |
74 CLASS="SECTION" | |
75 ><A | |
76 NAME="AEN580" | |
77 >3.10. Assembler Modes and Pragmas</A | |
78 ></H1 | |
79 ><P | |
80 >There are a number of options that affect the way assembly is performed. | |
81 Some of these options can only be specified on the command line because | |
82 they determine something absolute about the assembly process. These include | |
83 such things as the output target. Other things may be switchable during | |
84 the assembly process. These are known as pragmas and are, by definition, | |
85 not portable between assemblers.</P | |
86 ><P | |
87 >LWASM supports a number of pragmas that affect code generation or | |
88 otherwise affect the behaviour of the assembler. These may be specified by | |
89 way of a command line option or by assembler directives. The directives | |
90 are as follows.</P | |
91 ><P | |
92 ></P | |
93 ><DIV | |
94 CLASS="VARIABLELIST" | |
95 ><DL | |
96 ><DT | |
97 >PRAGMA <CODE | |
98 CLASS="PARAMETER" | |
99 >pragma[,...]</CODE | |
100 ></DT | |
101 ><DD | |
102 ><P | |
103 >Specifies that the assembler should bring into force all <CODE | |
104 CLASS="PARAMETER" | |
105 >pragma</CODE | |
106 >s | |
107 specified. Any unrecognized pragma will cause an assembly error. The new | |
108 pragmas will take effect immediately. This directive should be used when | |
109 the program will assemble incorrectly if the pragma is ignored or not supported.</P | |
110 ></DD | |
111 ><DT | |
112 >*PRAGMA <CODE | |
113 CLASS="PARAMETER" | |
114 >pragma[,...]</CODE | |
115 ></DT | |
116 ><DD | |
117 ><P | |
118 >This is identical to the PRAGMA directive except no error will occur with | |
119 unrecognized or unsupported pragmas. This directive, by virtue of starting | |
120 with a comment character, will also be ignored by assemblers that do not | |
121 support this directive. Use this variation if the pragma is not required | |
122 for correct functioning of the code.</P | |
123 ></DD | |
124 ></DL | |
125 ></DIV | |
126 ><P | |
127 >Each pragma supported has a positive version and a negative version. | |
128 The positive version enables the pragma while the negative version disables | |
129 it. The negatitve version is simply the positive version with "no" prefixed | |
130 to it. For instance, "pragma" vs. "nopragma". Only the positive version is | |
131 listed below.</P | |
132 ><P | |
133 >Pragmas are not case sensitive.</P | |
134 ><P | |
135 ></P | |
136 ><DIV | |
137 CLASS="VARIABLELIST" | |
138 ><DL | |
139 ><DT | |
140 >index0tonone</DT | |
141 ><DD | |
142 ><P | |
143 >When in force, this pragma enables an optimization affecting indexed addressing | |
144 modes. When the offset expression in an indexed mode evaluates to zero but is | |
145 not explicity written as 0, this will replace the operand with the equivalent | |
146 no offset mode, thus creating slightly faster code. Because of the advantages | |
147 of this optimization, it is enabled by default.</P | |
148 ></DD | |
149 ><DT | |
150 >cescapes</DT | |
151 ><DD | |
152 ><P | |
153 >This pragma will cause strings in the FCC, FCS, and FCN pseudo operations to | |
154 have C-style escape sequences interpreted. The one departure from the official | |
155 spec is that unrecognized escape sequences will return either the character | |
156 immediately following the backslash or some undefined value. Do not rely | |
157 on the behaviour of undefined escape sequences.</P | |
158 ></DD | |
159 ><DT | |
160 >importundefexport</DT | |
161 ><DD | |
162 ><P | |
163 >This pragma is only valid for targets that support external references. When | |
164 in force, it will cause the EXPORT directive to act as IMPORT if the symbol | |
165 to be exported is not defined. This is provided for compatibility with the | |
166 output of gcc6809 and should not be used in hand written code. Because of | |
167 the confusion this pragma can cause, it is disabled by default.</P | |
168 ></DD | |
169 ><DT | |
170 >undefextern</DT | |
171 ><DD | |
172 ><P | |
173 >This pragma is only valid for targets that support external references. When in | |
174 force, if the assembler sees an undefined symbol on the second pass, it will | |
175 automatically define it as an external symbol. This automatic definition will | |
176 apply for the remainder of the assembly process, even if the pragma is | |
177 subsequently turned off. Because this behaviour would be potentially surprising, | |
178 this pragma defaults to off.</P | |
179 ><P | |
180 >The primary use for this pragma is for projects that share a large number of | |
181 symbols between source files. In such cases, it is impractical to enumerate | |
182 all the external references in every source file. This allows the assembler | |
183 and linker to do the heavy lifting while not preventing a particular source | |
184 module from defining a local symbol of the same name as an external symbol | |
185 if it does not need the external symbol. (This pragma will not cause an | |
186 automatic external definition if there is already a locally defined symbol.)</P | |
187 ><P | |
188 >This pragma will often be specified on the command line for large projects. | |
189 However, depending on the specific dynamics of the project, it may be sufficient | |
190 for one or two files to use this pragma internally.</P | |
191 ></DD | |
192 ><DT | |
193 >dollarlocal</DT | |
194 ><DD | |
195 ><P | |
196 >When set, a "$" in a symbol makes it local. When not set, "$" does not | |
197 cause a symbol to be local. It is set by default except when using the OS9 | |
198 target.</P | |
199 ></DD | |
200 ><DT | |
201 >dollarnotlocal</DT | |
202 ><DD | |
203 ><P | |
204 > This is the same as the "dollarlocal" pragma except its sense is | |
205 reversed. That is, "dollarlocal" and "nodollarnotlocal" are equivalent and | |
206 "nodollarlocal" and "dollarnotlocal" are equivalent. </P | |
207 ></DD | |
442
a9521955554f
Added pragma pcaspcr to treat PC as PCR; additional fixes for PCR addressing modes
lost@l-w.ca
parents:
434
diff
changeset
|
208 ><DT |
a9521955554f
Added pragma pcaspcr to treat PC as PCR; additional fixes for PCR addressing modes
lost@l-w.ca
parents:
434
diff
changeset
|
209 >pcaspcr</DT |
a9521955554f
Added pragma pcaspcr to treat PC as PCR; additional fixes for PCR addressing modes
lost@l-w.ca
parents:
434
diff
changeset
|
210 ><DD |
a9521955554f
Added pragma pcaspcr to treat PC as PCR; additional fixes for PCR addressing modes
lost@l-w.ca
parents:
434
diff
changeset
|
211 ><P |
a9521955554f
Added pragma pcaspcr to treat PC as PCR; additional fixes for PCR addressing modes
lost@l-w.ca
parents:
434
diff
changeset
|
212 > Normally, LWASM makes a distinction between PC and PCR in program |
a9521955554f
Added pragma pcaspcr to treat PC as PCR; additional fixes for PCR addressing modes
lost@l-w.ca
parents:
434
diff
changeset
|
213 counter relative addressing. In particular, the use of PC means an absolute |
a9521955554f
Added pragma pcaspcr to treat PC as PCR; additional fixes for PCR addressing modes
lost@l-w.ca
parents:
434
diff
changeset
|
214 offset from PC while PCR causes the assembler to calculate the offset to the |
a9521955554f
Added pragma pcaspcr to treat PC as PCR; additional fixes for PCR addressing modes
lost@l-w.ca
parents:
434
diff
changeset
|
215 specified operand and use that as the offset from PC. By setting this |
a9521955554f
Added pragma pcaspcr to treat PC as PCR; additional fixes for PCR addressing modes
lost@l-w.ca
parents:
434
diff
changeset
|
216 pragma, you can have PC treated the same as PCR. </P |
a9521955554f
Added pragma pcaspcr to treat PC as PCR; additional fixes for PCR addressing modes
lost@l-w.ca
parents:
434
diff
changeset
|
217 ></DD |
434 | 218 ></DL |
219 ></DIV | |
220 ></DIV | |
221 ><DIV | |
222 CLASS="NAVFOOTER" | |
223 ><HR | |
224 ALIGN="LEFT" | |
225 WIDTH="100%"><TABLE | |
226 SUMMARY="Footer navigation table" | |
227 WIDTH="100%" | |
228 BORDER="0" | |
229 CELLPADDING="0" | |
230 CELLSPACING="0" | |
231 ><TR | |
232 ><TD | |
233 WIDTH="33%" | |
234 ALIGN="left" | |
235 VALIGN="top" | |
236 ><A | |
237 HREF="x517.html" | |
238 ACCESSKEY="P" | |
239 >Prev</A | |
240 ></TD | |
241 ><TD | |
242 WIDTH="34%" | |
243 ALIGN="center" | |
244 VALIGN="top" | |
245 ><A | |
246 HREF="index.html" | |
247 ACCESSKEY="H" | |
248 >Home</A | |
249 ></TD | |
250 ><TD | |
251 WIDTH="33%" | |
252 ALIGN="right" | |
253 VALIGN="top" | |
254 ><A | |
442
a9521955554f
Added pragma pcaspcr to treat PC as PCR; additional fixes for PCR addressing modes
lost@l-w.ca
parents:
434
diff
changeset
|
255 HREF="c629.html" |
434 | 256 ACCESSKEY="N" |
257 >Next</A | |
258 ></TD | |
259 ></TR | |
260 ><TR | |
261 ><TD | |
262 WIDTH="33%" | |
263 ALIGN="left" | |
264 VALIGN="top" | |
265 >Object Files and Sections</TD | |
266 ><TD | |
267 WIDTH="34%" | |
268 ALIGN="center" | |
269 VALIGN="top" | |
270 ><A | |
271 HREF="c43.html" | |
272 ACCESSKEY="U" | |
273 >Up</A | |
274 ></TD | |
275 ><TD | |
276 WIDTH="33%" | |
277 ALIGN="right" | |
278 VALIGN="top" | |
279 >LWLINK</TD | |
280 ></TR | |
281 ></TABLE | |
282 ></DIV | |
283 ></BODY | |
284 ></HTML | |
285 > |