]> git.sur5r.net Git - cc65/blobdiff - doc/cc65.sgml
Merge pull request #849 from polluks/patch-4
[cc65] / doc / cc65.sgml
index 9322a2d447e51e70c776971ee9be8416f4f8ca45..a66854095433cc63218a85650d576953f11139e6 100644 (file)
@@ -4,7 +4,6 @@
 <title>cc65 Users Guide
 <author><url url="mailto:uz@cc65.org" name="Ullrich von Bassewitz">,<newline>
 <url url="mailto:gregdk@users.sf.net" name="Greg King">
-<date>2017-03-21
 
 <abstract>
 cc65 is a C compiler for 6502 targets. It supports several 6502 based home
@@ -247,10 +246,10 @@ Here is a description of all the command line options:
         <p>
   </itemize>
 
-  <tt/--eagerly-inline-funcs/ implies the <tt/<ref id="option-inline-stdfuncs"
-  name="--inline-stdfuncs"/ command line option.
+  <tt/--eagerly-inline-funcs/ implies the <tt><ref id="option-inline-stdfuncs"
+  name="--inline-stdfuncs"></tt> command line option.
 
-  See also <tt/<ref id="pragma-allow-eager-inline" name="#pragma&nbsp;allow-eager-inline">/.
+  See also <tt><ref id="pragma-allow-eager-inline" name="#pragma&nbsp;allow-eager-inline"></tt>.
 
 
   <tag><tt>-h, --help</tt></tag>
@@ -263,9 +262,9 @@ Here is a description of all the command line options:
 
   Allow the compiler to inline some standard functions from the C library like
   strlen.  This will not only remove the overhead for a function call, but will
-  make the code visible for the optimizer.  See also the <tt/<ref id="option-O"
-  name="-Os"/ command line option and <tt/<ref id="pragma-inline-stdfuncs"
-  name="#pragma&nbsp;inline-stdfuncs">/.
+  make the code visible for the optimizer.  See also the <tt><ref id="option-O"
+  name="-Os"></tt> command line option and <tt><ref id="pragma-inline-stdfuncs"
+  name="#pragma&nbsp;inline-stdfuncs"></tt>.
 
 
   <label id="option-list-warnings">
@@ -407,6 +406,7 @@ Here is a description of all the command line options:
   <item>sim6502
   <item>sim65c02
   <item>supervision
+  <item>telestrat
   <item>vic20
   </itemize>
 
@@ -491,7 +491,8 @@ Here is a description of all the command line options:
   Using <tt/-Os/ will allow the compiler to inline some standard functions
   from the C library like strlen.  This will not only remove the overhead
   for a function call, but will make the code visible for the optimizer.
-  See also <tt/<ref id="option-inline-stdfuncs" name="--inline-stdfuncs"/.
+  See also the <tt/<ref id="option-inline-stdfuncs" name="--inline-stdfuncs">/
+  command line option.
 
   It is possible to concatenate the modifiers for <tt/-O/. For example, to
   enable register variables and inlining of standard functions, you may use
@@ -861,8 +862,8 @@ The compiler defines several macros at startup:
 
   <tag><tt>__EAGERLY_INLINE_FUNCS__</tt></tag>
 
-  Is defined if the compiler was called with the <tt/<ref id="option-eagerly-inline-funcs"
-  name="--eagerly-inline-funcs"/ command line option.
+  Is defined if the compiler was called with the <tt><ref id="option-eagerly-inline-funcs"
+  name="--eagerly-inline-funcs"></tt> command line option.
 
   <tag><tt>__FILE__</tt></tag>
 
@@ -940,6 +941,10 @@ The compiler defines several macros at startup:
 
   This macro is defined if the target is the Supervision (-t supervision).
 
+  <tag><tt>__TELESTRAT__</tt></tag>
+
+  This macro is defined if the target is the Telestrat (-t telestrat).
+  
   <tag><tt>__TIME__</tt></tag>
 
   This macro expands to the time of translation of the preprocessing
