]> git.sur5r.net Git - cc65/blob - doc/ca65.sgml
Added the io module
[cc65] / doc / ca65.sgml
1 <!doctype linuxdoc system>
2
3 <article>
4 <title>ca65 Users Guide
5 <author>Ullrich von Bassewitz, <tt/uz@musoftware.de/
6 <date>19.07.2000
7 <abstract>ca65 is a macro assembler for the 6502, 65C02 and 65816 CPUs.
8 </abstract>
9
10 <!-- Table of contents -->
11 <toc>
12
13 <!-- Begin the document -->
14
15 <sect>Overview
16
17
18 <p>
19 ca65 is a replacement for the ra65 assembler that was part of the cc65 C
20 compiler developed by John R. Dunning. I had some problems with ra65 and
21 the copyright does not permit some things which I wanted to be possible,
22 so I decided to write a completely new assembler/linker/archiver suite for
23 the cc65 compiler. ca65 is part of this suite.
24
25 Some parts of the assembler (code generation and some routines for symbol
26 table handling) are taken from an older crossassembler named a816 written
27 by me a long time ago.
28
29 Here's a list of the design criteria, that were important for the
30 development:
31
32 <itemize>
33
34 <item>  The assembler must support macros. Macros are not essential, but they
35         make some things easier, especially when you use the assembler in the
36         backend of a compiler.
37 <item>  The assembler must support the newer 65C02 and 65816 CPUs. I have been
38         thinking about a 65816 backend for the C compiler, and even my old
39         a816 assembler had support for these CPUs, so this wasn't really a
40         problem.
41 <item>  The assembler must produce relocatable code. This necessary for the
42         compiler support, and it is more convenient.
43 <item>  Conditional assembly must be supported. This is a must for bigger
44         projects written in assembler (like Elite128).
45 <item>  The assembler must support segments, and it must support more than
46         three segments (this is the count, most other assemblers support).
47         Having more than one code segments helps developing code for systems
48         with a divided ROM area (like the C64).
49 <item>  The linker must be able to resolve arbitrary expressions. Years ago I
50         spent half a day to convince Borlands Turbo Assembler to let me use
51         the size of a structure I had created. So I decided that this is a
52         must. The linker should be able to get things like
53 <tscreen><verb>
54                 .import S1, S2
55                 .export Special
56                 Special         = 2*S1 + S2/7
57 </verb></tscreen>
58         right.
59 <item>  True lexical nesting for symbols. This is very convenient for larger
60         assembly projects.
61 <item>  "Cheap" local symbols without lexical nesting for those quick, late
62         night hacks.
63 <item>  I liked the idea of "options" as Anre Fachats .o65 format has it, so I
64         introduced the concept into the object file format use by the new cc65
65         binutils.
66 <item>  The assembler will be a one pass assembler. There was no real need for
67         this decision, but I've written several multipass assemblers, and it
68         started to get boring. A one pass assembler needs much more elaborated
69         data structures, and because of that it's much more fun:-)
70 <item>  Non-GPLed code that may be used in any project without restrictions or
71         fear of "GPL infecting" other code.
72 </itemize>
73
74
75 <sect>Usage
76
77 <p>
78 The assembler accepts the following options:
79
80 <tscreen><verb>
81 ---------------------------------------------------------------------------
82 Usage: ca65 [options] file
83 Short options:
84   -g                    Add debug info to object file
85   -h                    Help (this text)
86   -i                    Ignore case of symbols
87   -l                    Create a listing if assembly was ok
88   -o name               Name the output file
89   -s                    Enable smart mode
90   -v                    Increase verbosity
91   -D name[=value]       Define a symbol
92   -I dir                Set an include directory search path
93   -U                    Mark unresolved symbols as import
94   -V                    Print the assembler version
95   -W n                  Set warning level n
96
97 Long options:
98   --auto-import         Mark unresolved symbols as import
99   --cpu type            Set cpu type
100   --debug-info          Add debug info to object file
101   --help                Help (this text)
102   --ignore-case         Ignore case of symbols
103   --include-dir dir     Set an include directory search path
104   --listing             Create a listing if assembly was ok
105   --pagelength n        Set the page length for the listing
106   --smart               Enable smart mode
107   --verbose             Increase verbosity
108   --version             Print the assembler version
109 ---------------------------------------------------------------------------
110 </verb></tscreen>
111
112 Here is a description of all the command line options:
113
114 <descrip>
115
116   <tag><tt>--cpu type</tt></tag>
117
118   Set the default for the CPU type. The option takes a parameter, which
119   may be one of
120
121         6502, 65C02, 65816 and sunplus
122
123   (the latter is not available in the freeware version).
124
125
126   <tag><tt>-g, --debug-info</tt></tag>
127
128   When this option (or the equivalent control command <tt/.DEBUGINFO/) is
129   used, the assembler will add a section to the object file that contains
130   all symbols (including local ones) together with the symbol values and
131   source file positions. The linker will put these additional symbols into
132   the VICE label file, so even local symbols can be seen in the VICE
133   monitor.
134
135
136   <tag><tt>-h, --help</tt></tag>
137
138   Print the short option summary shown above.
139
140
141   <tag><tt>-i, --ignore-case</tt></tag>
142
143   This option makes the assembler case insensitive on identifiers and
144   labels. This option will override the default, but may itself be
145   overriden by the <tt/.CASE/ control command (see section 6).
146
147
148   <tag><tt>-l, --listing</tt></tag>
149
150   Generate an assembler listing. The listing file will always have the
151   name of the main input file with the extension replaced by ".lst". This
152   may change in future versions.
153
154
155   <tag><tt>-o name</tt></tag>
156
157   The default output name is the name of the input file with the extension
158   replaced by ".o". If you don't like that, you may give another name with
159   the -o option. The output file will be placed in the same directory as
160   the source file, or, if -o is given, the full path in this name is used.
161
162
163   <tag><tt>--pagelength n</tt></tag>
164
165   sets the length of a listing page in lines. See the <tt/.PAGELENGTH/
166   directive for more information.
167
168
169   <tag><tt>-s, --smart-mode</tt></tag>
170
171   In smart mode (enabled by -s or the <tt/.SMART/ pseudo instruction) the
172   assembler will track usage of the REP and SEP instructions in 65816 mode
173   and update the operand sizes accordingly. If the operand of such an
174   instruction cannot be evaluated by the assembler (for example, because
175   the operand is an imported symbol), a warning is issued.
176
177   Beware: Since the assembler cannot trace the execution flow this may
178   lead to false results in some cases. If in doubt, use the .ixx and .axx
179   instructions to tell the assembler about the current settings. Smart
180   mode is off by default.
181
182
183   <tag><tt>-v, --verbose</tt></tag>
184
185   Increase the assembler verbosity. Usually only needed for debugging
186   purposes. You may use this option more than one time for even more
187   verbose output.
188
189
190   <tag><tt>-D</tt></tag>
191
192   This option allows you to define symbols on the command line. Without a
193   value, the symbol is defined with the value zero. When giving a value,
194   you may use the '&dollar;' prefix for hexadecimal symbols. Please note
195   that for some operating systems, '&dollar;' has a special meaning, so
196   you may have to quote the expression.
197
198
199   <tag><tt>-I dir, --include-dir dir</tt></tag>
200
201   Name a directory which is searched for include files. The option may be
202   used more than once to specify more than one directory to search. The
203   current directory is always searched first before considering any
204   additional directores.
205
206
207   <tag><tt>-U, --auto-import</tt></tag>
208
209   Mark symbols that are not defined in the sources as imported symbols.
210   This should be used with care since it delays error messages about typos
211   and such until the linker is run. The compiler uses the equivalent of
212   this switch (<tt/.AUTOIMPORT/, see control command section below) to enable
213   auto imported symbols for the runtime library. However, the compiler is
214   supposed to generate code that runs through the assembler without
215   problems, something which is not always true for assembler programmers.
216
217
218   <tag><tt>-V, --version</tt></tag>
219
220   Print the version number of the assembler. If you send any suggestions
221   or bugfixes, please include the version number.
222
223
224   <tag><tt>-Wn</tt></tag>
225
226   Set the warning level for the assembler. Using -W2 the assembler will
227   even warn about such things like unused imported symbols. The default
228   warning level is 1, and it would probably be silly to set it to
229   something lower.
230
231 </descrip>
232
233
234
235 <sect>Input format
236
237 <p>
238 The assembler accepts the standard 6502/65816 assembler syntax. One line
239 may contain a label (which is identified by a colon), and, in addition to
240 the label, an assembler mnemonic, a macro, or a control command (see
241 section 6 for supported control commands). Alternatively, the line may
242 contain a symbol definition using the '=' token. Everything after a
243 semicolon is handled as a comment (that is, it is ignored).
244
245 Here are some examples for valid input lines:
246
247 <tscreen><verb>
248         Label:                          ; A label and a comment
249                 lda     #$20            ; A 6502 instruction plus comment
250         L1:     ldx     #$20            ; Same with label
251         L2:     .byte   "Hello world"   ; Label plus control command
252                 mymac   $20             ; Macro expansion
253                 MySym = 3*L1            ; Symbol definition
254         MaSym   = Label                 ; Another symbol
255 </verb></tscreen>
256
257 The assembler accepts all valid 6502 mnemonics when in 6502 mode (the
258 default). The assembler accepts all valid 65SC02 mnemonics when in 65SC02
259 mode (after a <tt/.PC02/ command is found). The assembler accepts all valid
260 65816 mnemonics with a few exceptions after a .P816 command is found.
261 These exceptions are listed below.
262
263 In 65816 mode several aliases are accepted in addition to the official
264 mnemonics:
265
266 <tscreen><verb>
267         BGE is an alias for BCS
268         BLT is an alias for BCC
269         CPA is an alias for CMP
270         DEA is an alias for DEC A
271         INA is an alias for INC A
272         SWA is an alias for XBA
273         TAD is an alias for TCD
274         TAS is an alias for TCS
275         TDA is an alias for TDC
276         TSA is an alias for TSC
277 </verb></tscreen>
278
279 Evaluation of banked expressions in 65816 mode differs slightly from the
280 official syntax:
281
282 Instead of accepting a 24 bit address (something that is difficult for
283 the assembler to determine and would have required one more special
284 .import command), the bank and the absolute address in that bank are
285 separated by a dot:
286
287 <tscreen><verb>
288         jsl     3.$1234         ; Call subroutine at $1234 in bank 3
289 </verb></tscreen>
290
291 For literal values, the assembler accepts the widely used number formats:
292 A preceeding '&dollar;' denotes a hex value, a preceeding '%' denotes a
293 binary value, and a bare number is interpeted as a decimal. There are
294 currently no octal values and no floats.
295
296
297
298 <sect>Expressions
299
300 <p>
301 All expressions are evaluated with (at least) 32 bit precision. An
302 expression may contain constant values and any combination of internal and
303 external symbols. Expressions that cannot be evaluated at assembly time
304 are stored inside the object file for evaluation by the linker.
305 Expressions referencing imported symbols must always be evaluated by the
306 linker.
307
308 Sometimes, the assembler must know about the size of the value that is the
309 result of an expression. This is usually the case, if a decision has to be
310 made, to generate a zero page or an absolute memory references. In this
311 case, the assembler has to make some assumptions about the result of an
312 expression:
313
314 <itemize>
315 <item>  If the result of an expression is constant, the actual value is
316         checked to see if it's a byte sized expression or not.
317 <item>  If the expression is explicitly casted to a byte sized expression by
318         one of the '&gt;'/'&lt;' operators, it is a byte expression.
319 <item>  If this is not the case, and the expression contains a symbol,
320         explicitly declared as zero page symbol (by one of the .importzp or
321         .exportzp instructions), then the whole expression is assumed to be
322         byte sized.
323 <item>  If the expression contains symbols that are not defined, and these
324         symbols are local symbols, the enclosing scopes are searched for a
325         symbol with the same name. If one exists and this symbol is defined,
326         it's attributes are used to determine the result size.
327 <item>  In all other cases the expression is assumed to be word sized.
328 </itemize>
329
330 Note: If the assembler is not able to evaluate the expression at assembly
331 time, the linker will evaluate it and check for range errors as soon as
332 the result is known.
333
334
335 <bf>Boolean expressions:</bf>
336
337 In the context of a boolean expression, any non zero value is evaluated as
338 true, any other value to false. The result of a boolean expression is 1 if
339 it's true, and zero if it's false. There are boolean operators with extrem
340 low precedence with version 2.x (where x &gt; 0). The <tt/.AND/ and <tt/.OR/
341 operators are shortcut operators. That is, if the result of the expression is
342 already known, after evaluating the left hand side, the right hand side is
343 not evaluated.
344
345
346 Available operators sorted by precedence:
347
348 <tscreen><verb>
349     Op          Description                             Precedence
350   -------------------------------------------------------------------
351     .CONCAT     Builtin function                        0
352     .LEFT       Builtin function                        0
353     .MID        Builtin function                        0
354     .RIGHT      Builtin function                        0
355     .STRING     Builtin function                        0
356
357     *           Builtin pseudo variable (r/o)           1
358     .BLANK      Builtin function                        1
359     .CONST      Builtin function                        1
360     .CPU        Builtin pseudo variable (r/o)           1
361     .DEFINED    Builtin function                        1
362     .MATCH      Builtin function                        1
363     .TCOUNT     Builtin function                        1
364     .XMATCH     Builtin function                        1
365     .PARAMCOUNT Builtin pseudo variable (r/o)           1
366     .REFERENCED Builtin function                        1
367     ::          Global namespace override               1
368     +           Unary plus                              1
369     -           Unary minus                             1
370     ~           Unary bitwise not                       1
371     .BITNOT     Unary bitwise not                       1
372     &lt;        Low byte operator                       1
373     &gt;        High byte operator                      1
374
375     *           Multiplication                          2
376     /           Division                                2
377     .MOD        Modulo operation                        2
378     &amp;       Bitwise and                             2
379     .BITAND     Bitwise and                             2
380     ^           Bitwise xor                             2
381     .BITXOR     Bitwise xor                             2
382     &lt;&lt;    Shift left operator                     2
383     .SHL        Shift left operator                     2
384     &gt;&gt;    Shift right operator                    2
385     .SHR        Shift right operator                    2
386
387     +           Binary plus                             3
388     -           Binary minus                            3
389     |           Binary or                               3
390     .BITOR      Binary or                               3
391
392     =           Compare operation (equal)               4
393     &lt;&gt;    Compare operation (not equal)           4
394     &lt;        Compare operation (less)                4
395     &gt;        Compare operation (greater)             4
396     &lt;=       Compare operation (less or equal)       4
397     &gt;=       Compare operation (greater or equal)    4
398
399     &amp;&amp;          Boolean and                             5
400     .AND        Boolean and                             5
401     .XOR        Boolean xor                             5
402
403     ||          Boolean or                              6
404     .OR         Boolean or                              6
405
406     !           Boolean not                             7
407     .NOT        Boolean not                             7
408 </verb></tscreen>
409
410
411 To force a specific order of evaluation, braces may be used as usual.
412
413 Some of the pseudo variables mentioned above need some more explanation:
414
415   *             This symbol is replaced by the value of the program
416                 counter at start of the current instruction. Note, that
417                 '*' yields a rvalue, that means, you cannot assign to it.
418                 Use <tt/.ORG/ to set the program counter in sections with
419                 absolute code.
420
421
422
423 <sect>Symbols and labels
424
425 <p>
426 The assembler allows you to use symbols instead of naked values to make
427 the source more readable. There are a lot of different ways to define and
428 use symbols and labels, giving a lot of flexibility.
429
430 <descrip>
431
432
433 <tag/Numeric constants/
434
435     Numeric constants are defined using the equal sign. After doing
436
437     <tscreen><verb>
438           two = 2
439     </verb></tscreen>
440
441     may use the symbol "two" in every place where a number is expected,
442     and it is evaluated to the value 2 in this context. An example would be
443
444     <tscreen><verb>
445           four = two * two
446     </verb></tscreen>
447
448
449 <tag/Standard labels/
450
451     A label is defined by writing the name of the label at the start of
452     the line (before any instruction mnemonic, macro or pseudo
453     directive), followed by a colon. This will declare a symbol with the
454     given name and the value of the current program counter.
455
456
457 <tag/Local labels and symbols/
458
459     Using the <tt/.PROC/ directive, it is possible to create regions of code
460     where the names of labels and symbols are local to this region. They
461     are not know outside and cannot be accessed from there. Such regions
462     may be nested like PROCEDUREs in Pascal.
463
464     See the description of the <tt/.PROC/ directive for more information.
465
466 <tag/Cheap local labels/
467
468     Cheap local labels are defined like standard labels, but the name of
469     the label must begin with a special symbol (usually '@', but this can
470     be changed by the <tt/.LOCALCHAR/ directive).
471
472     Cheap local labels are visible only between two no cheap labels. As
473     soon as a standard symbol is encountered (this may also be a local
474     symbol if inside a region defined with the .PROC directive), the
475     cheap local symbol goes out of scope.
476
477     You may use cheap local labels as an easy way to reuse common label
478     names like "Loop". Here is an example:
479
480     <tscreen><verb>
481         Clear:  lda     #$00            ; Global label
482                 ldy     #$20
483         @Loop:  sta     Mem,y           ; Local label
484                 dey
485                 bne     @Loop           ; Ok
486                 rts
487         Sub:    ...                     ; New global label
488                 bne     @Loop           ; ERROR: Unknown identifier!
489     </verb></tscreen>
490
491 <tag/Unnamed labels/
492
493     If you really want to write messy code, there are also unnamed
494     labels. These labels do not have a name (you guessed that already,
495     didn't you?). A colon is used to mark the absence of the name.
496
497     Unnamed labels may be accessed by using the colon plus several minus
498     or plus characters as a label designator. Using the '-' characters
499     will create a back reference (use the n'th label backwards), using
500     '+' will create a forward reference (use the n'th label in forward
501     direction). An example will help to understand this:
502
503     <tscreen><verb>
504         :       lda     (ptr1),y        ; #1
505                 cmp     (ptr2),y
506                 bne     :+              ; -> #2
507                 tax
508                 beq     :+++            ; -> #4
509                 iny
510                 bne     :-              ; -> #1
511                 inc     ptr1+1
512                 inc     ptr2+1
513                 bne     :-              ; -> #1
514
515         :       bcs     :+              ; #2 -> #3
516                 ldx     #$FF
517                 rts
518
519         :       ldx     #$01            ; #3
520         :       rts                     ; #4
521     </verb></tscreen>
522
523     As you can see from the example, unnamed labels will make even short
524     sections of code hard to understand, because you have to count labels
525     to find branch targets (this is the reason why I for my part do
526     prefer the "cheap" local labels). Nevertheless, unnamed labels are
527     convenient in some situations, so it's your decision.
528
529   - Using macros to define labels and constants
530
531     While there are drawbacks with this approach, it may be handy in some
532     situations. Using <tt/.DEFINE/, it is possible to define symbols or
533     constants that may be used elsewhere. Since the macro facility works
534     on a very low level, there is no scoping. On the other side, you may
535     also define string constants this way (this is not possible with the
536     other symbol types).
537
538     Example:
539
540     <tscreen><verb>
541         .DEFINE two     2
542         .DEFINE version "SOS V2.3"
543
544         four = two * two        ; Ok
545         .byte   version         ; Ok
546
547         .PROC                   ; Start local scope
548         two = 3                 ; Will give "2 = 3" - invalid!
549         .ENDPROC
550     </verb></tscreen>
551
552 </descrip>
553
554
555 If <tt/.DEBUGINFO/ is enabled (or -g is given on the command line), global,
556 local and cheap local labels are written to the object file and will be
557 available in the symbol file via the linker. Unnamed labels are not
558 written to the object file, because they don't have a name which would
559 allow to access them.
560
561
562
563 <sect>Control commands
564
565 <p>
566 Here's a list of all control commands and a description, what they do:
567
568 <descrip>
569
570 <tag><tt>.A16</tt></tag>
571
572   Valid only in 65816 mode. Switch the accumulator to 16 bit.
573
574   Note: This command will not emit any code, it will tell the assembler to
575   create 16 bit operands for immediate accumulator adressing mode.
576
577   See also: <tt/.SMART/
578
579
580 <tag><tt>.A8</tt></tag>
581
582   Valid only in 65816 mode. Switch the accumulator to 8 bit.
583
584   Note: This command will not emit any code, it will tell the assembler to
585   create 8 bit operands for immediate accu adressing mode.
586
587   See also: <tt/.SMART/
588
589
590 <tag><tt>.ADDR</tt></tag>
591
592   Define word sized data. In 6502 mode, this is an alias for <tt/.WORD/ and
593   may be used for better readability if the data words are address values.
594   In 65816 mode, the address is forced to be 16 bit wide to fit into the
595   current segment. See also <tt/.FARADDR/. The command must be followed by a
596   sequence of (not necessarily constant) expressions.
597
598   Example:
599
600   <tscreen><verb>
601         .addr   $0D00, $AF13, _Clear
602   </verb></tscreen>
603
604
605 <tag><tt>.ALIGN</tt></tag>
606
607   Align data to a given boundary. The command expects a constant integer
608   argument that must be a power of two, plus an optional second argument
609   in byte range. If there is a second argument, it is used as fill value,
610   otherwise the value defined in the linker configuration file is used
611   (the default for this value is zero).
612
613   Since alignment depends on the base address of the module, you must
614   give the same (or a greater) alignment for the segment when linking.
615   The linker will give you a warning, if you don't do that.
616
617   Example:
618
619   <tscreen><verb>
620         .align  256
621   </verb></tscreen>
622
623
624 <tag><tt>.ASCIIZ</tt></tag>
625
626   Define a string with a trailing zero.
627
628   Example:
629
630   <tscreen><verb>
631         Msg:    .asciiz "Hello world"
632   </verb></tscreen>
633
634   This will put the string "Hello world" followed by a binary zero into
635   the current segment. There may be more strings separated by commas, but
636   the binary zero is only appended once (after the last one).
637
638
639 <tag><tt>.AUTOIMPORT</tt></tag>
640
641   Is followd by a plus or a minus character. When switched on (using a
642   +), undefined symbols are automatically marked as import instead of
643   giving errors. When switched off (which is the default so this does not
644   make much sense), this does not happen and an error message is
645   displayed. The state of the autoimport flag is evaluated when the
646   complete source was translated, before outputing actual code, so it is
647   <em/not/ possible to switch this feature on or off for separate sections
648   of code. The last setting is used for all symbols.
649
650   You should probably not use this switch because it delays error
651   messages about undefined symbols until the link stage. The cc65
652   compiler (which is supposed to produce correct assembler code in all
653   circumstances, something which is not true for most assembler
654   programmers) will insert this command to avoid importing each and every
655   routine from the runtime library.
656
657   Example:
658
659   <tscreen><verb>
660         .autoimport     +       ; Switch on auto import
661   </verb></tscreen>
662
663
664 <tag><tt>.BLANK</tt></tag>
665
666   Builtin function. The function evaluates its argument in braces and
667   yields "false" if the argument is non blank (there is an argument), and
668   "true" if there is no argument. As an example, the <tt/.IFBLANK/ statement
669   may be replaced by
670
671   <tscreen><verb>
672         .if     .blank(arg)
673   </verb></tscreen>
674
675
676 <tag><tt>.BSS</tt></tag>
677
678   Switch to the BSS segment. The name of the BSS segment is always "BSS",
679   so this is a shortcut for
680
681   <tscreen><verb>
682         .segment  "BSS"
683   </verb></tscreen>
684
685   See also the <tt/.SEGMENT/ command.
686
687
688 <tag><tt>.BYTE</tt></tag>
689
690   Define byte sized data. Must be followed by a sequence of (byte ranged)
691   expressions or strings.
692
693   Example:
694
695   <tscreen><verb>
696         .byte   "Hello world", $0D, $00
697   </verb></tscreen>
698
699
700 <tag><tt>.CASE</tt></tag>
701
702   Switch on or off case sensitivity on identifiers. The default is off
703   (that is, identifiers are case sensitive), but may be changed by the
704   -i switch on the command line.
705   The command must be followed by a '+' or '-' character to switch the
706   option on or off respectively.
707
708   Example:
709
710   <tscreen><verb>
711         .case   -               ; Identifiers are not case sensitive
712   </verb></tscreen>
713
714
715 <tag><tt>.CODE</tt></tag>
716
717   Switch to the CODE segment. The name of the CODE segment is always
718   "CODE", so this is a shortcut for
719
720   <tscreen><verb>
721         .segment  "CODE"
722   </verb></tscreen>
723
724   See also the <tt/.SEGMENT/ command.
725
726
727 <tag><tt>.CONCAT</tt></tag>
728
729   Builtin function. The function allows to concatenate a list of string
730   constants separated by commas. The result is a string constant that
731   is the concatentation of all arguments. This function is most useful
732   in macros and when used together with the <tt/.STRING/ builtin function.
733   The function may be used in any case where a string constant is
734   expected.
735
736   Example:
737
738   <tscreen><verb>
739         .include        .concat ("myheader", ".", "inc)
740   </verb></tscreen>
741
742   This is the same as the command
743
744   <tscreen><verb>
745         .include        "myheader.inc"
746   </verb></tscreen>
747
748
749 <tag><tt>.CONST</tt></tag>
750
751   Builtin function. The function evaluates its argument in braces and
752   yields "true" if the argument is a constant expression (that is, an
753   expression that yields a constant value at assembly time) and "false"
754   otherwise. As an example, the .IFCONST statement may be replaced by
755
756   <tscreen><verb>
757         .if     .const(a + 3)
758   </verb></tscreen>
759
760
761 <tag><tt>.CPU</tt></tag>
762
763   Reading this pseudo variable will give a constant integer value that
764   tells which instruction set is currently enabled. Possible values are:
765
766   <tscreen><verb>
767         0 -->   6502
768         1 -->   65SC02
769         2 -->   65SC816
770         3 -->   SunPlus SPC
771   </verb></tscreen>
772
773   It may be used to replace the .IFPxx pseudo instructions or to construct
774   even more complex expressions.
775
776   Example:
777
778   <tscreen><verb>
779         .if     (.cpu = 0) .or (.cpu = 1)
780                 txa
781                 pha
782                 tya
783                 pha
784         .else
785                 phx
786                 phy
787         .endif
788   </verb></tscreen>
789
790
791 <tag><tt>.DATA</tt></tag>
792
793   Switch to the DATA segment. The name of the DATA segment is always
794   "DATA", so this is a shortcut for
795
796   <tscreen><verb>
797         .segment  "DATA"
798   </verb></tscreen>
799
800   See also the <tt/.SEGMENT/ command.
801
802
803 <tag><tt>.DBYT</tt></tag>
804
805   Define word sized data with the hi and lo bytes swapped (use <tt/.WORD/ to
806   create word sized data in native 65XX format). Must be followed by a
807   sequence of (word ranged) expressions.
808
809   Example:
810
811   <tscreen><verb>
812         .dbyt   $1234, $4512
813   </verb></tscreen>
814
815   This will emit the bytes
816
817   <tscreen><verb>
818         $12 $34 $45 $12
819   </verb></tscreen>
820
821   into the current segment in that order.
822
823
824 <tag><tt>.DEBUGINFO</tt></tag>
825
826   Switch on or off debug info generation. The default is off (that is,
827   the object file will not contain debug infos), but may be changed by the
828   -g switch on the command line.
829   The command must be followed by a '+' or '-' character to switch the
830   option on or off respectively.
831
832   Example:
833
834   <tscreen><verb>
835         .debuginfo      +       ; Generate debug info
836   </verb></tscreen>
837
838
839 <tag><tt>.DEFINE</tt></tag>
840
841   Start a define style macro definition. The command is followed by an
842   identifier (the macro name) and optionally by a list of formal arguments
843   in braces.
844   See separate section about macros.
845
846
847 <tag><tt>.DEF, .DEFINED</tt></tag>
848
849   Builtin function. The function expects an identifier as argument in
850   braces. The argument is evaluated, and the function yields "true" if the
851   identifier is a symbol that is already defined somewhere in the source
852   file up to the current position. Otherwise the function yields false. As
853   an example, the <tt/.IFDEF/ statement may be replaced by
854
855   <tscreen><verb>
856         .if     .defined(a)
857   </verb></tscreen>
858
859
860 <tag><tt>.DWORD</tt></tag>
861
862   Define dword sized data (4 bytes) Must be followed by a sequence of
863   expressions.
864
865   Example:
866
867   <tscreen><verb>
868         .dword  $12344512, $12FA489
869   </verb></tscreen>
870
871
872 <tag><tt>.ELSE</tt></tag>
873
874   Conditional assembly: Reverse the current condition.
875
876
877 <tag><tt>.ELSEIF</tt></tag>
878
879   Conditional assembly: Reverse current condition and test a new one.
880
881
882 <tag><tt>.END</tt></tag>
883
884   Forced end of assembly. Assembly stops at this point, even if the command
885   is read from an include file.
886
887
888 <tag><tt>.ENDIF</tt></tag>
889
890   Conditional assembly: Close a <tt/.IF.../ or <tt/.ELSE/ branch.
891
892
893 <tag><tt>.ENDMAC, .ENDMACRO</tt></tag>
894
895   End of macro definition (see separate section).
896
897
898 <tag><tt>.ENDPROC</tt></tag>
899
900   End of local lexical level (see <tt/.PROC/).
901
902
903 <tag><tt>.ERROR</tt></tag>
904
905   Force an assembly error. The assembler will output an error message
906   preceeded by "User error" and will <em/not/ produce an object file.
907
908   This command may be used to check for initial conditions that must be
909   set before assembling a source file.
910
911   Example:
912
913   <tscreen><verb>
914         .if     foo = 1
915         ...
916         .elseif bar = 1
917         ...
918         .else
919         .error  "Must define foo or bar!"
920         .endif
921   </verb></tscreen>
922
923   See also the <tt/.WARNING/ and <tt/.OUT/ directives.
924
925
926 <tag><tt>.EXITMAC, .EXITMACRO</tt></tag>
927
928   Abort a macro expansion immidiately. This command is often useful in
929   recursive macros. See separate chapter about macros.
930
931
932 <tag><tt>.EXPORT</tt></tag>
933
934   Make symbols accessible from other modules. Must be followed by a comma
935   separated list of symbols to export.
936
937   Example:
938
939   <tscreen><verb>
940         .export foo, bar
941   </verb></tscreen>
942
943
944 <tag><tt>.EXPORTZP</tt></tag>
945
946   Make symbols accessible from other modules. Must be followed by a comma
947   separated list of symbols to export. The exported symbols are explicitly
948   marked as zero page symols.
949
950   Example:
951
952   <tscreen><verb>
953         .exportzp  foo, bar
954   </verb></tscreen>
955
956
957 <tag><tt>.FARADDR</tt></tag>
958
959   Define far (24 bit) address data. The command must be followed by a
960   sequence of (not necessarily constant) expressions.
961
962   Example:
963
964   <tscreen><verb>
965         .faraddr        DrawCircle, DrawRectangle, DrawHexagon
966   </verb></tscreen>
967
968
969 <tag><tt>.FEATURE</tt></tag>
970
971   This directive may be used to enable one or more compatibility features
972   of the assembler. While the use of <tt/.FEATURE/ should be avoided when
973   possible, it may be useful when porting sources written for other
974   assemblers. There is no way to switch a feature off, once you have
975   enabled it, so using
976
977   <tscreen><verb>
978         .FEATURE        xxx
979   </verb></tscreen>
980
981   will enable the feature until end of assembly is reached.
982
983   The following features are available:
984
985   <descrip>
986
987   <tag><tt>dollar_is_pc</tt></tag>
988
989     The dollar sign may be used as an alias for the star (`*'), which
990     gives the value of the current PC in expressions.
991     Note: Assignment to the pseudo variable is not allowed.
992
993   <tag><tt>labels_without_colons</tt></tag>
994
995     Allow labels without a trailing colon. These labels are only accepted,
996     if they start at the beginning of a line (no leading white space).
997
998   <tag><tt>loose_string_term</tt></tag>
999
1000     Accept single quotes as well as double quotes as terminators for string
1001     constants.
1002
1003   <tag><tt>at_in_identifiers</tt></tag>
1004
1005     Accept the at character (`@') as a valid character in identifiers. The
1006     at character is not allowed to start an identifier, even with this
1007     feature enabled.
1008
1009   <tag><tt>dollar_in_identifiers</tt></tag>
1010
1011     Accept the dollar sign (`&dollar;') as a valid character in identifiers. The
1012     at character is not allowed to start an identifier, even with this
1013     feature enabled.
1014
1015   </descrip>
1016
1017
1018 <tag><tt>.FILEOPT, .FOPT</tt></tag>
1019
1020   Insert an option string into the object file. There are two forms of
1021   this command, one specifies the option by a keyword, the second
1022   specifies it as a number. Since usage of the second one needs knowledge
1023   of the internal encoding, its use is not recommended and I will only
1024   describe the first form here.
1025
1026   The command is followed by one of the keywords
1027
1028   <tscreen><verb>
1029         author
1030         comment
1031         compiler
1032   </verb></tscreen>
1033
1034   a comma and a string. The option is written into the object file
1035   together with the string value. This is currently unidirectional and
1036   there is no way to actually use these options once they are in the
1037   object file.
1038
1039   Examples:
1040
1041   <tscreen><verb>
1042         .fileopt        comment, "Code stolen from my brother"
1043         .fileopt        compiler, "BASIC 2.0"
1044         .fopt           author, "J. R. User"
1045   </verb></tscreen>
1046
1047
1048 <tag><tt>.GLOBAL</tt></tag>
1049
1050   Declare symbols as global. Must be followed by a comma separated list
1051   of symbols to declare. Symbols from the list, that are defined somewhere
1052   in the source, are exported, all others are imported. An additional
1053   explicit <tt/.IMPORT/ or <tt/.EXPORT/ command for the same symbol is
1054   allowed.
1055
1056   Example:
1057
1058   <tscreen><verb>
1059         .global foo, bar
1060   </verb></tscreen>
1061
1062
1063 <tag><tt>.GLOBALZP</tt></tag>
1064
1065   Declare symbols as global. Must be followed by a comma separated list
1066   of symbols to declare. Symbols from the list, that are defined
1067   somewhere in the source, are exported, all others are imported. An
1068   additional explicit <tt/.IMPORT/ or <tt/.EXPORT/ command for the same
1069   symbol is explicitly allowed. The symbols in the list are explicitly
1070   marked as zero page symols.
1071
1072   Example:
1073
1074   <tscreen><verb>
1075         .globalzp foo, bar
1076   </verb></tscreen>
1077
1078
1079 <tag><tt>.I16</tt></tag>
1080
1081   Valid only in 65816 mode. Switch the index registers to 16 bit.
1082
1083   Note: This command will not emit any code, it will tell the assembler to
1084   create 16 bit operands for immediate operands.
1085
1086   See also the <tt/.SMART/ command.
1087
1088
1089 <tag><tt>.I8</tt></tag>
1090
1091   Valid only in 65816 mode. Switch the index registers to 8 bit.
1092
1093   Note: This command will not emit any code, it will tell the assembler to
1094   create 8 bit operands for immediate operands.
1095
1096   See also the <tt/.SMART/ command.
1097
1098
1099 <tag><tt>.IF</tt></tag>
1100
1101   Conditional assembly: Evalute an expression and switch assembler output
1102   on or off depending on the expression. The expression must be a constant
1103   expression, that is, all operands must be defined.
1104
1105   A expression value of zero evaluates to FALSE, any other value evaluates
1106   to TRUE.
1107
1108
1109 <tag><tt>.IFBLANK</tt></tag>
1110
1111   Conditional assembly: Check if there are any remaining tokens in this
1112   line, and evaluate to FALSE if this is the case, and to TRUE otherwise.
1113   If the condition is not true, further lines are not assembled until
1114   an <tt/.ELSE/, <tt/.ELSEIF/ or <tt/.ENDIF/ directive.
1115
1116   This command is often used to check if a macro parameter was given.
1117   Since an empty macro parameter will evaluate to nothing, the condition
1118   will evaluate to FALSE if an empty parameter was given.
1119
1120   Example:
1121
1122   <tscreen><verb>
1123         .macro     arg1, arg2
1124         .ifblank   arg2
1125                    lda     #arg1
1126         .else
1127                    lda     #arg2
1128         .endif
1129         .endmacro
1130   </verb></tscreen>
1131
1132   See also: <tt/.BLANK/
1133
1134
1135 <tag><tt>.IFCONST</tt></tag>
1136
1137   Conditional assembly: Evaluate an expression and switch assembler output
1138   on or off depending on the constness of the expression.
1139
1140   A const expression evaluates to to TRUE, a non const expression (one
1141   containing an imported or currently undefined symbol) evaluates to
1142   FALSE.
1143
1144   See also: <tt/.CONST/
1145
1146
1147 <tag><tt>.IFDEF</tt></tag>
1148
1149   Conditional assembly: Check if a symbol is defined. Must be followed by
1150   a symbol name. The condition is true if the the given symbol is already
1151   defined, and false otherwise.
1152
1153   See also: <tt/.DEFINED/
1154
1155
1156 <tag><tt>.IFNBLANK</tt></tag>
1157
1158   Conditional assembly: Check if there are any remaining tokens in this
1159   line, and evaluate to TRUE if this is the case, and to FALSE otherwise.
1160   If the condition is not true, further lines are not assembled until
1161   an <tt/.ELSE/, <tt/.ELSEIF/ or <tt/.ENDIF/ directive.
1162
1163   This command is often used to check if a macro parameter was given.
1164   Since an empty macro parameter will evaluate to nothing, the condition
1165   will evaluate to FALSE if an empty parameter was given.
1166
1167   Example:
1168
1169   <tscreen><verb>
1170         .macro     arg1, arg2
1171                    lda     #arg1
1172         .ifnblank  arg2
1173                    lda     #arg2
1174         .endif
1175         .endmacro
1176   </verb></tscreen>
1177
1178   See also: <tt/.BLANK/
1179
1180
1181 <tag><tt>.IFNDEF</tt></tag>
1182
1183   Conditional assembly: Check if a symbol is defined. Must be followed by
1184   a symbol name. The condition is true if the the given symbol is not
1185   defined, and false otherwise.
1186
1187   See also: <tt/.DEFINED/
1188
1189
1190 <tag><tt>.IFNREF</tt></tag>
1191
1192   Conditional assembly: Check if a symbol is referenced. Must be followed
1193   by a symbol name. The condition is true if if the the given symbol was
1194   not referenced before, and false otherwise.
1195
1196   See also: <tt/.REFERENCED/
1197
1198
1199 <tag><tt>.IFP02</tt></tag>
1200
1201   Conditional assembly: Check if the assembler is currently in 6502 mode
1202   (see <tt/.P02/ command).
1203
1204
1205 <tag><tt>.IFP816</tt></tag>
1206
1207   Conditional assembly: Check if the assembler is currently in 65816 mode
1208   (see <tt/.P816/ command).
1209
1210
1211 <tag><tt>.IFPC02</tt></tag>
1212
1213   Conditional assembly: Check if the assembler is currently in 65C02 mode
1214   (see <tt/.PC02/ command).
1215
1216
1217 <tag><tt>.IFREF</tt></tag>
1218
1219   Conditional assembly: Check if a symbol is referenced. Must be followed
1220   by a symbol name. The condition is true if if the the given symbol was
1221   referenced before, and false otherwise.
1222
1223   This command may be used to build subroutine libraries in include files
1224   (you may use separate object modules for this purpose too).
1225
1226   Example:
1227
1228   <tscreen><verb>
1229         .ifref  ToHex                   ; If someone used this subroutine
1230         ToHex:  tay                     ; Define subroutine
1231                 lda     HexTab,y
1232                 rts
1233         .endif
1234   </verb></tscreen>
1235
1236   See also: <tt/.REFERENCED/
1237
1238
1239 <tag><tt>.IMPORT</tt></tag>
1240
1241   Import a symbol from another module. The command is followed by a comma
1242   separated list of symbols to import.
1243
1244   Example:
1245
1246   <tscreen><verb>
1247         .import foo, bar
1248   </verb></tscreen>
1249
1250
1251 <tag><tt>.IMPORTZP</tt></tag>
1252
1253   Import a symbol from another module. The command is followed by a comma
1254   separated list of symbols to import. The symbols are explicitly imported
1255   as zero page symbols (that is, symbols with values in byte range).
1256
1257   Example:
1258
1259   <tscreen><verb>
1260         .includezp  foo, bar
1261   </verb></tscreen>
1262
1263
1264 <tag><tt>.INCBIN</tt></tag>
1265
1266   Include a file as binary data. The command expects a string argument
1267   that is the name of a file to include literally in the current segment.
1268
1269   Example:
1270
1271   <tscreen><verb>
1272         .incbin         "sprites.dat"
1273   </verb></tscreen>
1274
1275
1276 <tag><tt>.INCLUDE</tt></tag>
1277
1278   Include another file. Include files may be nested up to a depth of 16.
1279
1280   Example:
1281
1282   <tscreen><verb>
1283         .include        "subs.inc"
1284   </verb></tscreen>
1285
1286
1287 <tag><tt>.LEFT</tt></tag>
1288
1289   Builtin function. Extracts the left part of a given token list.
1290
1291   Syntax:
1292
1293   <tscreen><verb>
1294         .LEFT (&lt;int expr&gt;, &lt;token list&gt;)
1295   </verb></tscreen>
1296
1297   The first integer expression gives the number of tokens to extract from
1298   the token list. The second argument is the token list itself.
1299
1300   Example:
1301
1302   To check in a macro if the given argument has a '#' as first token
1303   (immidiate addressing mode), use something like this:
1304
1305   <tscreen><verb>
1306         .macro  ldax    arg
1307                 ...
1308                 .if (.match (.left (1, arg), #))
1309
1310                 ; ldax called with immidiate operand
1311                 ...
1312
1313                 .endif
1314                 ...
1315         .endmacro
1316   </verb></tscreen>
1317
1318   See also the <tt/.MID/ and <tt/.RIGHT/ builtin functions.
1319
1320
1321 <tag><tt>.LINECONT</tt></tag>
1322
1323   Switch on or off line continuations using the backslash character
1324   before a newline. The option is off by default.
1325   Note: Line continuations do not work in a comment. A backslash at the
1326   end of a comment is treated as part of the comment and does not trigger
1327   line continuation.
1328   The command must be followed by a '+' or '-' character to switch the
1329   option on or off respectively.
1330
1331   Example:
1332
1333   <tscreen><verb>
1334         .linecont       +               ; Allow line continuations
1335
1336         lda     \
1337                 #$20                    ; This is legal now
1338   </verb></tscreen>
1339
1340
1341 <tag><tt>.LIST</tt></tag>
1342
1343   Enable output to the listing. The command must be followed by a boolean
1344   switch ("on", "off", "+" or "-") and will enable or disable listing
1345   output.
1346   The option has no effect if the listing is not enabled by the command line
1347   switch -l. If -l is used, an internal counter is set to 1. Lines are output
1348   to the listing file, if the counter is greater than zero, and suppressed if
1349   the counter is zero. Each use of <tt/.LIST/ will increment or decrement the
1350   counter.
1351
1352   Example:
1353
1354   <tscreen><verb>
1355         .list   on              ; Enable listing output
1356   </verb></tscreen>
1357
1358
1359 <tag><tt>.LISTBYTES</tt></tag>
1360
1361   Set, how many bytes are shown in the listing for one source line. The
1362   default is 12, so the listing will show only the first 12 bytes for any
1363   source line that generates more than 12 bytes of code or data.
1364   The directive needs an argument, which is either "unlimited", or an
1365   integer constant in the range 4..255.
1366
1367   Examples:
1368
1369   <tscreen><verb>
1370         .listbytes      unlimited       ; List all bytes
1371         .listbytes      12              ; List the first 12 bytes
1372         .incbin         "data.bin"      ; Include large binary file
1373   </verb></tscreen>
1374
1375
1376 <tag><tt>.LOCAL</tt></tag>
1377
1378   This command may only be used inside a macro definition. It declares a
1379   list of identifiers as local to the macro expansion.
1380
1381   A problem when using macros are labels: Since they don't change their
1382   name, you get a "duplicate symbol" error if the macro is expanded the
1383   second time. Labels declared with <tt/.LOCAL/ have their name mapped to
1384   an internal unique name (<tt/___ABCD__/) with each macro invocation.
1385
1386   Some other assemblers start a new lexical block inside a macro
1387   expansion. This has some drawbacks however, since that will not allow
1388   <em/any/ symbol to be visible outside a macro, a feature that is sometimes
1389   useful. The <tt/.LOCAL/ command is in my eyes a better way to address
1390   the problem.
1391
1392   You get an error when using <tt/.LOCAL/ outside a macro.
1393
1394
1395 <tag><tt>.LOCALCHAR</tt></tag>
1396
1397   Defines the character that start "cheap" local labels. You may use one
1398   of '@' and '?' as start character. The default is '@'.
1399
1400   Cheap local labels are labels that are visible only between two non
1401   cheap labels. This way you can reuse identifiers like "<tt/loop/" without
1402   using explicit lexical nesting.
1403
1404   Example:
1405
1406   <tscreen><verb>
1407         .localchar      '?'
1408
1409         Clear:  lda     #$00            ; Global label
1410         ?Loop:  sta     Mem,y           ; Local label
1411                 dey
1412                 bne     ?Loop           ; Ok
1413                 rts
1414         Sub:    ...                     ; New global label
1415                 bne     ?Loop           ; ERROR: Unknown identifier!
1416   </verb></tscreen>
1417
1418
1419 <tag><tt>.MACPACK</tt></tag>
1420
1421   Insert a predefined macro package. The command is followed by an
1422   identifier specifying the macro package to insert. Available macro
1423   packages are:
1424
1425         generic         Defines generic macros like add and sub.
1426         longbranch      Defines conditional long jump macros.
1427
1428   Including a macro package twice, or including a macro package that
1429   redefines already existing macros will lead to an error.
1430
1431   Example:
1432
1433   <tscreen><verb>
1434         .macpack        longbranch      ; Include macro package
1435
1436                 cmp     #$20            ; Set condition codes
1437                 jne     Label           ; Jump long on condition
1438   </verb></tscreen>
1439
1440   See separate section about macros packages.
1441
1442
1443 <tag><tt>.MAC, .MACRO</tt></tag>
1444
1445   Start a classic macro definition. The command is followed by an identifier
1446   (the macro name) and optionally by a comma separated list of identifiers
1447   that are macro parameters.
1448   See separate section about macros.
1449
1450
1451 <tag><tt>.MATCH</tt></tag>
1452
1453   Builtin function. Matches two token lists against each other. This is
1454   most useful within macros, since macros are not stored as strings, but
1455   as lists of tokens.
1456
1457   The syntax is
1458
1459   <tscreen><verb>
1460         .MATCH(&lt;token list #1&gt;, &lt;token list #2&gt;)
1461   </verb></tscreen>
1462
1463   Both token list may contain arbitrary tokens with the exception of the
1464   terminator token (comma resp. right parenthesis) and
1465
1466   <itemize>
1467   <item>end-of-line
1468   <item>end-of-file
1469   </itemize>
1470
1471   Often a macro parameter is used for any of the token lists.
1472
1473   Please note that the function does only compare tokens, not token
1474   attributes. So any number is equal to any other number, regardless of
1475   the actual value. The same is true for strings. If you need to compare
1476   tokens <em/and/ token attributes, use the <tt/.XMATCH/ function.
1477
1478   Example:
1479
1480   Assume the macro <tt/ASR/, that will shift right the accumulator by one, while
1481   honoring the sign bit. The builtin processor instructions will allow an
1482   optional "A" for accu addressing for instructions like <tt/ROL/ and <tt/ROR/.
1483   We will use the <tt/.MATCH/ function to check for this and print and error
1484   for invalid calls.
1485
1486   <tscreen><verb>
1487         .macro  asr     arg
1488
1489                 .if (.not .blank(arg)) .and (.not .match (arg, a))
1490                 .error "Syntax error"
1491                 .endif
1492
1493                 cmp     #$80            ; Bit 7 into carry
1494                 lsr     a               ; Shit carry into bit 7
1495
1496         .endmacro
1497   </verb></tscreen>
1498
1499   The macro will only accept no arguments, or one argument that must be the
1500   reserved keyword "A".
1501
1502
1503 <tag><tt>.MID</tt></tag>
1504
1505   Builtin function. Takes a starting index, a count and a token list as
1506   arguments. Will return part of the token list.
1507
1508   Syntax:
1509
1510   <tscreen><verb>
1511         .MID (&lt;int expr&gt;, &lt;int expr&gt;, &lt;token list&gt;)
1512   </verb></tscreen>
1513
1514   The first integer expression gives the starting token in the list (the
1515   first token has index 0). The second integer expression gives the number
1516   of tokens to extract from the token list. The third argument is the
1517   token list itself.
1518
1519   Example:
1520
1521   To check in a macro if the given argument has a '<tt/#/' as first token
1522   (immidiate addressing mode), use something like this:
1523
1524     <tscreen><verb>
1525         .macro  ldax    arg
1526                 ...
1527                 .if (.match (.mid (0, 1, arg), #))
1528
1529                 ; ldax called with immidiate operand
1530                 ...
1531
1532                 .endif
1533                 ...
1534         .endmacro
1535   </verb></tscreen>
1536
1537   See also the <tt/.LEFT/ and <tt/.RIGHT/ builtin functions.
1538
1539
1540 <tag><tt>.ORG</tt></tag>
1541
1542   Start a section of absolute code. The command is followed by a constant
1543   expression that gives the new PC counter location for which the code is
1544   assembled. Use <tt/.RELOC/ to switch back to relocatable code.
1545
1546   You may not switch segments while inside a section of absolute code.
1547
1548   Example:
1549
1550   <tscreen><verb>
1551         .org    $7FF            ; Emit code starting at $7FF
1552   </verb></tscreen>
1553
1554
1555 <tag><tt>.OUT</tt></tag>
1556
1557   Output a string to the console without producing an error. This command
1558   is similiar to <tt/.ERROR/, however, it does not force an assembler error
1559   that prevents the creation of an object file.
1560
1561   Example:
1562
1563   <tscreen><verb>
1564         .out    "This code was written by the codebuster(tm)"
1565   </verb></tscreen>
1566
1567   See also the <tt/.WARNING/ and <tt/.ERROR/ directives.
1568
1569
1570 <tag><tt>.P02</tt></tag>
1571
1572   Enable the 6502 instruction set, disable 65C02 and 65816 instructions.
1573   This is the default if not overridden by the <tt/--cpu/ command line
1574   option.
1575
1576
1577 <tag><tt>.P816</tt></tag>
1578
1579   Enable the 65816 instruction set. This is a superset of the 65C02 and
1580   6502 instruction sets.
1581
1582
1583 <tag><tt>.PAGELEN, .PAGELENGTH</tt></tag>
1584
1585   Set the page length for the listing. Must be followed by an integer
1586   constant. The value may be "unlimited", or in the range 32 to 127. The
1587   statement has no effect if no listing is generated. The default value
1588   is -1 but may be overridden by the <tt/--pagelength/ command line option.
1589   Beware: Since the listing is generated after assembly is complete, you
1590   cannot use multiple line lengths with one source. Instead, the value
1591   set with the last <tt/.PAGELENGTH/ is used.
1592
1593   Examples:
1594
1595   <tscreen><verb>
1596         .pagelength     66              ; Use 66 lines per listing page
1597
1598         .pagelength     unlimited       ; Unlimited page length
1599   </verb></tscreen>
1600
1601
1602 <tag><tt>.PARAMCOUNT</tt></tag>
1603
1604   This builtin pseudo variable is only available in macros. It is replaced
1605   by the actual number of parameters that were given in the macro
1606   invocation.
1607
1608   Example:
1609
1610   <tscreen><verb>
1611         .macro  foo     arg1, arg2, arg3
1612         .if     .paramcount <> 3
1613         .error  "Too few parameters for macro foo"
1614         .endif
1615         ...
1616         .endmacro
1617   </verb></tscreen>
1618
1619
1620 <tag><tt>.PC02</tt></tag>
1621
1622   Enable the 65C02 instructions set. This instruction set includes all
1623   6502 instructions.
1624
1625
1626 <tag><tt>.PROC</tt></tag>
1627
1628   Start a nested lexical level. All new symbols from now on are in the
1629   local lexical level and are not accessible from outside. Symbols defined
1630   outside this local level may be accessed as long as their names are not
1631   used for new symbols inside the level. Symbols names in other lexical
1632   levels do not clash, so you may use the same names for identifiers. The
1633   lexical level ends when the <tt/.ENDPROC/ command is read. Lexical levels
1634   may be nested up to a depth of 16.
1635
1636   The command may be followed by an identifier, in this case the
1637   identifier is declared in the outer level as a label having the value of
1638   the program counter at the start of the lexical level.
1639
1640   Note: Macro names are always in the global level and in a separate name
1641   space. There is no special reason for this, it's just that I've never
1642   had any need for local macro definitions.
1643
1644   Example:
1645
1646   <tscreen><verb>
1647         .proc   Clear           ; Define Clear subroutine, start new level
1648                 lda     #$00
1649         L1:     sta     Mem,y   ; L1 is local and does not cause a
1650                                 ; duplicate symbol error if used in other
1651                                 ; places
1652                 dey
1653                 bne     L1      ; Reference local symbol
1654                 rts
1655         .endproc                ; Leave lexical level
1656   </verb></tscreen>
1657
1658
1659 <tag><tt>.REF, .REFERENCED</tt></tag>
1660
1661   Builtin function. The function expects an identifier as argument in
1662   braces. The argument is evaluated, and the function yields "true" if the
1663   identifier is a symbol that has already been referenced somewhere in the
1664   source file up to the current position. Otherwise the function yields
1665   false. As an example, the <tt/.IFREF/ statement may be replaced by
1666
1667   <tscreen><verb>
1668         .if     .referenced(a)
1669   </verb></tscreen>
1670
1671
1672 <tag><tt>.RELOC</tt></tag>
1673
1674   Switch back to relocatable mode. See the <tt/.ORG/ command.
1675
1676
1677 <tag><tt>.RES</tt></tag>
1678
1679   Reserve storage. The command is followed by one or two constant
1680   expressions. The first one is mandatory and defines, how many bytes of
1681   storage should be defined. The second, optional expression must by a
1682   constant byte value that will be used as value of the data. If there
1683   is no fill value given, the linker will use the value defined in the
1684   linker configuration file (default: zero).
1685
1686   Example:
1687
1688   <tscreen><verb>
1689         ; Reserve 12 bytes of memory with value $AA
1690         .res    12, $AA
1691   </verb></tscreen>
1692
1693
1694 <tag><tt>.RIGHT</tt></tag>
1695
1696   Builtin function. Extracts the right part of a given token list.
1697
1698   Syntax:
1699
1700   <tscreen><verb>
1701         .RIGHT (&lt;int expr&gt;, &lt;token list&gt;)
1702   </verb></tscreen>
1703
1704   The first integer expression gives the number of tokens to extract from
1705   the token list. The second argument is the token list itself.
1706
1707   See also the <tt/.LEFT/ and <tt/.MID/ builtin functions.
1708
1709
1710 <tag><tt>.RODATA</tt></tag>
1711
1712   Switch to the RODATA segment. The name of the RODATA segment is always
1713   "RODATA", so this is a shortcut for
1714
1715   <tscreen><verb>
1716         .segment  "RODATA"
1717   </verb></tscreen>
1718
1719   The RODATA segment is a segment that is used by the compiler for
1720   readonly data like string constants. See also the <tt/.SEGMENT/ command.
1721
1722
1723 <tag><tt>.SEGMENT</tt></tag>
1724
1725   Switch to another segment. Code and data is always emitted into a
1726   segment, that is, a named section of data. The default segment is
1727   "CODE". There may be up to 254 different segments per object file
1728   (and up to 65534 per executable). There are shortcut commands for
1729   the most common segments ("CODE", "DATA" and "BSS").
1730
1731   The command is followed by a string containing the segment name (there
1732   are some constraints for the name - as a rule of thumb use only those
1733   segment names that would also be valid identifiers). There may also be
1734   an optional attribute separated by a comma. Valid attributes are
1735   "<tt/zeropage/" and "<tt/absolute/".
1736
1737   When specifying a segment for the first time, "absolute" is the
1738   default. For all other uses, the attribute specified the first time
1739   is the default.
1740
1741   "absolute" means that this is a segment with absolute addressing. That
1742   is, the segment will reside somewhere in core memory outside the zero
1743   page. "zeropage" means the opposite: The segment will be placed in the
1744   zero page and direct (short) addressing is possible for data in this
1745   segment.
1746
1747   Beware: Only labels in a segment with the zeropage attribute are marked
1748   as reachable by short addressing. The `*' (PC counter) operator will
1749   work as in other segments and will create absolute variable values.
1750
1751   Example:
1752
1753   <tscreen><verb>
1754         .segment "ROM2"                 ; Switch to ROM2 segment
1755         .segment "ZP2", zeropage        ; New direct segment
1756         .segment "ZP2"                  ; Ok, will use last attribute
1757         .segment "ZP2", absolute        ; Error, redecl mismatch
1758   </verb></tscreen>
1759
1760
1761 <tag><tt>.SMART</tt></tag>
1762
1763   Switch on or off smart mode. The command must be followed by a '+' or
1764   '-' character to switch the option on or off respectively. The default
1765   is off (that is, the assembler doesn't try to be smart), but this
1766   default may be changed by the -s switch on the command line.
1767
1768   In smart mode the assembler will track usage of the <tt/REP/ and <tt/SEP/
1769   instructions in 65816 mode and update the operand sizes accordingly. If
1770   the operand of such an instruction cannot be evaluated by the assembler
1771   (for example, because the operand is an imported symbol), a warning is
1772   issued. Beware: Since the assembler cannot trace the execution flow this
1773   may lead to false results in some cases. If in doubt, use the <tt/.Inn/ and
1774   <tt/.Ann/ instructions to tell the assembler about the current settings.
1775
1776   Example:
1777
1778   <tscreen><verb>
1779         .smart                          ; Be smart
1780         .smart  -                       ; Stop being smart
1781   </verb></tscreen>
1782
1783
1784 <tag><tt>.STRING</tt></tag>
1785
1786   Builtin function. The function accepts an argument in braces and
1787   converts this argument into a string constant. The argument may be an
1788   identifier, or a constant numeric value.
1789   Since you can use a string in the first place, the use of the function
1790   may not be obvious. However, it is useful in macros, or more complex
1791   setups.
1792
1793   Example:
1794
1795   <tscreen><verb>
1796         ; Emulate other assemblers:
1797         .macro  section name
1798                 .segment        .string(name)
1799         .endmacro
1800   </verb></tscreen>
1801
1802
1803 <tag><tt>.TCOUNT</tt></tag>
1804
1805   Builtin function. The function accepts a token list in braces. The
1806   function result is the number of tokens given as argument.
1807
1808   Example:
1809
1810   The <tt/ldax/ macro accepts the '#' token to denote immidiate addressing (as
1811   with the normal 6502 instructions). To translate it into two separate 8 bit
1812   load instructions, the '#' token has to get stripped from the argument:
1813
1814   <tscreen><verb>
1815         .macro  ldax    arg
1816                 .if (.match (.mid (0, 1, arg), #))
1817                 ; ldax called with immidiate operand
1818                 lda     #<(.right (.tcount (arg)-1, arg))
1819                 ldx     #>(.right (.tcount (arg)-1, arg))
1820                 .else
1821                 ...
1822                 .endif
1823         .endmacro
1824   </verb></tscreen>
1825
1826
1827 <tag><tt>.WARNING</tt></tag>
1828
1829   Force an assembly warning. The assembler will output a warning message
1830   preceeded by "User warning". This warning will always be output, even
1831   if other warnings are disabled with the <tt/-W0/ command line option.
1832
1833   This command may be used to output possible problems when assembling 
1834   the source file.
1835
1836   Example:
1837
1838   <tscreen><verb>
1839         .macro  jne     target
1840                 .local L1
1841                 .ifndef target
1842                 .warning "Forward jump in jne, cannot optimize!"
1843                 beq     L1
1844                 jmp     target
1845         L1:
1846                 .else
1847                 ...
1848                 .endif
1849         .endmacro
1850   </verb></tscreen>
1851
1852   See also the <tt/.ERROR/ and <tt/.OUT/ directives.
1853
1854
1855 <tag><tt>.WORD</tt></tag>
1856
1857   Define word sized data. Must be followed by a sequence of (word ranged,
1858   but not necessarily constant) expressions.
1859
1860   Example:
1861
1862   <tscreen><verb>
1863         .word   $0D00, $AF13, _Clear
1864   </verb></tscreen>
1865
1866
1867 <tag><tt>.ZEROPAGE</tt></tag>
1868
1869   Switch to the ZEROPAGE segment and mark it as direct (zeropage) segment.
1870   The name of the ZEROPAGE segment is always "ZEROPAGE", so this is a
1871   shortcut for
1872
1873   <tscreen><verb>
1874         .segment  "ZEROPAGE", zeropage
1875   </verb></tscreen>
1876
1877   Because of the "zeropage" attribute, labels declared in this segment are
1878   addressed using direct addressing mode if possible. You <em/must/ instruct
1879   the linker to place this segment somewhere in the address range 0..$FF
1880   otherwise you will get errors.
1881
1882 </descrip>
1883
1884
1885
1886 <sect>Macros
1887
1888 <p>
1889 Macros may be thought of as "parametrized super instructions". Macros are
1890 sequences of tokens that have a name. If that name is used in the source
1891 file, the macro is "expanded", that is, it is replaced by the tokens that
1892 were specified when the macro was defined.
1893
1894 In it's simplest form, a macro does not have parameters. Here's an
1895 example:
1896
1897 <tscreen><verb>
1898         .macro  asr             ; Arithmetic shift right
1899                 cmp     #$80    ; Put bit 7 into carry
1900                 ror             ; Rotate right with carry
1901         .endmacro
1902 </verb></tscreen>
1903
1904 The macro above consists of two real instructions, that are inserted into
1905 the code, whenever the macro is expanded. Macro expansion is simply done
1906 by using the name, like this:
1907
1908 <tscreen><verb>
1909         lda     $2010
1910         asr
1911         sta     $2010
1912 </verb></tscreen>
1913
1914 When using macro parameters, macros can be even more useful:
1915
1916 <tscreen><verb>
1917         .macro  inc16   addr
1918                 clc
1919                 lda     addr
1920                 adc     #$01
1921                 sta     addr
1922                 lda     addr+1
1923                 adc     #$00
1924                 sta     addr+1
1925         .endmacro
1926 </verb></tscreen>
1927
1928 When calling the macro, you may give a parameter, and each occurence of
1929 the name "addr" in the macro definition will be replaced by the given
1930 parameter. So
1931
1932 <tscreen><verb>
1933         inc16   $1000
1934 </verb></tscreen>
1935
1936 will be expanded to
1937
1938 <tscreen><verb>
1939                 clc
1940                 lda     $1000
1941                 adc     #$01
1942                 sta     $1000
1943                 lda     $1000+1
1944                 adc     #$00
1945                 sta     $1000+1
1946 </verb></tscreen>
1947
1948 A macro may have more than one parameter, in this case, the parameters
1949 are separated by commas. You are free to give less parameters than the
1950 macro actually takes in the definition. You may also leave intermediate
1951 parameters empty. Empty parameters are replaced by empty space (that is,
1952 they are removed when the macro is exanded). If you have a look at our
1953 macro definition above, you will see, that replacing the "addr" parameter
1954 by nothing will lead to wrong code in most lines. To help you, writing
1955 macros with a variable parameter list, there are some control commands:
1956
1957 <tt/.IFBLANK/ tests the rest of the line and returns true, if there are any
1958 tokens on the remainder of the line. Since empty parameters are replaced by
1959 nothing, this may be used to test if a given parameter is empty.
1960 <tt/.IFNBLANK/ tests the opposite.
1961
1962 Look at this example:
1963
1964 <tscreen><verb>
1965         .macro  ldaxy   a, x, y
1966         .ifnblank       a
1967                 lda     #a
1968         .endif
1969         .ifnblank       x
1970                 ldx     #x
1971         .endif
1972         .ifnblank       y
1973                 ldy     #y
1974         .endif
1975         .endmacro
1976 </verb></tscreen>
1977
1978 This macro may be called as follows:
1979
1980 <tscreen><verb>
1981         ldaxy   1, 2, 3         ; Load all three registers
1982
1983         ldaxy   1, , 3          ; Load only a and y
1984
1985         ldaxy   , , 3           ; Load y only
1986 </verb></tscreen>
1987
1988 There's another helper command for determining, which macro parameters are
1989 valid: <tt/.PARAMCOUNT/. This command is replaced by the parameter count
1990 given, <em/including/ intermediate empty macro parameters:
1991
1992 <tscreen><verb>
1993         ldaxy   1               ; .PARAMCOUNT = 1
1994         ldaxy   1,,3            ; .PARAMCOUNT = 3
1995         ldaxy   1,2             ; .PARAMCOUNT = 2
1996         ldaxy   1,              ; .PARAMCOUNT = 2
1997         ldaxy   1,2,3           ; .PARAMCOUNT = 3
1998 </verb></tscreen>
1999
2000 Macros may be used recursively:
2001
2002 <tscreen><verb>
2003         .macro  push    r1, r2, r3
2004                 lda     r1
2005                 pha
2006         .if     .paramcount > 1
2007                 push    r2, r3
2008         .endif
2009         .endmacro
2010 </verb></tscreen>
2011
2012 There's also a special macro to help writing recursive macros:
2013 <tt/.EXITMACRO/. This command will stop macro expansion immidiately:
2014
2015 <tscreen><verb>
2016         .macro  push    r1, r2, r3, r4, r5, r6, r7
2017         .ifblank        r1
2018                 ; First parameter is empty
2019                 .exitmacro
2020         .else
2021                 lda     r1
2022                 pha
2023         .endif
2024                 push    r2, r3, r4, r5, r6, r7
2025         .endmacro
2026 </verb></tscreen>
2027
2028 When expanding this macro, the expansion will push all given parameters
2029 until an empty one is encountered. The macro may be called like this:
2030
2031 <tscreen><verb>
2032         push    $20, $21, $32           ; Push 3 ZP locations
2033         push    $21                     ; Push one ZP location
2034 </verb></tscreen>
2035
2036 Now, with recursive macros, <tt/.IFBLANK/ and <tt/.PARAMCOUNT/, what else do
2037 you need? Have a look at the inc16 macro above. Here is it again:
2038
2039 <tscreen><verb>
2040         .macro  inc16   addr
2041                 clc
2042                 lda     addr
2043                 adc     #$01
2044                 sta     addr
2045                 lda     addr+1
2046                 adc     #$00
2047                 sta     addr+1
2048         .endmacro
2049 </verb></tscreen>
2050
2051 If you have a closer look at the code, you will notice, that it could be
2052 written more efficiently, like this:
2053
2054 <tscreen><verb>
2055         .macro  inc16   addr
2056                 clc
2057                 lda     addr
2058                 adc     #$01
2059                 sta     addr
2060                 bcc     Skip
2061                 inc     addr+1
2062         Skip:
2063         .endmacro
2064 </verb></tscreen>
2065
2066 But imagine what happens, if you use this macro twice? Since the label
2067 "Skip" has the same name both times, you get a "duplicate symbol" error.
2068 Without a way to circumvent this problem, macros are not as useful, as
2069 they could be. One solution is, to start a new lexical block inside the
2070 macro:
2071
2072 <tscreen><verb>
2073         .macro  inc16   addr
2074         .proc
2075                 clc
2076                 lda     addr
2077                 adc     #$01
2078                 sta     addr
2079                 bcc     Skip
2080                 inc     addr+1
2081         Skip:
2082         .endproc
2083         .endmacro
2084 </verb></tscreen>
2085
2086 Now the label is local to the block and not visible outside. However,
2087 sometimes you want a label inside the macro to be visible outside. To make
2088 that possible, there's a new command that's only usable inside a macro
2089 definition: <tt/.LOCAL/. <tt/.LOCAL/ declares one or more symbols as local to
2090 the macro expansion. The names of local variables are replaced by a unique
2091 name in each separate macro expansion. So we could also solve the problem
2092 above by using <tt/.LOCAL/:
2093
2094 <tscreen><verb>
2095         .macro  inc16   addr
2096                 .local  Skip            ; Make Skip a local symbol
2097                 clc
2098                 lda     addr
2099                 adc     #$01
2100                 sta     addr
2101                 bcc     Skip
2102                 inc     addr+1
2103         Skip:                           ; Not visible outside
2104         .endmacro
2105 </verb></tscreen>
2106
2107 Starting with version 2.5 of the assembler, there is a second macro type
2108 available: C style macros using the <tt/.DEFINE/ directive. These macros are
2109 similar to the classic macro type speified above, but behaviour is sometimes
2110 different:
2111
2112 <itemize>
2113
2114 <item>  Macros defined with <tt/.DEFINE/ may not span more than a line. You
2115         may use line continuation (see <tt/.LINECONT/) to spread the
2116         definition over more than one line for increased readability, but the
2117         macro itself does not contain an end-of-line token.
2118
2119 <item>  Macros defined with <tt/.DEFINE/ share the name space with classic
2120         macros, but they are detected and replaced at the scanner level. While
2121         classic macros may be used in every place, where a mnemonic or other
2122         directive is allowed, <tt/.DEFINE/ style macros are allowed anywhere
2123         in a line. So they are more versatile in some situations.
2124
2125 <item>  <tt/.DEFINE/ style macros may take parameters. While classic macros
2126         may have empty parameters, this is not true for <tt/.DEFINE/ style
2127         macros. For this macro type, the number of actual parameters must
2128         match exactly the number of formal parameters.
2129
2130         To make this possible, formal parameters are enclosed in braces when
2131         defining the macro. If there are no parameters, the empty braces may
2132         be omitted.
2133
2134 <item>  Since <tt/.DEFINE/ style macros may not contain end-of-line tokens,
2135         there are things that cannot be done. They may not contain several
2136         processor instructions for example. So, while some things may be done
2137         with both macro types, each type has special usages. The types
2138         complement each other.
2139
2140 </itemize>
2141
2142 Let's look at a few examples to make the advantages and disadvantages
2143 clear.
2144
2145 To emulate assemblers that use "<tt/EQU/" instead of "<tt/=/" you may use the
2146 following <tt/.DEFINE/:
2147
2148 <tscreen><verb>
2149         .define EQU     =
2150
2151         foo     EQU     $1234           ; This is accepted now
2152 </verb></tscreen>
2153
2154 You may use the directive to define string constants used elsewhere:
2155
2156 <tscreen><verb>
2157         ; Define the version number
2158         .define VERSION         "12.3a"
2159
2160         ; ... and use it
2161         .asciiz VERSION
2162 </verb></tscreen>
2163
2164 Macros with parameters may also be useful:
2165
2166 <tscreen><verb>
2167         .define DEBUG(message)  .out    message
2168
2169         DEBUG   "Assembling include file #3"
2170 </verb></tscreen>
2171
2172 Note that, while formal parameters have to be placed in braces, this is
2173 not true for the actual parameters. Beware: Since the assembler cannot
2174 detect the end of one parameter, only the first token is used. If you
2175 don't like that, use classic macros instead:
2176
2177 <tscreen><verb>
2178         .macro  message
2179                 .out    message
2180         .endmacro
2181 </verb></tscreen>
2182
2183 (This is an example where a problem can be solved with both macro types).
2184
2185
2186
2187 <sect>Macro packages
2188
2189 <p>
2190 Using the <tt/.MACPACK/ directive, predefined macro packages may be included
2191 with just one command. Available macro packages are:
2192
2193 <descrip>
2194
2195 <tag><tt>generic</tt></tag>
2196
2197   This macro package defines macros that are useful in almost any program.
2198   Currently, two macros are defined:
2199
2200   <tscreen><verb>
2201         .macro  add     Arg
2202                 clc
2203                 adc     Arg
2204         .endmacro
2205
2206         .macro  sub     Arg
2207                 sec
2208                 sbc     Arg
2209         .endmacro
2210   </verb></tscreen>
2211
2212
2213 <tag><tt>longbranch</tt></tag>
2214
2215   This macro package defines long conditional jumps. They are named like the
2216   short counterpart but with the 'b' replaced by a 'j'. Here is a sample
2217   definition for the "<tt/jeq/" macro, the other macros are built using the
2218   same scheme:
2219
2220   <tscreen><verb>
2221         .macro  jeq     Target
2222                 .if     .def(Target) .and ((*+2)-(Target) <= 127)
2223                 beq     Target
2224                 .else
2225                 bne     *+5
2226                 jmp     Target
2227                 .endif
2228         .endmacro
2229   </verb></tscreen>
2230
2231   All macros expand to a short branch, if the label is already defined (back
2232   jump) and is reachable with a short jump. Otherwise the macro expands to a
2233   conditional branch with the branch condition inverted, followed by an
2234   absolute jump to the actual branch target.
2235
2236   The package defines the following macros:
2237
2238   <tscreen><verb>
2239         jeq, jne, jmi, jpl, jcs, jcc, jvs, jvc
2240   </verb></tscreen>
2241
2242 </descrip>
2243
2244
2245 <sect>Bugs/Feedback
2246
2247 <p>
2248 If you have problems using the assembler, if you find any bugs, or if
2249 you're doing something interesting with the assembler, I would be glad to
2250 hear from you. Feel free to contact me by email
2251 (<htmlurl url="uz@musoftware.de" name="uz@musoftware.de">).
2252
2253
2254
2255 <sect>Copyright
2256
2257 <p>
2258 ca65 (and all cc65 binutils) are (C) Copyright 1998-2000 Ullrich von
2259 Bassewitz. For usage of the binaries and/or sources the following
2260 conditions do apply:
2261
2262 This software is provided 'as-is', without any expressed or implied
2263 warranty.  In no event will the authors be held liable for any damages
2264 arising from the use of this software.
2265
2266 Permission is granted to anyone to use this software for any purpose,
2267 including commercial applications, and to alter it and redistribute it
2268 freely, subject to the following restrictions:
2269
2270 <enum>
2271 <item>  The origin of this software must not be misrepresented; you must not
2272         claim that you wrote the original software. If you use this software
2273         in a product, an acknowledgment in the product documentation would be
2274         appreciated but is not required.
2275 <item>  Altered source versions must be plainly marked as such, and must not
2276         be misrepresented as being the original software.
2277 <item>  This notice may not be removed or altered from any source
2278         distribution.
2279 </enum>
2280
2281
2282 </article>
2283
2284
2285