annotate doc/manual/x478.html @ 269:6cbc409ff09f 2.6

Added asprintf redux
author lost
date Tue, 22 Dec 2009 05:53:05 +0000
parents 61d1db1dfe2a
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
264
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN""http://www.w3.org/TR/html4/loose.dtd">
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
2 <HTML
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
3 ><HEAD
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
4 ><TITLE
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
5 >Structures</TITLE
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
6 ><META
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
7 NAME="GENERATOR"
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
8 CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
9 REL="HOME"
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
10 TITLE="LW Tool Chain"
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
11 HREF="index.html"><LINK
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
12 REL="UP"
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
13 TITLE="LWASM"
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
14 HREF="c43.html"><LINK
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
15 REL="PREVIOUS"
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
16 TITLE="Macros"
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
17 HREF="x456.html"><LINK
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
18 REL="NEXT"
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
19 TITLE="Object Files and Sections"
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
20 HREF="x498.html"></HEAD
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
21 ><BODY
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
22 CLASS="SECTION"
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
23 BGCOLOR="#FFFFFF"
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
24 TEXT="#000000"
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
25 LINK="#0000FF"
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
26 VLINK="#840084"
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
27 ALINK="#0000FF"
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
28 ><DIV
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
29 CLASS="NAVHEADER"
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
30 ><TABLE
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
31 SUMMARY="Header navigation table"
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
32 WIDTH="100%"
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
33 BORDER="0"
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
34 CELLPADDING="0"
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
35 CELLSPACING="0"
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
36 ><TR
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
37 ><TH
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
38 COLSPAN="3"
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
39 ALIGN="center"
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
40 >LW Tool Chain</TH
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
41 ></TR
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
42 ><TR
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
43 ><TD
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
44 WIDTH="10%"
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
45 ALIGN="left"
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
46 VALIGN="bottom"
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
47 ><A
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
48 HREF="x456.html"
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
49 ACCESSKEY="P"
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
50 >Prev</A
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
51 ></TD
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
52 ><TD
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
53 WIDTH="80%"
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
54 ALIGN="center"
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
55 VALIGN="bottom"
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
56 >Chapter 3. LWASM</TD
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
57 ><TD
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
58 WIDTH="10%"
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
59 ALIGN="right"
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
60 VALIGN="bottom"
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
61 ><A
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
62 HREF="x498.html"
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
63 ACCESSKEY="N"
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
64 >Next</A
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
65 ></TD
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
66 ></TR
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
67 ></TABLE
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
68 ><HR
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
69 ALIGN="LEFT"
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
70 WIDTH="100%"></DIV
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
71 ><DIV
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
72 CLASS="SECTION"
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
73 ><H1
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
74 CLASS="SECTION"
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
75 ><A
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
76 NAME="AEN478"
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
77 >3.8. Structures</A
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
78 ></H1
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
79 ><P
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
80 >&#13;Structures are used to group related data in a fixed structure. A structure
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
81 consists a number of fields, defined in sequential order and which take up
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
82 specified size. The assembler does not enforce any means of access within a
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
83 structure; it assumes that whatever you are doing, you intended to do.
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
84 There are two pseudo ops that are used for defining structures.&#13;</P
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
85 ><P
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
86 ></P
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
87 ><DIV
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
88 CLASS="VARIABLELIST"
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
89 ><DL
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
90 ><DT
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
91 ><CODE
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
92 CLASS="PARAMETER"
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
93 >structname</CODE
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
94 > STRUCT</DT
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
95 ><DD
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
96 ><P
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
97 >&#13;This directive is used to begin the definition of a structure with name
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
98 <CODE
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
99 CLASS="PARAMETER"
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
100 >structname</CODE
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
101 >. Subsequent statements all form part of
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
102 the structure definition until the end of the structure is declared.&#13;</P
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
103 ></DD
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
104 ><DT
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
105 >ENDSTRUCT</DT
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
106 ><DD
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
107 ><P
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
108 >This directive ends the definition of the structure.</P
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
109 ></DD
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
110 ></DL
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
111 ></DIV
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
112 ><P
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
113 >&#13;Within a structure definition, only reservation pseudo ops are permitted.
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
114 Anything else will cause an assembly error.</P
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
115 ><P
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
116 > Once a structure is defined, you can reserve an area of memory in the
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
117 same structure by using the structure name as the opcode. Structures can
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
118 also contain fields that are themselves structures. See the example
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
119 below.</P
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
120 ><PRE
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
121 CLASS="PROGRAMLISTING"
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
122 >tstruct2 STRUCT
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
123 f1 rmb 1
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
124 f2 rmb 1
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
125 ENDSTRUCT
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
126
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
127 tstruct STRUCT
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
128 field1 rmb 2
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
129 field2 rmb 3
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
130 field3 tstruct2
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
131 ENDSTRUCT
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
132
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
133 ORG $2000
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
134 var1 tstruct
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
135 var2 tstruct2</PRE
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
136 ><P
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
137 >Fields are referenced using a dot (.) as a separator. To refer to the
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
138 generic offset within a structure, use the structure name to the left of the
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
139 dot. If referring to a field within an actual variable, use the variable's
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
140 symbol name to the left of the dot.</P
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
141 ><P
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
142 >You can also refer to the actual size of a structure (or a variable
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
143 declared as a structure) using the special symbol sizeof{structname} where
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
144 structname will be the name of the structure or the name of the
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
145 variable.</P
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
146 ><P
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
147 >Essentially, structures are a shortcut for defining a vast number of
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
148 symbols. When a structure is defined, the assembler creates symbols for the
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
149 various fields in the form structname.fieldname as well as the appropriate
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
150 sizeof{structname} symbol. When a variable is declared as a structure, the
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
151 assembler does the same thing using the name of the variable. You will see
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
152 these symbols in the symbol table when the assembler is instructed to
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
153 provide a listing. For instance, the above listing will create the
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
154 following symbols (symbol values in parentheses): tstruct2.f1 (0),
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
155 tstruct2.f2 (1), sizeof{tstruct2} (2), tstruct.field1 (0), tstruct.field2
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
156 (2), tstruct.field3 (5), tstruct.field3.f1 (5), tstruct.field3.f2 (6),
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
157 sizeof{tstruct.field3} (2), sizeof{tstruct} (7), var1 {$2000}, var1.field1
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
158 {$2000}, var1.field2 {$2002}, var1.field3 {$2005}, var1.field3.f1 {$2005},
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
159 var1.field3.f2 {$2006}, sizeof(var1.field3} (2), sizeof{var1} (7), var2
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
160 ($2007), var2.f1 ($2007), var2.f2 ($2008), sizeof{var2} (2). </P
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
161 ></DIV
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
162 ><DIV
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
163 CLASS="NAVFOOTER"
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
164 ><HR
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
165 ALIGN="LEFT"
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
166 WIDTH="100%"><TABLE
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
167 SUMMARY="Footer navigation table"
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
168 WIDTH="100%"
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
169 BORDER="0"
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
170 CELLPADDING="0"
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
171 CELLSPACING="0"
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
172 ><TR
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
173 ><TD
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
174 WIDTH="33%"
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
175 ALIGN="left"
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
176 VALIGN="top"
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
177 ><A
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
178 HREF="x456.html"
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
179 ACCESSKEY="P"
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
180 >Prev</A
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
181 ></TD
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
182 ><TD
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
183 WIDTH="34%"
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
184 ALIGN="center"
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
185 VALIGN="top"
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
186 ><A
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
187 HREF="index.html"
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
188 ACCESSKEY="H"
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
189 >Home</A
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
190 ></TD
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
191 ><TD
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
192 WIDTH="33%"
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
193 ALIGN="right"
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
194 VALIGN="top"
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
195 ><A
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
196 HREF="x498.html"
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
197 ACCESSKEY="N"
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
198 >Next</A
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
199 ></TD
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
200 ></TR
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
201 ><TR
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
202 ><TD
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
203 WIDTH="33%"
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
204 ALIGN="left"
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
205 VALIGN="top"
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
206 >Macros</TD
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
207 ><TD
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
208 WIDTH="34%"
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
209 ALIGN="center"
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
210 VALIGN="top"
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
211 ><A
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
212 HREF="c43.html"
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
213 ACCESSKEY="U"
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
214 >Up</A
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
215 ></TD
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
216 ><TD
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
217 WIDTH="33%"
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
218 ALIGN="right"
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
219 VALIGN="top"
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
220 >Object Files and Sections</TD
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
221 ></TR
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
222 ></TABLE
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
223 ></DIV
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
224 ></BODY
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
225 ></HTML
61d1db1dfe2a Build manual for release
lost
parents:
diff changeset
226 >