@@ -965,9 +970,9 @@ parameter with the <tt/#pragma/.
 
   Allow eager inlining of known functions.  If the argument is "off", eager
   inlining is disabled, otherwise it is enabled. Please note that (in contrast
-  to the <tt/<ref id="option-eagerly-inline-funcs" name="--eagerly-inline-funcs"/
-  command line option) this pragma does not imply the <tt/<ref id="option-inline-stdfuncs"
-  name="--inline-stdfuncs"/ command line option.  Rather it marks code to be safe for
+  to the <tt><ref id="option-eagerly-inline-funcs" name="--eagerly-inline-funcs"></tt>
+  command line option) this pragma does not imply the <tt><ref id="option-inline-stdfuncs"
+  name="--inline-stdfuncs"></tt> command line option.  Rather it marks code to be safe for
   eager inlining of known functions if inlining of standard functions is enabled.
 
   The <tt/#pragma/ understands the push and pop parameters as explained above.
@@ -1098,7 +1103,7 @@ parameter with the <tt/#pragma/.
   Allow the compiler to inline some standard functions from the C library like
   strlen.  If the argument is "off", inlining is disabled, otherwise it is enabled.
 
-  See also the the <tt/<ref id="option-inline-stdfuncs" name="--inline-stdfuncs"/
+  See also the <tt/<ref id="option-inline-stdfuncs" name="--inline-stdfuncs">/
   command line option.
 
   The <tt/#pragma/ understands the push and pop parameters as explained above.
@@ -1118,6 +1123,23 @@ parameter with the <tt/#pragma/.
   remembered and output as a whole when translation is finished.
 
 
+<sect1><tt>#pragma message (&lt;message&gt;)</tt><label id="pragma-message"><p>
+
+  This pragma is used to display informational messages at compile-time.
+
+  The message intented to be displayed must be a string literal.
+
+  Example:
+  <tscreen><verb>
+        #pragma message ("in a bottle")
+  </verb></tscreen>
+
+  Results in the compiler outputting the following to stderr:
+  <tscreen><verb>
+        example.c(42): Note: in a bottle
+  </verb></tscreen>
+
+
 <sect1><tt>#pragma optimize ([push,] on|off)</tt><label id="pragma-optimize"><p>
 
   Switch optimization on or off. If the argument is "off", optimization is
@@ -1228,6 +1250,39 @@ parameter with the <tt/#pragma/.
   </verb></tscreen>
 
 
+<sect1><tt>#pragma wrapped-call (push, &lt;name&gt;, &lt;identifier&gt;)</tt><label id="pragma-wrapped-call"><p>
+
+  This pragma sets a wrapper for functions, often used for trampolines.
+
+  The name is a function returning <tt/void/, and taking no parameters.
+  It must preserve the CPU's <tt/A/ and <tt/X/ registers if it wraps any
+  <tt/__fastcall__/ functions that have parameters.  It must preserve
+  the <tt/Y/ register if it wraps any variadic functions (they have "<tt/.../"
+  in their prototypes).
+
+  The identifier is an 8-bit number that's set into <tt/tmp4/.
+
+  The address of a wrapped function is passed in <tt/ptr4/.  The wrapper can
+  call that function by using "<tt/jsr callptr4/".
+
+  This feature is useful, for example, with banked memory, to switch banks
+  automatically to where a wrapped function resides, and then to restore the
+  previous bank when it returns.
+
+  The <tt/#pragma/ requires the push or pop argument as explained above.
+
+  Example:
+  <tscreen><verb>
+/* Note that this code can be in a header. */
+void mytrampoline(void); /* Doesn't corrupt __AX__ */
+
+#pragma wrapped-call (push, mytrampoline, 5)
+void somefunc1(void);
+void somefunc2(int, char *);
+#pragma wrapped-call (pop)
+  </verb></tscreen>
+
+
 <sect1><tt>#pragma writable-strings ([push,] on|off)</tt><label id="pragma-writable-strings"><p>
 
   Changes the storage location of string literals. For historical reasons,