<descrip>
+ <label id="option-A">
<tag><tt>-A, --ansi</tt></tag>
This option disables any compiler exensions. Have a look at section 5
Using this option, you can make the default characters signed. Since the
6502 has no provisions for sign extending characters (which is needed on
almost any load operation), this will make the code larger and slower. A
- better way is to declare characters explicitly as "signed" if needed.
- You can also use <tt/#pragma signedchars/ for better control of this option
- (see section <ref id="pragmas" name="#pragmas">).
+ better way is to declare characters explicitly as "signed" if needed. You
+ can also use <tt><ref id="pragma-signedchars" name="#pragma
+ signedchars"></tt> for better control of this option.
<tag><tt>-t target, --target target</tt></tag>
is entered, and will keep the old value from one call of the function to
the next.
- You may also use <tt/#pragma staticlocals/ to change this setting in your
- sources (see section <ref id="pragmas" name="#pragmas">).
+ You may also use <tt><ref id="pragma-staticlocals" name="#pragma
+ staticlocals"></tt> to change this setting in your sources.
<tag><tt>-I dir, --include-dir dir</tt></tag>
<itemize>
<item> The compiler allows // comments (like in C++ and in the proposed C9x
- standard). This feature is disabled by <tt/-A/.
+ standard). This feature is disabled by <tt><ref id="option-A"
+ name="-A"></tt>.
+ <p>
<item> The compiler allows to insert assembler statements into the output
file. The syntax is
- <p>
- <tt/asm (<string literal>) ;/
- <p>
+
+ <tscreen><verb>
+ asm (<string literal>) ;
+ </verb></tscreen>
or
- <p>
- <tt/__asm__ (<string literal>) ;/
- <p>
+ <tscreen><verb>
+ __asm__ (<string literal>) ;
+ </verb></tscreen>
The first form is in the user namespace and is disabled if the <tt/-A/
switch is given.
The asm statement may be used inside a function and on global file
level.
+ <p>
<item> There is a special calling convention named "fastcall". This calling
convention is currently only usable for functions written in
assembler. The syntax for a function declaration using fastcall is
- <p>
+
+ <tscreen><verb>
<tt/<return type> fastcall <function name> (<parameter list>)/
- <p>
+ </verb></tscreen>
or
- <p>
+ <tscreen><verb>
<tt/<return type> __fastcall__ <function name> (<parameter list>)/
- <p>
+ </verb></tscreen>
An example would be
- <p>
+ <tscreen><verb>
<tt/void __fastcall__ f (unsigned char c)/
- <p>
+ </verb></tscreen>
The first form of the fastcall keyword is in the user namespace and is
therefore disabled in strict ANSI mode.
pushed on the stack but left in the primary register when the function
is called. This will reduce the cost when calling assembler functions
significantly, especially when the function itself is rather small.
+ <p>
<item> There are two pseudo variables named <tt/__AX__/ and <tt/__EAX__/.
Both refer to the primary register that is used by the compiler to
sequences of assembler code. For example, the macro
<tscreen><verb>
- #define hi(x) (__AX__=(x),asm("\ttxa\n\tldx\t#$00",__AX__)
+ #define hi(x) (__AX__=(x),asm("\ttxa\n\tldx\t#$00",__AX__)
</verb></tscreen>
will give the high byte of any unsigned value.
+ <p>
<item> Inside a function, the identifier <tt/__func__/ gives the name of the
current function as a string. Outside of functions, <tt/__func__/ is
Example:
<tscreen><verb>
- #define PRINT_DEBUG(s) printf ("%s: %s\n", __func__, s);
+ #define PRINT_DEBUG(s) printf ("%s: %s\n", __func__, s);
</verb></tscreen>
The macro will print the name of the current function plus a given
string.
+ <p>
</itemize>
<p>
The compiler understands some pragmas that may be used to change code
generation and other stuff.
-<descrip>
- <tag><tt>#pragma bssseg (<name>)</tt></tag>
+<sect1><tt>#pragma bssseg (<name>)</tt><p>
This pragma changes the name used for the BSS segment (the BSS segment
is used to store uninitialized data). The argument is a string enclosed
Example:
<tscreen><verb>
- #pragma bssseg ("MyBSS")
+ #pragma bssseg ("MyBSS")
</verb></tscreen>
- <tag><tt>#pragma codeseg (<name>)</tt></tag>
+<sect1><tt>#pragma codeseg (<name>)</tt><p>
This pragma changes the name used for the CODE segment (the CODE segment
is used to store executable code). The argument is a string enclosed in
</verb></tscreen>
- <tag><tt>#pragma dataseg (<name>)</tt></tag>
+<sect1><tt>#pragma dataseg (<name>)</tt><p>
This pragma changes the name used for the DATA segment (the DATA segment
is used to store initialized data). The argument is a string enclosed in
</verb></tscreen>
- <tag><tt>#pragma rodataseg (<name>)</tt></tag>
+<sect1><tt>#pragma rodataseg (<name>)</tt><p>
This pragma changes the name used for the RODATA segment (the RODATA
segment is used to store readonly data). The argument is a string
</verb></tscreen>
- <tag><tt>#pragma regvaraddr (<const int>)</tt></tag>
+<sect1><tt>#pragma regvaraddr (<const int>)</tt><p>
The compiler does not allow to take the address of register variables.
The regvaraddr pragma changes this. Taking the address of a register
Example:
<tscreen><verb>
- #pragma regvaraddr(1) /* Allow taking the address
- * of register variables
- */
+ #pragma regvaraddr(1) /* Allow taking the address
+ * of register variables
+ */
</verb></tscreen>
- <tag><tt>#pragma signedchars (<const int>)</tt></tag>
+<sect1><tt>#pragma signedchars (<const int>)</tt><label
+id="pragma-signedchars"><p>
Changed the signedness of the default character type. If the argument
is not zero, default characters are signed, otherwise characters are
<tt/--signed-chars/ command line option.
- <tag><tt>#pragma staticlocals (<const int>)</tt></tag>
+<sect1><tt>#pragma staticlocals (<const int>)</tt><label
+id="pragma-staticlocals"<p>
Use variables in the bss segment instead of variables on the stack. This
pragma changes the default set by the compiler option <tt/-Cl/. If the
leading to shorter and in most cases faster, but non-reentrant code.
- <tag><tt>#pragma zpsym (<name>)</tt></tag>
+<sect1><tt>#pragma zpsym (<name>)</tt><p>
Tell the compiler that the - previously as external declared - symbol with
the given name is a zero page symbol (usually from an assembler file).
#pragma zpsym ("foo"); /* foo is in the zeropage */
</verb></tscreen>
-</descrip>