* doc/sdccman.lyx: changed sdcc version to 2.7.0,
[fw/sdcc] / doc / sdccman.lyx
index 13c3965d913baf63085d59edad603cc92f977cc3..9e709c2b7172b605dea3494aeb9a9259786de568 100644 (file)
@@ -1,4 +1,4 @@
-#LyX 1.4.3 created this file. For more info see http://www.lyx.org/
+#LyX 1.4.4 created this file. For more info see http://www.lyx.org/
 \lyxformat 245
 \begin_document
 \begin_header
@@ -51,7 +51,7 @@
 \begin_body
 
 \begin_layout Standard
-\begin_inset Note Comment
+\begin_inset Note Note
 status collapsed
 
 \begin_layout Standard
@@ -74,7 +74,7 @@ status collapsed
 
 \begin_layout Standard
 Two resp.
- three consecutive dashes simply result in a long resp.
+ three consecutive dashes would otherwise result in a long resp.
  extra long dash.
 \end_layout
 
@@ -104,17 +104,17 @@ SDCC Compiler User Guide
 \begin_layout Date
 
 \size normal
-SDCC 2.6.4
+SDCC 2.7.0
 \size footnotesize
 
 \newline
-$Date$ 
+$Date::             
 \newline
 $Revision$
 \end_layout
 
 \begin_layout Standard
-\begin_inset Note Comment
+\begin_inset Note Note
 status collapsed
 
 \begin_layout Standard
@@ -163,8 +163,8 @@ C
 \emph on
 C
 \emph default
-ompiler) is an open source, retargettable, optimizing ANSI-C compiler by
+ompiler) is free open source, retargettable, optimizing ANSI-C compiler
+ by 
 \series bold
 Sandeep Dutta
 \series default
@@ -676,13 +676,14 @@ status collapsed
 \newline
 
 \newline
-SDCC also comes with a companion source level debugger SDCDB, the debugger
- currently uses ucSim a freeware simulator for 8051 and other micro-controllers.<
+SDCC also comes with a companion source level debugger SDCDB.
+ The debugger currently uses ucSim, a free open source simulator for 8051
+ and other micro-controllers.
 \newline
 
 \newline
-
-The latest version can be downloaded from 
+The latest SDCC version can be downloaded from
 \begin_inset LatexCommand \url{http://sdcc.sourceforge.net/snap.php}
 
 \end_inset
@@ -730,11 +731,11 @@ freeware
 \emph default
 ; source code for all the sub-packages (pre-processor, assemblers, linkers
  etc) is distributed with the package.
- This documentation is maintained using a freeware word processor (LyX).
+ This documentation is maintained using a free open source word processor
+ (LyX).
 \newline
-This
- program is free software; you can redistribute it and/or modify it under
- the terms of the GNU General Public License
+This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License
 \begin_inset LatexCommand \index{GNU General Public License, GPL}
 
 \end_inset
@@ -802,8 +803,9 @@ Compatibility
 \end_layout
 
 \begin_layout Standard
-This version has numerous bug fixes compared with the previous version.
- But we also introduced some incompatibilities with older versions.
+Newer versions have usually numerous bug fixes compared with the previous
+ version.
+ But we also sometimes introduce some incompatibilities with older versions.
  Not just for the fun of it, but to make the compiler more stable, efficient
  and ANSI compliant
 \begin_inset LatexCommand \index{ANSI-compliance}
@@ -817,6 +819,16 @@ This version has numerous bug fixes compared with the previous version.
 
  for ANSI-Compliance).
  
+\begin_inset Note Note
+status collapsed
+
+\begin_layout Standard
+It would be fine to add to each item, in which version was it changed.
+\end_layout
+
+\end_inset
+
+
 \newline
 
 \end_layout
@@ -824,6 +836,13 @@ This version has numerous bug fixes compared with the previous version.
 \begin_layout Itemize
 short is now equivalent to int (16 bits), it used to be equivalent to char
  (8 bits) which is not ANSI compliant.
+ To maintain compatibility, old programs may be compiled using the --short-is-8b
+its commandline option (see 
+\begin_inset LatexCommand \vref{lyx:--short-is-8bits}
+
+\end_inset
+
+).
 \end_layout
 
 \begin_layout Itemize
@@ -1038,8 +1057,8 @@ The SDCC home page at
  Some of the other tools (simulator and assembler) included with SDCC contain
  their own documentation and can be found in the source distribution.
  If you want the latest unreleased software, the complete source package
- is available directly from Subversion on https://svn.sourceforge.net/svnroot/sdcc
-/trunk/sdcc.
+ is available directly from Subversion on https://sdcc.svn.sourceforge.net/svnroot/
+sdcc/trunk/sdcc.
 \end_layout
 
 \begin_layout Section
@@ -1561,7 +1580,8 @@ a gcc compiler and last but not least
 \end_layout
 
 \begin_layout Enumerate
-the binaries can be built by cross compiling on Sourceforge's compile farm.
+the binaries can be built by cross compiling on SDCC Distributed Compile
+ Farm.
 \end_layout
 
 \begin_layout Standard
@@ -3741,7 +3761,7 @@ lib/
 \end_layout
 
 \begin_layout Standard
-\begin_inset Note Comment
+\begin_inset Note Note
 status collapsed
 
 \begin_layout Standard
@@ -3797,17 +3817,17 @@ Building SDCC on Linux
 \series medium
 Download the source package
 \series default
- either from the SDCC Subversion repository or from the nightly snapshots
+ either from the SDCC Subversion repository or from snapshot builds
 \series medium
 , it will be named something like sdcc
 \series default
-.src
+-src
 \series medium
-.t
+-yyyymmdd-rrrr.t
 \series default
 ar.
 \series medium
-gz
+bz2
 \series default
  
 \begin_inset LatexCommand \url{http://sdcc.sourceforge.net/snap.php}
@@ -3829,10 +3849,12 @@ Bring up a command line terminal, such as xterm.
 Unpack the file using a command like: 
 \family sans
 \series bold
-"tar -xvzf sdcc.src.tar.gz
+"tar -xvzf sdcc-src-yyyymmdd-rrrr.tar.bz2
+\begin_inset Quotes srd
+\end_inset
+
+
 \family default
-\series default
-"
 \series medium
 , this will create a sub-directory called sdcc with all of the sources.
 \end_layout
@@ -3901,7 +3923,7 @@ Type
 \end_layout
 
 \begin_layout Subsection
-Building SDCC on OSX 2.x
+Building SDCC on Mac OS X
 \end_layout
 
 \begin_layout Standard
@@ -3909,8 +3931,8 @@ Follow the instruction for Linux.
 \newline
 
 \newline
-On OSX 2.x it was reported, that the default
- gcc (version 3.1 20020420 (prerelease)) fails to compile SDCC.
+On Mac OS X 10.2.x it was reported, that the
default gcc (version 3.1 20020420 (prerelease)) fails to compile SDCC.
  Fortunately there's also gcc 2.9.x installed, which works fine.
  This compiler can be selected by running 'configure' with:
 \end_layout
@@ -4146,7 +4168,7 @@ Building SDCC Using Microsoft Visual C++ 6.0/NET (MSVC)
 Download the source package
 \series default
  either from the SDCC Subversion repository or from the 
-\begin_inset LatexCommand \url[nightly snapshots]{http://sdcc.sourceforge.net/snap.php}
+\begin_inset LatexCommand \url[snapshot builds]{http://sdcc.sourceforge.net/snap.php}
 
 \end_inset
 
@@ -4154,9 +4176,9 @@ Download the source package
 \series medium
 , it will be named something like sdcc
 \series default
-.src
+-src
 \series medium
-.tgz.
+-yyyymmdd-rrrr.tar.bz2.
 
 \series default
  SDCC is distributed with all the projects, workspaces, and files you need
@@ -5359,7 +5381,7 @@ S51
 
 \end_inset
 
- is a freeware, opensource simulator developed by Daniel Drotos.
+ is a free open source simulator developed by Daniel Drotos.
  The simulator is built as part of the build process.
  For more information visit Daniel's web site at: 
 \begin_inset LatexCommand \url{http://mazsola.iit.uni-miskolc.hu/~drdani/embedded/s51}
@@ -5576,6 +5598,21 @@ objdump
 
 \end_inset
 
+
+\begin_inset Note Note
+status collapsed
+
+\begin_layout Standard
+hyperlinks needed
+\end_layout
+
+\end_inset
+
+ - see also section 
+\begin_inset LatexCommand \vref{sub:Postprocessing-the-Intel}
+
+\end_inset
+
 ).
  Both formats are documented in the documentation of srecord
 \begin_inset LatexCommand \index{srecord (bin, hex, ... tool)}
@@ -5683,12 +5720,13 @@ odule
 \emph on
 f
 \emph default
-ormat is commonly used by third party tools (debuggers
+ormat is a subformat of the OMF51 format and is commonly used by third party
+ tools (debuggers
 \begin_inset LatexCommand \index{Debugger}
 
 \end_inset
 
-, simulators, emulators)
+, simulators, emulators).
 \end_layout
 
 \begin_layout Itemize
@@ -5740,6 +5778,11 @@ Postprocessing the Intel Hex
 \end_inset
 
  file
+\begin_inset LatexCommand \label{sub:Postprocessing-the-Intel}
+
+\end_inset
+
+
 \end_layout
 
 \begin_layout Standard
@@ -6397,6 +6440,11 @@ Command Line Options
 \end_inset
 
 
+\begin_inset LatexCommand \label{sec:Command-Line-Options}
+
+\end_inset
+
+
 \end_layout
 
 \begin_layout Subsection
@@ -6555,11 +6603,11 @@ Processor Selection Options
 
 \end_inset
 
-.
+, which is based on AVR-port of the gcc compiler.
 \end_layout
 
 \begin_layout Standard
-\begin_inset Note Comment
+\begin_inset Note Note
 status collapsed
 
 \begin_layout Standard
@@ -6594,7 +6642,7 @@ I think it is fair to direct users there for now.
 \end_layout
 
 \begin_layout Standard
-\begin_inset Note Comment
+\begin_inset Note Note
 status collapsed
 
 \begin_layout Standard
@@ -6696,7 +6744,7 @@ Preprocessor Options
 
 
 \series default
- The additional location where the pre processor will look for <..h> or 
+ The additional location where the preprocessor will look for <..h> or 
 \begin_inset Quotes eld
 \end_inset
 
@@ -6880,6 +6928,11 @@ Like `-dD' except that the macro arguments and contents are omitted.
 
 \series bold
 -pedantic-parse-number
+\begin_inset LatexCommand \index{pedantic}
+
+\end_inset
+
+
 \begin_inset LatexCommand \index{-pedantic-parse-number}
 
 \end_inset
@@ -6887,20 +6940,30 @@ Like `-dD' except that the macro arguments and contents are omitted.
 
 \size large
 \bar under
+
+\begin_inset LatexCommand \label{lyx:-pedantic-parse-number}
+
+\end_inset
+
  
 \series default
 \size default
 \bar default
-Pedentic parse numbers so that situations like 0xfe-LO_B(3) are parsed properly
+Pedantic parse numbers so that situations like 0xfe-LO_B(3) are parsed properly
  and the macro LO_B(3) gets expanded.
- See also #pragma pedantic_parse_number in section
+ See also #pragma pedantic_parse_number 
+\begin_inset LatexCommand \vpageref{ite:pedantic_parse_number}
+
+\end_inset
+
+ in section
 \begin_inset LatexCommand \ref{sec:Pragmas}
 
 \end_inset
 
  
 \emph on
-Note: this functionality is not in conformance with standard!
+Note: this functionality is not in conformance with C99 standard!
 \end_layout
 
 \begin_layout List
@@ -8193,6 +8256,21 @@ status collapsed
 -model-flat24 option
 \emph default
 ).
+\series bold
+
+\begin_inset Note Note
+status collapsed
+
+\begin_layout List
+\labelwidthstring 00.00.0000
+
+\series bold
+--stack-8-bit - switches off the 10-bit mode
+\end_layout
+
+\end_inset
+
+
 \end_layout
 
 \begin_layout List
@@ -8358,7 +8436,257 @@ status collapsed
 
  When linking, skip the standard crt0.o object file.
  You must provide your own crt0.o for your system when linking.
+\end_layout
+
+\begin_layout List
+\labelwidthstring 00.00.0000
+
+\series bold
+-
+\begin_inset ERT
+status collapsed
+
+\begin_layout Standard
+
+
+\backslash
+/
+\end_layout
+
+\end_inset
+
+-portmode=
+\series default
+<Value>
+\begin_inset LatexCommand \index{Z80!Options!-\/-portmode=<Value>}
+
+\end_inset
+
+ Determinate PORT I/O mode (<Value> is z80 or z180).
+\end_layout
+
+\begin_layout List
+\labelwidthstring 00.00.0000
+
+\series bold
+-
+\begin_inset ERT
+status collapsed
+
+\begin_layout Standard
+
+
+\backslash
+/
+\end_layout
+
+\end_inset
+
+-asm=
+\series default
+<Value>
+\begin_inset LatexCommand \index{Z80!Options!-\/-asm=<Value>}
+
+\end_inset
+
+ Define assembler name (<Value> is rgbds, asxxxx, isas or z80asm).
+\end_layout
+
+\begin_layout List
+\labelwidthstring 00.00.0000
+
+\series bold
+-
+\begin_inset ERT
+status collapsed
+
+\begin_layout Standard
+
+
+\backslash
+/
+\end_layout
+
+\end_inset
+
+-codeseg
+\series default
+\InsetSpace ~
+<Value>
+\begin_inset LatexCommand \index{Z80!Options!-\/-codeseg <Value>}
+
+\end_inset
+
+ Use <Value> for the code segment name.
+\end_layout
+
+\begin_layout List
+\labelwidthstring 00.00.0000
+
+\series bold
+-
+\begin_inset ERT
+status collapsed
+
+\begin_layout Standard
+
+
+\backslash
+/
+\end_layout
+
+\end_inset
+
+-constseg
+\series default
+\InsetSpace ~
+<Value>
+\begin_inset LatexCommand \index{Z80!Options!-\/-constseg <Value>}
+
+\end_inset
+
+ Use <Value> for the const segment name.
+\end_layout
+
+\begin_layout List
+\labelwidthstring 00.00.0000
+\begin_inset VSpace bigskip
+\end_inset
+
+
+\end_layout
+
+\begin_layout Subsection
+GBZ80 Options
+\begin_inset LatexCommand \index{Options GBZ80}
+
+\end_inset
+
+
+\begin_inset LatexCommand \index{GBZ80}
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout List
+\labelwidthstring 00.00.0000
+
+\series bold
+-
+\begin_inset ERT
+status collapsed
+
+\begin_layout Standard
+
+
+\backslash
+/
+\end_layout
+
+\end_inset
+
+-callee-saves-bc
+\series default
+
+\begin_inset LatexCommand \index{GBZ80!Options!-\/-callee-saves-bc}
+
+\end_inset
+
+
+\size large
+\emph on
  
+\size default
+\emph default
+Force a called function to always save BC.
+\end_layout
+
+\begin_layout List
+\labelwidthstring 00.00.0000
+
+\series bold
+-bo
+\series default
+\InsetSpace ~
+<Num>
+\begin_inset LatexCommand \index{GBZ80!Options!-bo <Num>}
+
+\end_inset
+
+ Use code bank <Num>.
+\end_layout
+
+\begin_layout List
+\labelwidthstring 00.00.0000
+
+\series bold
+-ba
+\series default
+\InsetSpace ~
+<Num>
+\begin_inset LatexCommand \index{GBZ80!Options!-ba <Num>}
+
+\end_inset
+
+ Use data bank <Num>.
+\end_layout
+
+\begin_layout List
+\labelwidthstring 00.00.0000
+
+\series bold
+-
+\begin_inset ERT
+status collapsed
+
+\begin_layout Standard
+
+
+\backslash
+/
+\end_layout
+
+\end_inset
+
+-codeseg
+\series default
+\InsetSpace ~
+<Value>
+\begin_inset LatexCommand \index{GBZ80!Options!-\/-codeseg <Value>}
+
+\end_inset
+
+ Use <Value> for the code segment name.
+\end_layout
+
+\begin_layout List
+\labelwidthstring 00.00.0000
+
+\series bold
+-
+\begin_inset ERT
+status collapsed
+
+\begin_layout Standard
+
+
+\backslash
+/
+\end_layout
+
+\end_inset
+
+-constseg
+\series default
+\InsetSpace ~
+<Value>
+\begin_inset LatexCommand \index{GBZ80!Options!-\/-constseg <Value>}
+
+\end_inset
+
+ Use <Value> for the const segment name.
 \end_layout
 
 \begin_layout Standard
@@ -8953,11 +9281,74 @@ status collapsed
 
  
 \series default
-The output path resp.
file where everything will be placed.
+The output path where everything will be placed or the file name used for
all generated output files.
  If the parameter is a path, it must have a trailing slash (or backslash
  for the Windows binaries) to be recognized as a path.
+
+\emph on
  
+\emph default
+Note for Windows users: if the path contains spaces, it should be surrounded
+ by quotes.
+ The trailing backslash should be doubled in order to prevent escaping the
+ final quote, for example: 
+\emph on
+-o 
+\begin_inset Quotes sld
+\end_inset
+
+F:
+\backslash
+Projects
+\backslash
+test3
+\backslash
+output 1
+\backslash
+
+\backslash
+
+\begin_inset Quotes srd
+\end_inset
+
+
+\emph default
+ or put after the final quote, for example: 
+\emph on
+-o 
+\begin_inset Quotes sld
+\end_inset
+
+F:
+\backslash
+Projects
+\backslash
+test3
+\backslash
+output 1
+\begin_inset Quotes srd
+\end_inset
+
+
+\backslash
+
+\emph default
+.
+ The path using slashes for directory delimiters can be used too, for example:
+\emph on
+-o 
+\begin_inset Quotes sld
+\end_inset
+
+F:/Projects/test3/output 1/
+\begin_inset Quotes srd
+\end_inset
+
+
+\emph default
+.
 \end_layout
 
 \begin_layout List
@@ -9039,16 +9430,21 @@ status collapsed
 
 \end_inset
 
- function1[,function2][,function3]....
+\begin_inset LatexCommand \label{lyx:--callee-saves-function1[,function2][,function3]...}
+
+\end_inset
+
+function1[,function2][,function3]....
 
 \series default
  The compiler by default uses a caller saves convention for register saving
  across function calls, however this can cause unnecessary register pushing
& popping when calling small functions from larger functions.
and popping when calling small functions from larger functions.
  This option can be used to switch the register saving convention for the
  function names specified.
  The compiler will not save registers when calling these functions, no extra
- code will be generated at the entry & exit (function prologue
+ code will be generated at the entry and exit (function prologue
 \series bold
 
 \begin_inset LatexCommand \index{function prologue}
@@ -9057,7 +9453,7 @@ status collapsed
 
 
 \series default
& epilogue
and epilogue
 \series bold
 
 \begin_inset LatexCommand \index{function epilogue}
@@ -9066,9 +9462,9 @@ status collapsed
 
 
 \series default
-) for these functions to save & restore the registers used by these functions,
- this can SUBSTANTIALLY reduce code & improve run time performance of the
- generated code.
+) for these functions to save and restore the registers used by these functions,
+ this can SUBSTANTIALLY reduce code and improve run time performance of
the generated code.
  In the future the compiler (with inter procedural analysis) will be able
  to determine the appropriate scheme to use for each function call.
  DO NOT use this option for built-in functions such as _mulint..., if this
@@ -9090,11 +9486,16 @@ status collapsed
 
 -callee-saves option string.
  Also see #pragma\InsetSpace ~
-callee_saves
+callee_saves 
 \begin_inset LatexCommand \index{\#pragma callee\_saves}
 
 \end_inset
 
+\begin_inset LatexCommand \vpageref{ite:callee_saves-function1[,function2[,function3...]]--}
+
+\end_inset
+
 .
 \end_layout
 
@@ -9109,6 +9510,50 @@ status collapsed
 \begin_layout Standard
 
 
+\backslash
+/
+\end_layout
+
+\end_inset
+
+-all-callee-saves
+\begin_inset LatexCommand \index{-\/-all-callee-saves}
+
+\end_inset
+
+\series default
+Function of
+\series bold
+\series default
+-
+\begin_inset ERT
+status collapsed
+
+\begin_layout Standard
+
+
+\backslash
+/
+\end_layout
+
+\end_inset
+
+-callee-saves will be applied to all functions by default.
+\end_layout
+
+\begin_layout List
+\labelwidthstring 00.00.0000
+
+\series bold
+-
+\begin_inset ERT
+status collapsed
+
+\begin_layout Standard
+
+
 \backslash
 /
 \end_layout
@@ -9277,6 +9722,50 @@ status collapsed
 \begin_layout Standard
 
 
+\backslash
+/
+\end_layout
+
+\end_inset
+
+-funsigned-char
+\begin_inset LatexCommand \index{-\/-funsigned-char}
+
+\end_inset
+
+
+\series default
+ The default signedness for every type is
+\family typewriter
+ signed
+\family default
+.
+ In some embedded environments the default signedness of
+\family typewriter
+ char
+\family default
+ is
+\family typewriter
+ unsigned
+\family default
+.
+ To set the signess for characters to unsigned, use the option --funsigned-char.
+ If this option is set and no signedness keyword (unsigned/signed) is given,
+ a char will be signed.
+ All other types are unaffected.
+\end_layout
+
+\begin_layout List
+\labelwidthstring 00.00.0000
+
+\series bold
+-
+\begin_inset ERT
+status collapsed
+
+\begin_layout Standard
+
+
 \backslash
 /
 \end_layout
@@ -9448,6 +9937,33 @@ status collapsed
 \begin_layout Standard
 
 
+\backslash
+/
+\end_layout
+
+\end_inset
+
+-fverbose-asm
+\begin_inset LatexCommand \index{-\/-no-gen-comments}
+
+\end_inset
+
+
+\series default
+ Include code generator and peep-hole comments in the generated asm files.
+\end_layout
+
+\begin_layout List
+\labelwidthstring 00.00.0000
+
+\series bold
+-
+\begin_inset ERT
+status collapsed
+
+\begin_layout Standard
+
+
 \backslash
 /
 \end_layout
@@ -9461,7 +9977,8 @@ status collapsed
 
 
 \series default
- Will not include peep-hole comments in the generated files.
+ Don't include peep-hole comments in the generated asm files even if --fverbose-
+asm option is specified.
 \end_layout
 
 \begin_layout List
@@ -9510,18 +10027,34 @@ status collapsed
 \end_inset
 
 -less-pedantic
+\begin_inset LatexCommand \index{pedantic}
+
+\end_inset
+
+
 \begin_inset LatexCommand \index{-\/-less-pedantic}
 
 \end_inset
 
 
 \series default
+
+\begin_inset LatexCommand \label{lyx:--less-pedantic}
+
+\end_inset
+
  Disable some of the more pedantic warnings
 \begin_inset LatexCommand \index{Warnings}
 
 \end_inset
 
- (jwk burps: please be more specific here, please!).
+.
+ For more details, see the less_pedantic pragma 
+\begin_inset LatexCommand \vpageref{ite:less_pedantic}
+
+\end_inset
+
+.
 \end_layout
 
 \begin_layout List
@@ -9849,7 +10382,7 @@ status collapsed
 
 \InsetSpace ~
 <Name> The name to be used for the const
-\begin_inset LatexCommand \index{code}
+\begin_inset LatexCommand \index{const}
 
 \end_inset
 
@@ -9885,15 +10418,38 @@ status collapsed
 
 
 \series default
- Permit '$' as an identifier character
+ Permit '$' as an identifier character.
 \end_layout
 
 \begin_layout List
 \labelwidthstring 00.00.0000
 
 \series bold
-more-pedantic
+-
+\begin_inset ERT
+status collapsed
+
+\begin_layout Standard
+
+
+\backslash
+/
+\end_layout
+
+\end_inset
+
+-more-pedantic
 \series default
+
+\begin_inset LatexCommand \index{-\/-more-pedantic}
+
+\end_inset
+
+
+\begin_inset LatexCommand \index{pedantic}
+
+\end_inset
+
  Actually this is 
 \series bold
 \emph on
@@ -9986,6 +10542,44 @@ splint\InsetSpace ~
 myprogram.c
 \end_layout
 
+\begin_layout List
+\labelwidthstring 00.00.0000
+
+\series bold
+-
+\begin_inset ERT
+status collapsed
+
+\begin_layout Standard
+
+
+\backslash
+/
+\end_layout
+
+\end_inset
+
+-short-is-8bits
+\series default
+
+\begin_inset LatexCommand \index{-\/-short-is-8bits}
+
+\end_inset
+
+
+\begin_inset LatexCommand \label{lyx:--short-is-8bits}
+
+\end_inset
+
+ Treat short as 8-bit (for backward compatibility with older versions of
+ compiler - see section 
+\begin_inset LatexCommand \ref{sec:Compatibility-with-previous}
+
+\end_inset
+
+)
+\end_layout
+
 \begin_layout Standard
 \begin_inset VSpace bigskip
 \end_inset
@@ -11617,7 +12211,7 @@ using
 
 
 \emph default
-) should be used in interrupt
+) should be used for example in interrupt
 \begin_inset LatexCommand \index{interrupt}
 
 \end_inset
@@ -14505,7 +15099,841 @@ MCS51/DS390 Startup Code
 \end_layout
 
 \begin_layout Standard
-The compiler inserts a call to the C routine 
+The compiler triggers the linker to link certain initialization modules
+ from the runtime library
+\begin_inset LatexCommand \index{Runtime library}
+
+\end_inset
+
+ called crt<something>.
+ Only the necessary ones are linked, for instance crtxstack.asm (GSINIT1,
+ GSINIT5) is not linked unless the --xstack option is used.
+ These modules are highly entangled by the use of special segments/areas,
+ but a common layout is shown below:
+\end_layout
+
+\begin_layout Verse
+
+\family typewriter
+\series bold
+\size footnotesize
+(main.asm)
+\end_layout
+
+\begin_layout Verse
+
+\family typewriter
+\size footnotesize
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+.area HOME (CODE)
+\newline
+__interrupt_vect:
+\newline
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+ljmp __sdcc_gsinit_startup
+\end_layout
+
+\begin_layout Verse
+
+\family typewriter
+\series bold
+\size footnotesize
+(crtstart.asm)
+\end_layout
+
+\begin_layout Verse
+
+\family typewriter
+\size footnotesize
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+.area GSINIT0 (CODE)
+\newline
+__sdcc_gsinit_startup::
+\newline
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+mov sp,#__start__stack - 1
+\end_layout
+
+\begin_layout Verse
+
+\family typewriter
+\series bold
+\size footnotesize
+(crtxstack.asm)
+\end_layout
+
+\begin_layout Verse
+
+\family typewriter
+\size footnotesize
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+.area GSINIT1 (CODE)
+\newline
+__sdcc_init_xstack::
+\newline
+; Need to initialize in GSINIT1 in
+ case the user's __sdcc_external_startup uses the xstack.
+\newline
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+mov __XPAGE,#(__start__x
+stack >> 8)
+\newline
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+mov _spx,#__start__xstack
+\end_layout
+
+\begin_layout Verse
+
+\family typewriter
+\series bold
+\size footnotesize
+(crtstart.asm)
+\end_layout
+
+\begin_layout Verse
+
+\family typewriter
+\size footnotesize
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+.area GSINIT2 (CODE)
+\newline
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+lcall __sdcc_external_startup
+\newline
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+mov a,dpl
+\newline
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+jz __sdcc_init_data
+\newline
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+ljmp
+ __sdcc_program_startup
+\newline
+__sdcc_init_data:
+\end_layout
+
+\begin_layout Verse
+
+\family typewriter
+\series bold
+\size footnotesize
+(crtxinit.asm)
+\end_layout
+
+\begin_layout Verse
+
+\family typewriter
+\size footnotesize
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+.area GSINIT3 (CODE)
+\newline
+__mcs51_genXINIT::
+\newline
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+mov r1,#l_XINIT
+\newline
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+mov a,r1
+\newline
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+orl a,#(l_XINIT
+ >> 8)
+\newline
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+jz 00003$
+\newline
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+mov r2,#((l_XINIT+255) >> 8)
+\newline
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+mov dptr,#s_XINIT
+\newline
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+mov r0,#s_XISEG
+\newline
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+mov
+ __XPAGE,#(s_XISEG >> 8)
+\newline
+00001$:\InsetSpace ~
+clr a
+\newline
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+movc a,@a+dptr
+\newline
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+movx @r0,a
+\newline
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+inc dptr
+\newline
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+inc
+ r0
+\newline
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+cjne r0,#0,00002$
+\newline
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+inc __XPAGE
+\newline
+00002$:\InsetSpace ~
+djnz r1,00001$
+\newline
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+djnz r2,00001$
+\newline
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+mov __XPAGE,#0
+xFF
+\newline
+00003$:
+\end_layout
+
+\begin_layout Verse
+
+\family typewriter
+\series bold
+\size footnotesize
+(crtclear.asm)
+\end_layout
+
+\begin_layout Verse
+
+\family typewriter
+\size footnotesize
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+.area GSINIT4 (CODE)
+\newline
+__mcs51_genRAMCLEAR::
+\newline
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+clr a
+\newline
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+mov r0,#(l_IRAM-1)
+\newline
+00004$:\InsetSpace ~
+mov
+ @r0,a
+\newline
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+djnz r0,00004$
+\newline
+; _mcs51_genRAMCLEAR() end
+\end_layout
+
+\begin_layout Verse
+
+\family typewriter
+\series bold
+\size footnotesize
+(crtxclear.asm)
+\end_layout
+
+\begin_layout Verse
+
+\family typewriter
+\size footnotesize
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+.area GSINIT4 (CODE)
+\newline
+__mcs51_genXRAMCLEAR::
+\newline
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+mov r0,#l_PSEG
+\newline
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+mov a,r0
+\newline
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+jz 00006$
+\newline
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+mov
+ r1,#s_PSEG
+\newline
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+mov __XPAGE,#(s_PSEG >> 8)
+\newline
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+clr a
+\newline
+00005$:\InsetSpace ~
+movx @r1,a
+\newline
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+inc r1
+\newline
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+djnz r0,00005$
+\newline
+0
+0006$:
+\newline
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+mov r0,#l_XSEG
+\newline
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+mov a,r0
+\newline
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+orl a,#(l_XSEG >> 8)
+\newline
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+jz 00008$
+\newline
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+mov r1,#((l_XSEG
+ + 255) >> 8)
+\newline
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+mov dptr,#s_XSEG
+\newline
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+clr a
+\newline
+00007$:\InsetSpace ~
+movx @dptr,a
+\newline
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+inc dptr
+\newline
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+djnz r0,00007$
+\newline
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+djnz
+ r1,00007$
+\newline
+00008$:
+\end_layout
+
+\begin_layout Verse
+
+\family typewriter
+\series bold
+\size footnotesize
+(crtxstack.asm)
+\end_layout
+
+\begin_layout Verse
+
+\family typewriter
+\size footnotesize
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+.area GSINIT5 (CODE)
+\newline
+; Need to initialize in GSINIT5 because __mcs51_genXINIT
+ modifies __XPAGE
+\newline
+; and __mcs51_genRAMCLEAR modifies _spx.
+\newline
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+mov __XPAGE,#(__start__x
+stack >> 8)
+\newline
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+mov _spx,#__start__xstack
+\end_layout
+
+\begin_layout Verse
+
+\family typewriter
+\series bold
+\size footnotesize
+(application modules)
+\end_layout
+
+\begin_layout Verse
+
+\family typewriter
+\size footnotesize
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+.area GSINIT (CODE)
+\end_layout
+
+\begin_layout Verse
+
+\family typewriter
+\series bold
+\size footnotesize
+(main.asm)
+\end_layout
+
+\begin_layout Verse
+
+\family typewriter
+\size footnotesize
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+.area GSFINAL (CODE)
+\newline
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+ljmp __sdcc_program_startup
+\newline
+;---------------------------------
+-----------------------
+\newline
+; Home
+\newline
+;--------------------------------------------------
+------
+\newline
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+.area HOME (CODE)
+\newline
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+.area CSEG (CODE)
+\newline
+__sdcc_program_startup:
+\newline
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+lcall _main
+\newline
+;
+ return from main will lock up
+\newline
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+sjmp .
+\end_layout
+
+\begin_layout Standard
+One of these modules (crtstart.asm) contains a call to the C routine 
 \emph on
 _sdcc_external_startup()
 \begin_inset LatexCommand \index{\_sdcc\_external\_startup()}
@@ -14518,18 +15946,17 @@ _sdcc_external_startup()
  
 \series default
 at the start of the CODE area.
- This routine is in the runtime library
+ This routine is also in the runtime library
 \begin_inset LatexCommand \index{Runtime library}
 
 \end_inset
 
-.
- By default this routine returns 0, if this routine returns a non-zero value,
- the static & global variable initialization will be skipped and the function
- main will be invoked.
+ and returns 0 by default.
+ If this routine returns a non-zero value, the static & global variable
+ initialization will be skipped and the function main will be invoked.
  Otherwise static & global variables will be initialized before the function
  main is invoked.
- You could add a 
+ You could add an 
 \emph on
 _sdcc_external_startup()
 \emph default
@@ -14926,7 +16353,11 @@ to_buffer_asm()
 \begin_inset Quotes sld
 \end_inset
 
+
+\series bold
 _asm
+\series default
+
 \begin_inset Quotes srd
 \end_inset
 
@@ -14934,8 +16365,25 @@ _asm
 \begin_inset Quotes sld
 \end_inset
 
+
+\series bold
 _endasm;
+\series default
+
 \begin_inset Quotes srd
+\end_inset
+
+
+\begin_inset Foot
+status open
+
+\begin_layout Standard
+Note, that the single underscore form (_asm and _endasm) are not C99-compatible,
+ and for C-99 compatibility, the double-underscore form (__asm and __endasm)
+ has to be used.
+ The latter is also used in the library functions.
+\end_layout
+
 \end_inset
 
  to the beginning and the end of the function body:
@@ -15425,7 +16873,7 @@ The inline assembler code can contain any valid code understood by the assembler
 \end_inset
 
  or online at 
-\begin_inset LatexCommand \url{http://svn.sourceforge.net/viewvc/*checkout*/sdcc/trunk/sdcc/as/doc/asxhtm.html}
+\begin_inset LatexCommand \url{http://sdcc.svn.sourceforge.net/viewvc/*checkout*/sdcc/trunk/sdcc/as/doc/asxhtm.html}
 
 \end_inset
 
@@ -15903,16 +17351,12 @@ Use of Labels within Inline Assembler
 SDCC allows the use of in-line assembler with a few restrictions regarding
  labels.
  In older versions of the compiler all labels defined within inline assembler
- code 
-\emph on
-had to be
-\emph default
- of the form 
+ code had to be of the form 
 \emph on
 nnnnn$
 \emph default
- where nnnn is a number less than 100 (which implies a limit of utmost 100
- inline assembler labels 
+ where nnnnn is a number less than 100 (which implies a limit of utmost
100 inline assembler labels 
 \emph on
 per function
 \emph default
@@ -15975,7 +17419,7 @@ _endasm
 \end_layout
 
 \begin_layout Standard
-Inline assembler code cannot reference any C-Labels, however it can reference
+Inline assembler code cannot reference any C-labels, however it can reference
  labels
 \begin_inset LatexCommand \index{Labels}
 
@@ -16127,8 +17571,95 @@ and
 
 
 \emph default
- to pass the first parameter to a routine.
- The second parameter onwards is either allocated on the stack (for reentrant
+ to pass the first parameter to a function, and also to pass the return
+ value 
+\begin_inset LatexCommand \index{return value}
+
+\end_inset
+
+of function; according to the following scheme: one byte return value in
+\emph on
+DPL
+\emph default
+, two byte value in 
+\emph on
+DPL
+\emph default
+ (LSB) and 
+\emph on
+DPH
+\emph default
+ (MSB).
+ three byte values (generic pointers) in 
+\emph on
+DPH
+\emph default
+, 
+\emph on
+DPL
+\emph default
+ and 
+\emph on
+B
+\emph default
+, and four byte values in 
+\emph on
+DPH
+\emph default
+, 
+\emph on
+DPL
+\emph default
+,
+\emph on
+ B
+\emph default
+ and 
+\emph on
+ACC
+\emph default
+.
+ Generic pointers
+\begin_inset LatexCommand \index{generic pointer}
+
+\end_inset
+
+ contain type of accessed memory in 
+\emph on
+B
+\emph default
+: 
+\series bold
+0x00
+\series default
+ -- xdata/far, 
+\series bold
+0x40
+\series default
+ -- idata/near -- , 
+\series bold
+0x60
+\series default
+ -- pdata, 
+\series bold
+0x80
+\series default
+ -- code
+\begin_inset Note Note
+status collapsed
+
+\begin_layout Standard
+This might not be the case of certain memory models (medium???)
+\end_layout
+
+\end_inset
+
+.
+\end_layout
+
+\begin_layout Standard
+The second parameter onwards is either allocated on the stack (for reentrant
  routines or if -
 \begin_inset ERT
 status collapsed
@@ -16142,11 +17673,97 @@ status collapsed
 
 \end_inset
 
--stack-auto is used) or in data / xdata memory (depending on the memory
- model).
+-stack-auto is used) or in data/xdata memory (depending on the memory model).
+\end_layout
+
+\begin_layout Subsection
+Registers usage
+\end_layout
+
+\begin_layout Standard
+Unless the called function is declared as 
+\family typewriter
+_naked
+\family default
+
+\begin_inset LatexCommand \index{naked}
+
+\end_inset
+
+, or the -
+\begin_inset ERT
+status collapsed
+
+\begin_layout Standard
+
+
+\backslash
+/
+\end_layout
+
+\end_inset
+
+-callee-saves
+\begin_inset LatexCommand \index{-\/-callee-saves}
+
+\end_inset
+
+/-
+\begin_inset ERT
+status collapsed
+
+\begin_layout Standard
+
+
+\backslash
+/
+\end_layout
+
+\end_inset
+
+-all-callee-saves command line option or the corresponding callee_saves
+ pragma are used, the caller will save the registers (
+\emph on
+R0-R7
+\emph default
+) around the call, so the called function can destroy they content freely.
+\end_layout
+
+\begin_layout Standard
+If the called function is not declared as 
+\family typewriter
+_naked
+\family default
+, the caller will swap register banks around the call, if caller and callee
+ use different register banks (having them defined by the 
+\family typewriter
+_using
+\family default
+ modifier).
  
 \end_layout
 
+\begin_layout Standard
+The called function can also use 
+\emph on
+DPL
+\emph default
+, 
+\emph on
+DPH
+\emph default
+, 
+\emph on
+B
+\emph default
+ and 
+\emph on
+ACC
+\emph default
+ observing that they are used for parameter/return value passing.
+\end_layout
+
 \begin_layout Subsection
 Assembler Routine (non-reentrant)
 \end_layout
@@ -16332,54 +17949,26 @@ dph
 ret
 \end_layout
 
-\begin_layout Standard
-Note here that the return values
-\begin_inset LatexCommand \index{return value}
-
-\end_inset
-
- are placed in 'dpl' - One byte return value, 'dpl' LSB & 'dph' MSB for
- two byte values.
- 'dpl', 'dph' and 'b' for three byte values (generic pointers) and 'dpl','dph','
-b' & 'acc' for four byte values.
-\end_layout
-
 \begin_layout Standard
 The parameter naming convention is _<function_name>_PARM_<n>, where n is
  the parameter number starting from 1, and counting from the left.
  The first parameter is passed in 
-\begin_inset Quotes eld
-\end_inset
-
-dpl
-\begin_inset Quotes erd
-\end_inset
-
- for a one byte parameter, 
-\begin_inset Quotes eld
-\end_inset
-
-dptr
-\begin_inset Quotes erd
-\end_inset
-
- for two bytes, 
-\begin_inset Quotes eld
-\end_inset
-
-b,dptr
-\begin_inset Quotes erd
-\end_inset
-
- for three bytes and 
-\begin_inset Quotes eld
-\end_inset
-
-acc,b,dptr
-\begin_inset Quotes erd
-\end_inset
-
- for a four bytes parameter.
+\emph on
+DPH
+\emph default
+, 
+\emph on
+DPL
+\emph default
+, 
+\emph on
+B
+\emph default
+ and 
+\emph on
+ACC
+\emph default
+ according to the description above.
  The variable name for the second parameter will be _<function_name>_PARM_2.
 \newline
 
@@ -16432,27 +18021,29 @@ In this case
 
  onwards will be passed on the stack, the parameters are pushed from right
  to left i.e.
- after the call the leftmost parameter will be on the top of the stack.
+ before the call the second leftmost parameter will be on the top of the
+ stack (the leftmost parameter is passed in registers).
  Here is an example:
 \end_layout
 
 \begin_layout Verse
 
 \family typewriter
-extern int asm_func(unsigned char, unsigned char);
+extern int asm_func(unsigned char, unsigned char, unsigned char) reentrant;
 \newline
 
 \newline
-int c_func (unsigned char
i, unsigned char j) reentrant 
+int
c_func (unsigned char i, unsigned char j, unsigned char k) reentrant 
 \newline
-{ 
+{
 \newline
 \InsetSpace ~
 \InsetSpace ~
 \InsetSpace ~
 \InsetSpace ~
-return asm_func(i,j); 
+return asm_func(i,j,k); 
 \newline
 } 
 \newline
@@ -16466,14 +18057,13 @@ int main()
 \InsetSpace ~
 \InsetSpace ~
 \InsetSpace ~
-return
- c_func(10,9); 
+return c_func(10,9,8); 
 \newline
 }
 \end_layout
 
 \begin_layout Standard
-The corresponding assembler routine is:
+The corresponding (unoptimized) assembler routine is:
 \end_layout
 
 \begin_layout Verse
@@ -16487,87 +18077,164 @@ _asm_func:
 \InsetSpace ~
 \InsetSpace ~
 \InsetSpace ~
-push  _bp 
+push\InsetSpace ~
+_bp 
 \newline
 \InsetSpace ~
 \InsetSpace ~
 \InsetSpace ~
 \InsetSpace ~
-mov _bp,sp 
+mov\InsetSpace ~
+\InsetSpace ~
+_bp,sp\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+;stack contains: _bp, return
+ address, second parameter, third parameter
 \newline
 \InsetSpace ~
 \InsetSpace ~
 \InsetSpace ~
 \InsetSpace ~
-mov r2,dpl
+mov\InsetSpace ~
+\InsetSpace ~
+r2,dpl
+\newline
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+mov\InsetSpace ~
+\InsetSpace ~
+a,_bp
 \newline
 \InsetSpace ~
 \InsetSpace ~
 \InsetSpace ~
 \InsetSpace ~
-mov a,_bp 
+add\InsetSpace ~
+\InsetSpace ~
+a,#0xfd\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+;calculate
+ pointer to the second parameter
 \newline
 \InsetSpace ~
 \InsetSpace ~
 \InsetSpace ~
 \InsetSpace ~
-add
- a,#0xfd 
+mov\InsetSpace ~
+\InsetSpace ~
+r0,a 
 \newline
 \InsetSpace ~
 \InsetSpace ~
 \InsetSpace ~
 \InsetSpace ~
-mov r0,a 
+mov\InsetSpace ~
+\InsetSpace ~
+a,_bp 
 \newline
 \InsetSpace ~
 \InsetSpace ~
 \InsetSpace ~
 \InsetSpace ~
-add  a,#0xfc ;?
+add\InsetSpace ~
+\InsetSpace ~
+a,#0xfc\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+;calculate pointer
+ to the rightmost parameter
 \newline
 \InsetSpace ~
 \InsetSpace ~
 \InsetSpace ~
 \InsetSpace ~
-mov  r1,a 
+mov\InsetSpace ~
+\InsetSpace ~
+r1,a 
 \newline
 \InsetSpace ~
 \InsetSpace ~
 \InsetSpace ~
 \InsetSpace ~
-mov  a,@r0 
+mov\InsetSpace ~
+\InsetSpace ~
+a,@r0
 \newline
 \InsetSpace ~
 \InsetSpace ~
 \InsetSpace ~
 \InsetSpace ~
-add  a,r2 ;?
+add\InsetSpace ~
+\InsetSpace ~
+a,@r1
 \newline
 \InsetSpace ~
 \InsetSpace ~
 \InsetSpace ~
 \InsetSpace ~
-mov  dpl,a
+add\InsetSpace ~
+\InsetSpace ~
+a,r2\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+;calculate the
+ result (= sum of all three parameters)
 \newline
 \InsetSpace ~
 \InsetSpace ~
 \InsetSpace ~
 \InsetSpace ~
-mov  dph,#0x00 
+mov\InsetSpace ~
+\InsetSpace ~
+dpl,a\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+;return value goes into dptr
+ (cast into int)
 \newline
 \InsetSpace ~
 \InsetSpace ~
 \InsetSpace ~
 \InsetSpace ~
-mov  sp,_bp 
+mov\InsetSpace ~
+\InsetSpace ~
+dph,#0x00 
 \newline
 \InsetSpace ~
 \InsetSpace ~
 \InsetSpace ~
 \InsetSpace ~
-pop  _bp 
+mov\InsetSpace ~
+\InsetSpace ~
+sp,_bp 
+\newline
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+pop\InsetSpace ~
+\InsetSpace ~
+_bp 
 \newline
 \InsetSpace ~
 \InsetSpace ~
@@ -17301,7 +18968,6 @@ _fs2ulong.
 \emph default
 \bar default
 \noun default
-\color default
 c
 \end_layout
 
@@ -17873,7 +19539,7 @@ and
 not
 \emph default
  support long variables and field widths).
- Be shure to only use only one of these printf options within a project.
+ Be sure to use only one of these printf options within a project.
 \newline
 
 \end_layout
@@ -18238,7 +19904,6 @@ cd
 \emph default
 \bar default
 \noun default
-\color default
 f
 \family roman
 \series medium
 \emph off
 \bar no
 \noun off
-\color none
 i
 \family default
 \series default
 \emph on
 \bar default
 \noun default
-\color default
 o
 \family roman
 \series medium
 \emph off
 \bar no
 \noun off
-\color none
 psux
 \end_layout
 
 \emph on
 \bar default
 \noun default
-\color default
 o
 \family roman
 \series medium
 \emph off
 \bar no
 \noun off
-\color none
 s
 \family default
 \series default
 \emph default
 \bar default
 \noun default
-\color default
 x
 \end_layout
 
@@ -18543,7 +20202,7 @@ float format
 status collapsed
 
 \begin_layout Standard
-Range limited to +/- 4294967040
+Range limited to +/- 4294967040, precision limited to 8 digits past decimal
 \end_layout
 
 \end_inset
@@ -18851,6 +20510,16 @@ small / large
 
 \begin_layout Standard
 0.25 / 0.25 ms
+\begin_inset Foot
+status collapsed
+
+\begin_layout Standard
+printf_tiny integer speed is data dependent, worst case is 0.33 ms
+\end_layout
+
+\end_inset
+
+
 \end_layout
 
 \end_inset
@@ -19103,7 +20772,7 @@ LGPL
 \end_layout
 
 \begin_layout Standard
-\begin_inset Note Comment
+\begin_inset Note Note
 status collapsed
 
 \begin_layout Standard
@@ -19444,7 +21113,22 @@ Pragmas
 \end_layout
 
 \begin_layout Standard
-SDCC supports the following #pragma directives:
+Pragmas are used to turn on and/or off certain compiler options.
+ Some of them are closely related to corresponding command-line options
+ (see section 
+\begin_inset LatexCommand \vref{sec:Command-Line-Options}
+
+\end_inset
+
+).
+\newline
+Pragmas should be placed before and/or after a function, placing pragmas
+ inside a function body could have unpredictable results.
+\newline
+
+\newline
+SDCC supports the
+ following #pragma directives:
 \end_layout
 
 \begin_layout Itemize
@@ -19497,9 +21181,14 @@ callee_saves
 
 \end_inset
 
- function1[,function2[,function3...]] - The compiler by default uses a caller
- saves convention for register saving across function calls, however this
- can cause unnecessary register pushing & popping
+ function1[,function2[,function3...]] 
+\begin_inset LatexCommand \label{ite:callee_saves-function1[,function2[,function3...]]--}
+
+\end_inset
+
+- The compiler by default uses a caller saves convention for register saving
+ across function calls, however this can cause unnecessary register pushing
+ and popping
 \begin_inset LatexCommand \index{push/pop}
 
 \end_inset
@@ -19508,9 +21197,9 @@ callee_saves
  This option can be used to switch off the register saving convention for
  the function names specified.
  The compiler will not save registers when calling these functions, extra
- code need to be manually inserted at the entry & exit for these functions
- to save & restore the registers used by these functions, this can SUBSTANTIALLY
- reduce code & improve run time performance of the generated code.
+ code need to be manually inserted at the entry and exit for these functions
+ to save and restore the registers used by these functions, this can SUBSTANTIAL
+LY reduce code and improve run time performance of the generated code.
  In the future the compiler (with inter procedural analysis) may be able
  to determine the appropriate scheme to use for each function call.
  If -
@@ -19526,8 +21215,12 @@ status collapsed
 
 \end_inset
 
--callee-saves command line option is used, the function names specified
- in #pragma\InsetSpace ~
+-callee-saves command line option is used (see page 
+\begin_inset LatexCommand \vpageref{lyx:--callee-saves-function1[,function2][,function3]...}
+
+\end_inset
+
+), the function names specified in #pragma\InsetSpace ~
 callee_saves
 \begin_inset LatexCommand \index{\#pragma callee\_saves}
 
@@ -19599,12 +21292,124 @@ none
 less_pedantic
 \series default
 
+\begin_inset LatexCommand \index{pedantic}
+
+\end_inset
+
+
 \begin_inset LatexCommand \index{\#pragma less\_pedantic}
 
 \end_inset
 
- - the compiler will not warn you anymore for obvious mistakes, you'r on
- your own now ;-(
+\begin_inset LatexCommand \label{ite:less_pedantic}
+
+\end_inset
+
+- the compiler will not warn you anymore for obvious mistakes, you'r on
+ your own now ;-( .
+ See also the command line option -
+\begin_inset ERT
+status collapsed
+
+\begin_layout Standard
+
+
+\backslash
+/
+\end_layout
+
+\end_inset
+
+-less-pedantic 
+\begin_inset LatexCommand \vpageref{lyx:--less-pedantic}
+
+\end_inset
+
+.
+\newline
+More specifically, the following warnings will be disabled: 
+\shape italic
+comparison is always [true/false] due to limited range of data type
+\shape default
+ (94); 
+\shape italic
+overflow in implicit constant conversion
+\shape default
+ (158); [the (in)famous] 
+\shape italic
+conditional flow changed by optimizer: so said EVELYN the modified DOG
+\shape default
+ (110); 
+\shape italic
+function '[function name]' must return value
+\shape default
+ (59).
+\newline
+Furthermore, warnings of less importance (of PEDANTIC and INFO warning
+ level) are disabled, too, namely: 
+\shape italic
+constant value '[
+\begin_inset Note Note
+status collapsed
+
+\begin_layout Standard
+dunno what comes here - this warning appears to be unused altogether
+\end_layout
+
+\end_inset
+
+]', out of range
+\shape default
+ (81); 
+\shape italic
+[left/right] shifting more than size of object changed to zero
+\shape default
+ (116); 
+\shape italic
+unreachable code
+\shape default
+ (126); 
+\shape italic
+integer overflow in expression
+\shape default
+ (165); 
+\shape italic
+unmatched #pragma save and #pragma restore
+\shape default
+ (170); 
+\shape italic
+comparison of 'signed char' with 'unsigned char' requires promotion to int
+\shape default
+ (185); 
+\shape italic
+ISO C90 does not support flexible array members
+\shape default
+ (187); 
+\shape italic
+extended stack by [number] bytes for compiler temp(s) :in function '[function\InsetSpace ~
+nam
+e]':\InsetSpace ~
+[
+\begin_inset Note Note
+status collapsed
+
+\begin_layout Standard
+appears to be always blank - what was supposed to be here?
+\end_layout
+
+\end_inset
+
+]
+\shape default
+ (114); 
+\shape italic
+function '[function name]', # edges [number] , # nodes [number] , cyclomatic
+ complexity [number]
+\shape default
+ (121).
 \end_layout
 
 \begin_layout Itemize
@@ -19956,14 +21761,45 @@ The preprocessor SDCPP
 pedantic_parse_number
 \series default
 
+\begin_inset LatexCommand \index{pedantic}
+
+\end_inset
+
+
 \begin_inset LatexCommand \index{\#pragma pedantic\_parse\_number}
 
 \end_inset
 
- (+ | -) - Pedantic parse numbers so that situations like 0xfe-LO_B(3) are
- parsed properly and the macro LO_B(3) gets expanded.
+ (+ | -) 
+\begin_inset LatexCommand \label{ite:pedantic_parse_number}
+
+\end_inset
+
+- Pedantic parse numbers so that situations like 0xfe-LO_B(3) are parsed
+ properly and the macro LO_B(3) gets expanded.
  Default is off.
- Below is an example on how to use this pragma.
+ See also the -
+\begin_inset ERT
+status collapsed
+
+\begin_layout Standard
+
+
+\backslash
+/
+\end_layout
+
+\end_inset
+
+-pedantic-parse-number command line option 
+\begin_inset LatexCommand \vpageref{lyx:-pedantic-parse-number}
+
+\end_inset
+
+.
+\newline
+Below is an example on how to use this pragma.
 
 \emph on
  Note: this functionality is not in conformance with standard!
@@ -20160,14 +21996,13 @@ _endasm;
 \end_layout
 
 \begin_layout Standard
-The pragma's are intended to be used to turn-on or off certain optimizations
- which might cause the compiler to generate extra stack / data space to
- store compiler generated temporary variables.
+Some of the pragmas are intended to be used to turn-on or off certain optimizati
+ons which might cause the compiler to generate extra stack and/or data space
to store compiler generated temporary variables.
  This usually happens in large functions.
  Pragma directives should be used as shown in the following example, they
- are used to control options & optimizations for a given function; pragmas
- should be placed before and/or after a function, placing pragma's inside
- a function body could have unpredictable results.
+ are used to control options and optimizations for a given function.
 \end_layout
 
 \begin_layout Verse
@@ -20747,19 +22582,37 @@ sfr
 \begin_layout Verse
 
 \family typewriter
-__sfr __at (0x92) _XPAGE; /* Cypress EZ-USB family */
+__sfr __at (0x85) _XPAGE; /* Ramtron VRS51 family a.k.a.
+ MPAGE */
+\end_layout
+
+\begin_layout Verse
+
+\family typewriter
+__sfr __at (0x92) _XPAGE; /* Cypress EZ-USB family, Texas Instruments (Chipcon)
+ a.k.a.
+ MPAGE */
+\end_layout
+
+\begin_layout Verse
+
+\family typewriter
+__sfr __at (0x91) _XPAGE; /* Infineon (Siemens) C500 family a.k.a.
+ XPAGE */
 \end_layout
 
 \begin_layout Verse
 
 \family typewriter
-__sfr __at (0xaf) _XPAGE; /* some Silicon Labs (Cygnal) chips */
+__sfr __at (0xaf) _XPAGE; /* some Silicon Labs (Cygnal) chips a.k.a.
+ EMI0CN */
 \end_layout
 
 \begin_layout Verse
 
 \family typewriter
-__sfr __at (0xaa) _XPAGE; /* some Silicon Labs (Cygnal) chips */
+__sfr __at (0xaa) _XPAGE; /* some Silicon Labs (Cygnal) chips a.k.a.
+ EMI0CN */
 \end_layout
 
 \begin_layout Standard
@@ -20917,10 +22770,6 @@ The HC08 port passes the regression test suite (see section
 \end_inset
 
 
-\end_layout
-
-\begin_layout Standard
-
 \newpage
 
 \end_layout
@@ -20930,33 +22779,92 @@ The PIC14 port
 \end_layout
 
 \begin_layout Standard
-The 14bit PIC
-\begin_inset LatexCommand \index{PIC14}
+The PIC14 port adds support for Microchip(TM)'s 14
+\begin_inset ERT
+status open
+
+\begin_layout Standard
+
+
+\backslash
+,
+\end_layout
 
 \end_inset
 
- port still requires a major effort from the development community.
- However it can work for simple code.
- It passes its (smaller set of) regression tests
-\begin_inset LatexCommand \index{Regression test (PIC14)}
+bit PIC
+\begin_inset LatexCommand \index{PIC14}
 
 \end_inset
 
- in the directory 
-\shape italic
-sdcc/src/regression
-\shape default
-.
+ MCUs.
+ This port is not yet mature and still lacks many features.
+ However, it can work for simple code.
+\end_layout
+
+\begin_layout Standard
+Currently supported devices include:
+\end_layout
+
+\begin_layout Standard
+12F: 629, 635, 675, 683
+\end_layout
+
+\begin_layout Standard
+16C: 432, 433
+\end_layout
+
+\begin_layout Standard
+16C: 554, 557, 558
+\end_layout
+
+\begin_layout Standard
+16C: 62, 620, 620a, 621, 621a, 622, 622a, 63a, 65b
+\end_layout
+
+\begin_layout Standard
+16C: 71, 710, 711, 715, 717, 72, 73b, 745, 74b, 765, 770, 771, 773, 774,
+ 781, 782
+\end_layout
+
+\begin_layout Standard
+16C: 925, 926
+\end_layout
+
+\begin_layout Standard
+16F: 627, 627a, 628, 628a, 630, 636, 639, 648a, 676, 684, 685, 687, 688,
+ 689, 690
+\end_layout
+
+\begin_layout Standard
+16F: 716, 72, 73, 737, 74, 76, 767, 77, 777, 785
+\end_layout
+
+\begin_layout Standard
+16F: 818, 819, 84, 84a, 87, 870, 871, 872, 873, 873a, 874, 874a, 876, 876a,
+ 877, 877a, 88
+\end_layout
+
+\begin_layout Standard
+16F: 913, 914, 916, 917
+\end_layout
+
+\begin_layout Standard
+An up-to-date list of currently supported devices can be obtained via 
+\family typewriter
+sdcc -mpic14 -phelp foo.c
+\family default
+ (foo.c must exist...).
 \end_layout
 
 \begin_layout Subsection
-C code and 14bit PIC code page
+PIC Code Pages
 \begin_inset LatexCommand \index{code page (pic14)}
 
 \end_inset
 
- and RAM banks
-\begin_inset LatexCommand \index{RAM bank (pic14)}
+ and Memory Banks
+\begin_inset LatexCommand \index{Memory bank (pic14)}
 
 \end_inset
 
@@ -20966,52 +22874,112 @@ C code and 14bit PIC code page
 \begin_layout Standard
 The linker organizes allocation for the code page and RAM banks.
  It does not have intimate knowledge of the code flow.
- It will put all the code section of a single asm file into a single code
+ It will put all the code section of a single .asm file into a single code
  page.
  In order to make use of multiple code pages, separate asm files must be
  used.
- The compiler treats all functions of a single C file as being in the same
- code page unless it is non static.
+ The compiler assigns all 
+\emph on
+static
+\emph default
+ functions of a single .c file into the same code page.
 \newline
 
 \newline
-To get the best follow these guide lines:
+To get the best results,
+ follow these guidelines:
 \end_layout
 
 \begin_layout Enumerate
 Make local functions static, as non static functions require code page selection
  overhead.
+\newline
+Due to the way sdcc handles functions, place called functions prior
+ to calling functions in the file wherever possible: Otherwise sdcc will
+ insert unneccessary pagesel directives around the call, believing that
+ the called function is externally defined.
 \end_layout
 
 \begin_layout Enumerate
 For devices that have multiple code pages it is more efficient to use the
- same number of files as pages, i.e.
- for the 16F877 use 4 separate files and i.e.
- for the 16F874 use 2 separate files.
+ same number of files as pages: Use up to 4 separate .c files for the 16F877,
+ but only 2 files for the 16F874.
  This way the linker can put the code for each file into different code
- pages and there's less page selection overhead.
+ pages and there will be less page selection overhead.
 \end_layout
 
 \begin_layout Enumerate
- And as for any 8 bit micro (especially for PIC 14 as they have a very simple
- instruction set), use 'unsigned char' whereever possible instead of 'int'.
+And as for any 8 bit micro (especially for PIC14 as they have a very simple
+ instruction set), use 'unsigned char' wherever possible instead of 'int'.
 \end_layout
 
 \begin_layout Subsection
-Creating a device include file 
+Adding New Devices to the Port 
 \end_layout
 
 \begin_layout Standard
-For generating a device include file
-\begin_inset LatexCommand \index{PIC14!Header files}
+Adding support for a new 14
+\begin_inset ERT
+status open
+
+\begin_layout Standard
+
+
+\backslash
+,
+\end_layout
 
 \end_inset
 
- use the support perl script inc2h.pl kept in directory support/script.
+bit PIC MCU requires the following steps:
+\end_layout
+
+\begin_layout Enumerate
+Create a new device description.
+\newline
+Each device is described in two files: pic16f*.h
+ and pic16f*.c.
+ These files primarily define SFRs, structs to access their bits, and symbolic
+ configuration options.
+ Both files can be generated from gputils' .inc files using the perl script
+\family typewriter
+support/scripts/inc2h.pl
+\family default
+.
+ This file also contains further instructions on how to proceed.
+\end_layout
+
+\begin_layout Enumerate
+Copy the .h file into SDCC's include path and either add the .c file to your
+ project or copy it to 
+\family typewriter
+device/lib/pic/libdev
+\family default
+.
+ Afterwards, rebuild and install the libraries.
+\end_layout
+
+\begin_layout Enumerate
+Edit pic14devices.txt in SDCC's include path (
+\family typewriter
+device/include/pic/
+\family default
+ in the source tree or 
+\family typewriter
+/usr/local/share/sdcc/include/pic
+\family default
+ after installation).
+\newline
+You need to add a device specification here to make
+ the memory layout (code banks, RAM, aliased memory regions, ...) known to
+ the compiler.
+ Probably you can copy and modify an existing entry.
+ The file format is documented at the top of the file.
 \end_layout
 
 \begin_layout Subsection
-Interrupt code
+Interrupt Code
 \end_layout
 
 \begin_layout Standard
@@ -21040,7 +23008,7 @@ T0IF = 0; /* Clear timer interrupt */
 \end_layout
 
 \begin_layout Subsection
-Linking and assembling
+Linking and Assembling
 \end_layout
 
 \begin_layout Standard
@@ -21050,13 +23018,13 @@ For assembling you can use either GPUTILS'
 \end_inset
 
  gpasm.exe or MPLAB's mpasmwin.exe.
- GPUTILS is available from 
+ GPUTILS are available from 
 \begin_inset LatexCommand \url{http://sourceforge.net/projects/gputils}
 
 \end_inset
 
 .
- For linking you can use either GPUTIL's gplink or MPLAB's mplink.exe.
+ For linking you can use either GPUTILS' gplink or MPLAB's mplink.exe.
  If you use MPLAB and an interrupt function then the linker script file
  vectors section will need to be enlarged to link with mplink.
 \newline
@@ -21082,17 +23050,7 @@ Makefile
 \InsetSpace ~
 \InsetSpace ~
 \InsetSpace ~
-sdcc -S -V -mpic14 -p16F877 $< 
-\newline
-\InsetSpace ~
-\InsetSpace ~
-\InsetSpace ~
-\InsetSpace ~
-\InsetSpace ~
-\InsetSpace ~
-\InsetSpace ~
-\InsetSpace ~
-gpasm -c $*.asm
+sdcc -V -mpic14 -p16f877 -c $< 
 \newline
 
 \newline
@@ -21106,8 +23064,8 @@ $(PRJ).hex: $(OBJS)
 \InsetSpace ~
 \InsetSpace ~
 \InsetSpace ~
-gplink
- -m -s $(PRJ).lkr -o $(PRJ).hex $(OBJS) libsdcc.lib
+gplink -m -s $(PRJ).lkr
+ -o $(PRJ).hex $(OBJS) libsdcc.lib
 \end_layout
 
 \begin_layout Standard
@@ -21131,7 +23089,7 @@ Makefile
 \InsetSpace ~
 \InsetSpace ~
 \InsetSpace ~
-sdcc -S -V -mpic14 -p16F877 $< 
+sdcc -S -V -mpic14 -p16f877 $< 
 \newline
 \InsetSpace ~
 \InsetSpace ~
@@ -21168,7 +23126,7 @@ Please note that indentations within a
 \end_layout
 
 \begin_layout Subsection
-Command-line options
+Command-Line Options
 \end_layout
 
 \begin_layout Standard
@@ -21189,8 +23147,7 @@ status collapsed
 -help):
 \end_layout
 
-\begin_layout List
-\labelwidthstring 00.00.0000
+\begin_layout Description
 -
 \begin_inset ERT
 status collapsed
@@ -21204,7 +23161,7 @@ status collapsed
 
 \end_inset
 
--debug-extra
+-debug-xtra
 \begin_inset LatexCommand \index{PIC14!Options!-\/-debug-extra}
 
 \end_inset
@@ -21212,8 +23169,7 @@ status collapsed
  emit debug info in assembly output
 \end_layout
 
-\begin_layout List
-\labelwidthstring 00.00.0000
+\begin_layout Description
 -
 \begin_inset ERT
 status collapsed
@@ -21235,8 +23191,7 @@ status collapsed
  disable (slightly faulty) optimization on pCode
 \end_layout
 
-\begin_layout List
-\labelwidthstring 00.00.0000
+\begin_layout Description
 -
 \begin_inset ERT
 status collapsed
@@ -21259,8 +23214,7 @@ status collapsed
  large shared databank to reduce BANKSEL overhead)
 \end_layout
 
-\begin_layout List
-\labelwidthstring 00.00.0000
+\begin_layout Description
 -
 \begin_inset ERT
 status collapsed
@@ -21283,7 +23237,33 @@ status collapsed
 \end_layout
 
 \begin_layout Subsection
-The library
+Environment Variables
+\end_layout
+
+\begin_layout Standard
+The PIC14 port recognizes the following environment variables:
+\end_layout
+
+\begin_layout Description
+SDCC_PIC14_SPLIT_LOCALS If set and not empty, sdcc will allocate each temporary
+ register (the ones called r0xNNNN) in a section of its own.
+ By default (if this variable is unset), sdcc tries to cluster registers
+ in sections in order to reduce the BANKSEL overhead when accessing them.
+\end_layout
+
+\begin_layout Subsection
+The Library
+\end_layout
+
+\begin_layout Standard
+The PIC14 library currently only contains support routines required by the
+ compiler to implement multiplication, division, and floating point support.
+ No libc-like replacement is available at the moment, though many of the
+ common sdcc library sources (in 
+\family typewriter
+device/lib
+\family default
+) should also compile with the PIC14 port.
 \end_layout
 
 \begin_layout Subsubsection
@@ -21331,7 +23311,20 @@ XXX
 
 \begin_layout Standard
 This warning can usually be ignored due to the very good compatibility amongst
- 14 bit PIC
+ 14
+\begin_inset ERT
+status open
+
+\begin_layout Standard
+
+
+\backslash
+,
+\end_layout
+
+\end_inset
+
+bit PIC
 \begin_inset LatexCommand \index{PIC14}
 
 \end_inset
@@ -21351,49 +23344,38 @@ device/lib/pic/Makefile
 \family default
  to reflect your device.
  This might even improve performance for smaller devices as unneccesary
- BANKSELs migth be removed.
+ BANKSELs might be removed.
 \end_layout
 
 \begin_layout Subsection
-Known bugs
+Known Bugs
 \end_layout
 
 \begin_layout Subsubsection
-initialized data
+Function arguments
 \end_layout
 
 \begin_layout Standard
-Currently, data can only be initialized if it resides in the source file
- together with 
-\emph on
-main()
-\emph default
-.
- Data in other source files will silently 
-\series bold
-not
-\series default
- be initialized.
-\family typewriter
-\size footnotesize
-
-\begin_inset Marginal
-status collapsed
-
-\begin_layout Standard
-
-\series bold
-\InsetSpace ~
-!
+Functions with variable argument lists (like printf) are not yet supported.
+ Similarly, taking the argument of the first argument passed into a function
+ does not work: It is currently passed in WREG and has no address...
 \end_layout
 
-\end_inset
-
+\begin_layout Subsubsection
+Regression tests fail
+\end_layout
 
+\begin_layout Standard
+Though the small subset of regression tests in src/regression passes, SDCC
+ regression test suite does not, indicating that there are still major bugs
+ in the port.
+ However, many smaller projects have successfully used SDCC in the past...
 \end_layout
 
 \begin_layout Standard
 
+\size footnotesize
+
 \newpage
 
 \end_layout
@@ -21425,259 +23407,131 @@ The PIC16
 \end_layout
 
 \begin_layout Standard
-\align center
-\begin_inset Tabular
-<lyxtabular version="3" rows="4" columns="6">
-<features>
-<column alignment="center" valignment="top" leftline="true" width="0">
-<column alignment="center" valignment="top" leftline="true" width="0">
-<column alignment="center" valignment="top" leftline="true" width="0">
-<column alignment="center" valignment="top" leftline="true" width="0">
-<column alignment="center" valignment="top" leftline="true" width="0">
-<column alignment="center" valignment="top" leftline="true" rightline="true" width="0">
-<row topline="true">
-<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
-\begin_inset Text
-
-\begin_layout Standard
-18F242
+18F: 242, 248, 252, 258, 442, 448, 452, 458
 \end_layout
 
-\end_inset
-</cell>
-<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
-\begin_inset Text
-
 \begin_layout Standard
-18F248
+18F: 1220, 1320
 \end_layout
 
-\end_inset
-</cell>
-<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
-\begin_inset Text
-
 \begin_layout Standard
-18F252
+18F: 2220, 2221, 2320, 2321, 2331, 2431, 2455, 2525, 2550, 2620
 \end_layout
 
-\end_inset
-</cell>
-<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
-\begin_inset Text
-
 \begin_layout Standard
-18F258
+18F: 4220, 4221, 4320, 4321, 4331, 4431, 4455, 4520, 4525, 4550, 4620
 \end_layout
 
-\end_inset
-</cell>
-<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
-\begin_inset Text
-
 \begin_layout Standard
-18F442
+18F: 6520, 6620, 6680, 6720
 \end_layout
 
-\end_inset
-</cell>
-<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
-\begin_inset Text
-
 \begin_layout Standard
-18F448
+18F: 8520, 8620, 8680, 8720
 \end_layout
 
-\end_inset
-</cell>
-</row>
-<row topline="true">
-<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
-\begin_inset Text
-
-\begin_layout Standard
-18F452
-\end_layout
-
-\end_inset
-</cell>
-<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
-\begin_inset Text
-
-\begin_layout Standard
-18F458
+\begin_layout Subsection
+Global Options
 \end_layout
 
-\end_inset
-</cell>
-<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
-\begin_inset Text
-
 \begin_layout Standard
-18F1220
+PIC16 port supports the standard command line arguments as supposed, with
+ the exception of certain cases that will be mentioned in the following
+ list:
 \end_layout
 
-\end_inset
-</cell>
-<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
-\begin_inset Text
+\begin_layout Description
+-
+\begin_inset ERT
+status collapsed
 
 \begin_layout Standard
-18F2220
-\end_layout
 
-\end_inset
-</cell>
-<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
-\begin_inset Text
 
-\begin_layout Standard
-18F2550
+\backslash
+/
 \end_layout
 
 \end_inset
-</cell>
-<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
-\begin_inset Text
 
-\begin_layout Standard
-18F4331
-\end_layout
+-callee-saves
+\begin_inset LatexCommand \index{PIC16!Options!-\/-callee-saves}
 
 \end_inset
-</cell>
-</row>
-<row topline="true">
-<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
-\begin_inset Text
 
-\begin_layout Standard
-18F4455
-\end_layout
-
-\end_inset
-</cell>
-<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
-\begin_inset Text
+ See -
+\begin_inset ERT
+status collapsed
 
 \begin_layout Standard
-18F6520
-\end_layout
 
-\end_inset
-</cell>
-<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
-\begin_inset Text
 
-\begin_layout Standard
-18F6620
+\backslash
+/
 \end_layout
 
 \end_inset
-</cell>
-<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
-\begin_inset Text
 
-\begin_layout Standard
-18F6680
+-all-callee-saves
 \end_layout
 
-\end_inset
-</cell>
-<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
-\begin_inset Text
+\begin_layout Description
+-
+\begin_inset ERT
+status collapsed
 
 \begin_layout Standard
-18F6720
-\end_layout
 
-\end_inset
-</cell>
-<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
-\begin_inset Text
 
-\begin_layout Standard
-18F8520
+\backslash
+/
 \end_layout
 
 \end_inset
-</cell>
-</row>
-<row topline="true" bottomline="true">
-<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
-\begin_inset Text
 
-\begin_layout Standard
-18F8620
-\end_layout
+-fommit-frame-pointer
+\begin_inset LatexCommand \index{PIC16!Options!-\/-fommit-frame-pointer}
 
 \end_inset
-</cell>
-<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
-\begin_inset Text
 
-\begin_layout Standard
-18F8680
+ Frame pointer will be omitted when the function uses no local variables.
 \end_layout
 
-\end_inset
-</cell>
-<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
-\begin_inset Text
-
-\begin_layout Standard
-18F8720
-\end_layout
+\begin_layout Subsection
+Port Specific Options
+\begin_inset LatexCommand \index{Options PIC16}
 
 \end_inset
-</cell>
-<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
-\begin_inset Text
 
-\begin_layout Standard
 
 \end_layout
 
-\end_inset
-</cell>
-<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
-\begin_inset Text
-
 \begin_layout Standard
-
-\end_layout
-
-\end_inset
-</cell>
-<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
-\begin_inset Text
+The port specific options appear after the global options in the sdcc -
+\begin_inset ERT
+status collapsed
 
 \begin_layout Standard
 
-\end_layout
 
-\end_inset
-</cell>
-</row>
-</lyxtabular>
+\backslash
+/
+\end_layout
 
 \end_inset
 
-
+-help output.
 \end_layout
 
-\begin_layout Subsection
-Global Options
+\begin_layout Subsubsection
+Code Generation Options
 \end_layout
 
 \begin_layout Standard
-PIC16 port supports the standard command line arguments as supposed, with
- the exception of certain cases that will be mentioned in the following
- list:
+These options influence the generated assembler code.
 \end_layout
 
-\begin_layout List
-\labelwidthstring 00.00.0000
+\begin_layout Description
 -
 \begin_inset ERT
 status collapsed
@@ -21691,12 +23545,36 @@ status collapsed
 
 \end_inset
 
--callee-saves
-\begin_inset LatexCommand \index{PIC16!Options!-\/-callee-saves}
+-pstack-model=[model] Used in conjuction with the command above.
+ Defines the stack model to be used, valid stack models are:
+\end_layout
 
-\end_inset
+\begin_deeper
+\begin_layout List
+\labelwidthstring 00.00.0000
 
- See -
+\emph on
+small
+\emph default
+ Selects small stack model.
+ 8 bit stack and frame pointers.
+ Supports 256 bytes stack size.
+\end_layout
+
+\begin_layout List
+\labelwidthstring 00.00.0000
+
+\emph on
+large
+\emph default
+ Selects large stack model.
+ 16 bit stack and frame pointers.
+ Supports 65536 bytes stack size.
+\end_layout
+
+\end_deeper
+\begin_layout Description
+-
 \begin_inset ERT
 status collapsed
 
@@ -21709,11 +23587,10 @@ status collapsed
 
 \end_inset
 
--all-callee-saves
+-pno-banksel Do not generate BANKSEL assembler directives.
 \end_layout
 
-\begin_layout List
-\labelwidthstring 00.00.0000
+\begin_layout Description
 -
 \begin_inset ERT
 status collapsed
@@ -21727,19 +23604,15 @@ status collapsed
 
 \end_inset
 
--all-callee-saves
-\begin_inset LatexCommand \index{PIC16!Options!-\/-all-callee-saves}
-
-\end_inset
+-extended Enable extended instruction set/literal offset addressing mode.
+ Use with care!
+\end_layout
 
- All function arguments are passed on stack by default.
-\emph on
-There is no need to specify this in the command line.
+\begin_layout Subsubsection
+Optimization Options
 \end_layout
 
-\begin_layout List
-\labelwidthstring 00.00.0000
+\begin_layout Description
 -
 \begin_inset ERT
 status collapsed
@@ -21753,38 +23626,37 @@ status collapsed
 
 \end_inset
 
--fommit-frame-pointer
-\begin_inset LatexCommand \index{PIC16!Options!-\/-fommit-frame-pointer}
-
-\end_inset
+-obanksel=n Set optimization level for inserting BANKSELs.
+\newline
 
- Frame pointer will be omitted when the function uses no local variables.
 \end_layout
 
-\begin_layout Subsection
-Port Specific Options
-\begin_inset LatexCommand \index{Options PIC16}
-
-\end_inset
-
-
+\begin_deeper
+\begin_layout List
+\labelwidthstring 00.00.0000
+0 no optimization
 \end_layout
 
-\begin_layout Standard
-The port specific options appear after the global options in the sdcc --help
- output.
+\begin_layout List
+\labelwidthstring 00.00.0000
+1 checks previous used register and if it is the same then does not emit
+ BANKSEL, accounts only for labels.
 \end_layout
 
-\begin_layout Subsubsection
-General Options
-\end_layout
+\begin_layout List
+\labelwidthstring 00.00.0000
+2 tries to check the location of (even different) symbols and removes BANKSELs
+ if they are in the same bank.
+\newline
 
-\begin_layout Standard
-General options enable certain port features and optimizations.
+\emph on
+Important: There might be problems if the linker script has data sections
+ across bank borders!
 \end_layout
 
-\begin_layout List
-\labelwidthstring 00.00.0000
+\end_deeper
+\begin_layout Description
 -
 \begin_inset ERT
 status collapsed
@@ -21798,36 +23670,11 @@ status collapsed
 
 \end_inset
 
--pstack-model=[model] Used in conjuction with the command above.
- Defines the stack model to be used, valid stack models are : 
-\end_layout
-
-\begin_deeper
-\begin_layout List
-\labelwidthstring 00.00.0000
-
-\emph on
-small
-\emph default
- Selects small stack model.
- 8 bit stack and frame pointers.
- Supports 256 bytes stack size.
-\end_layout
-
-\begin_layout List
-\labelwidthstring 00.00.0000
-
-\emph on
-large
-\emph default
- Selects large stack model.
- 16 bit stack and frame pointers.
- Supports 65536 bytes stack size.
+-denable-peeps Force the usage of peepholes.
+ Use with care.
 \end_layout
 
-\end_deeper
-\begin_layout List
-\labelwidthstring 00.00.0000
+\begin_layout Description
 -
 \begin_inset ERT
 status collapsed
@@ -21841,13 +23688,10 @@ status collapsed
 
 \end_inset
 
--preplace-udata-with=[kword] Replaces the default udata keyword for allocating
- unitialized data variables with [kword].
- Valid keywords are: "udata_acs", "udata_shr", "udata_ovr".
+-optimize-goto Try to use (conditional) BRA instead of GOTO.
 \end_layout
 
-\begin_layout List
-\labelwidthstring 00.00.0000
+\begin_layout Description
 -
 \begin_inset ERT
 status collapsed
@@ -21861,12 +23705,10 @@ status collapsed
 
 \end_inset
 
--ivt-loc <nnnn> positions the Interrupt Vector Table at location <nnnn>.
- Useful for bootloaders.
+-optimize-cmp Try to optimize some compares.
 \end_layout
 
-\begin_layout List
-\labelwidthstring 00.00.0000
+\begin_layout Description
 -
 \begin_inset ERT
 status collapsed
@@ -21880,11 +23722,14 @@ status collapsed
 
 \end_inset
 
--asm= sets the full path and name of an external assembler to call.
+-optimize-df Analyze the dataflow of the generated code and improve it.
+\end_layout
+
+\begin_layout Subsubsection
+Assembling Options
 \end_layout
 
-\begin_layout List
-\labelwidthstring 00.00.0000
+\begin_layout Description
 -
 \begin_inset ERT
 status collapsed
@@ -21898,11 +23743,10 @@ status collapsed
 
 \end_inset
 
--link= sets the full path and name of an external linker to call.
+-asm= Sets the full path and name of an external assembler to call.
 \end_layout
 
-\begin_layout List
-\labelwidthstring 00.00.0000
+\begin_layout Description
 -
 \begin_inset ERT
 status collapsed
@@ -21926,29 +23770,10 @@ status collapsed
 \end_layout
 
 \begin_layout Subsubsection
-Optimization Options
-\end_layout
-
-\begin_layout List
-\labelwidthstring 00.00.0000
--
-\begin_inset ERT
-status collapsed
-
-\begin_layout Standard
-
-
-\backslash
-/
-\end_layout
-
-\end_inset
-
--optimize-goto Try to use (conditional) BRA instead of GOTO
+Linking Options
 \end_layout
 
-\begin_layout List
-\labelwidthstring 00.00.0000
+\begin_layout Description
 -
 \begin_inset ERT
 status collapsed
@@ -21962,11 +23787,10 @@ status collapsed
 
 \end_inset
 
--optimize-cmp Try to optimize some compares.
+-link= Sets the full path and name of an external linker to call.
 \end_layout
 
-\begin_layout List
-\labelwidthstring 00.00.0000
+\begin_layout Description
 -
 \begin_inset ERT
 status collapsed
@@ -21980,11 +23804,12 @@ status collapsed
 
 \end_inset
 
--optimize-df Analyze the dataflow of the generated code and improve it.
+-preplace-udata-with=[kword] Replaces the default udata keyword for allocating
+ unitialized data variables with [kword].
+ Valid keywords are: "udata_acs", "udata_shr", "udata_ovr".
 \end_layout
 
-\begin_layout List
-\labelwidthstring 00.00.0000
+\begin_layout Description
 -
 \begin_inset ERT
 status collapsed
@@ -21998,42 +23823,15 @@ status collapsed
 
 \end_inset
 
--obanksel=nn Set optimization level for inserting BANKSELs.
-\newline
-
-\end_layout
-
-\begin_deeper
-\begin_layout List
-\labelwidthstring 00.00.0000
-0 no optimization
-\end_layout
-
-\begin_layout List
-\labelwidthstring 00.00.0000
-1 checks previous used register and if it is the same then does not emit
- BANKSEL, accounts only for labels.
-\end_layout
-
-\begin_layout List
-\labelwidthstring 00.00.0000
-2 tries to check the location of (even different) symbols and removes BANKSELs
- if they are in the same bank.
-\newline
-
+-ivt-loc=n Place the interrupt vector table at address 
 \emph on
-Important: There might be problems if the linker script has data sections
- across bank borders!
-\end_layout
-
-\end_deeper
-\begin_layout Subsubsection
-Linking Options
+n
+\emph default
+.
+ Useful for bootloaders.
 \end_layout
 
-\begin_layout List
-\labelwidthstring 00.00.0000
+\begin_layout Description
 -
 \begin_inset ERT
 status collapsed
@@ -22047,11 +23845,10 @@ status collapsed
 
 \end_inset
 
--nodefaultlibs do not link default libraries when linking
+-nodefaultlibs Do not link default libraries when linking.
 \end_layout
 
-\begin_layout List
-\labelwidthstring 00.00.0000
+\begin_layout Description
 -
 \begin_inset ERT
 status collapsed
@@ -22065,11 +23862,10 @@ status collapsed
 
 \end_inset
 
--no-crt Don't link the default run-time modules
+-use-crt= Use a custom run-time module instead of the defaults.
 \end_layout
 
-\begin_layout List
-\labelwidthstring 00.00.0000
+\begin_layout Description
 -
 \begin_inset ERT
 status collapsed
@@ -22083,7 +23879,7 @@ status collapsed
 
 \end_inset
 
--use-crt= Use a custom run-time module instead of the defaults.
+-no-crt Don't link the default run-time modules
 \end_layout
 
 \begin_layout Subsubsection
@@ -22094,8 +23890,7 @@ Debugging Options
 Debugging options enable extra debugging information in the output files.
 \end_layout
 
-\begin_layout List
-\labelwidthstring 00.00.0000
+\begin_layout Description
 -
 \begin_inset ERT
 status collapsed
@@ -22130,8 +23925,7 @@ status collapsed
 , but dumps more information.
 \end_layout
 
-\begin_layout List
-\labelwidthstring 00.00.0000
+\begin_layout Description
 -
 \begin_inset ERT
 status collapsed
@@ -22147,11 +23941,10 @@ status collapsed
 
 -debug-ralloc Force register allocator to dump <source>.d file with debugging
  information.
- <source> is the name of the file compiled.
+ <source> is the name of the file being compiled.
 \end_layout
 
-\begin_layout List
-\labelwidthstring 00.00.0000
+\begin_layout Description
 -
 \begin_inset ERT
 status collapsed
@@ -22168,27 +23961,7 @@ status collapsed
 -pcode-verbose Enable pcode debugging information in translation.
 \end_layout
 
-\begin_layout List
-\labelwidthstring 00.00.0000
--
-\begin_inset ERT
-status collapsed
-
-\begin_layout Standard
-
-
-\backslash
-/
-\end_layout
-
-\end_inset
-
--denable-peeps Force the usage of peepholes.
- Use with care.
-\end_layout
-
-\begin_layout List
-\labelwidthstring 00.00.0000
+\begin_layout Description
 -
 \begin_inset ERT
 status collapsed
@@ -22202,11 +23975,10 @@ status collapsed
 
 \end_inset
 
--gstack Trace push/pops for stack pointer overflow
+-calltree Dump call tree in .calltree file.
 \end_layout
 
-\begin_layout List
-\labelwidthstring 00.00.0000
+\begin_layout Description
 -
 \begin_inset ERT
 status collapsed
@@ -22220,11 +23992,11 @@ status collapsed
 
 \end_inset
 
--call-tree dump call tree in .calltree file
+-gstack Trace push/pops for stack pointer overflow.
 \end_layout
 
 \begin_layout Subsection
-Enviromental Variables
+Enviroment Variables
 \end_layout
 
 \begin_layout Standard
@@ -22238,26 +24010,24 @@ abled at will.
 Currently there is only two such variables available:
 \end_layout
 
-\begin_layout List
-\labelwidthstring 00.00.0000
-OPTIMIZE_BITFIELD_POINTER_GET when this variable exists reading of structure
+\begin_layout Description
+OPTIMIZE_BITFIELD_POINTER_GET When this variable exists, reading of structure
  bitfields is optimized by directly loading FSR0 with the address of the
  bitfield structure.
  Normally SDCC will cast the bitfield structure to a bitfield pointer and
  then load FSR0.
- This step saves data ram and code space for functions that perform heavy
use of bitfields.
- (ie.
80 bytes of code space are saved when compiling malloc.c with this option).
+ This step saves data ram and code space for functions that make heavy use
+ of bitfields.
+ (i.e., 80 bytes of code space are saved when compiling malloc.c with this
+ option).
  
 \end_layout
 
-\begin_layout List
-\labelwidthstring 00.00.0000
-NO_REG_OPT do not perform pCode registers optimization.
+\begin_layout Description
+NO_REG_OPT Do not perform pCode registers optimization.
  This should be used for debugging purposes.
- In some where bugs in the pcode optimizer are found, users can benefit
from temporarily disabling the optimizer until the bug is fixed.
+ If bugs in the pcode optimizer are found, users can benefit from temporarily
+ disabling the optimizer until the bug is fixed.
 \end_layout
 
 \begin_layout Subsection
@@ -22697,7 +24467,7 @@ Pragmas
 \end_layout
 
 \begin_layout Standard
-PIC16
+The PIC16
 \begin_inset LatexCommand \index{PIC16}
 
 \end_inset
@@ -22705,21 +24475,15 @@ PIC16
  port currently supports the following pragmas:
 \end_layout
 
-\begin_layout List
-\labelwidthstring 00.00.0000
+\begin_layout Description
 stack
 \begin_inset LatexCommand \index{PIC16!Pragmas!\#pragma stack}
 
 \end_inset
 
- pragma stack
-\begin_inset LatexCommand \index{PIC16!stack}
-
-\end_inset
-
- forces the code generator to initialize the stack & frame pointers at a
- specific address.
- This is an adhoc solution for cases where no STACK directive is available
+ This forces the code generator to initialize the stack & frame pointers
+ at a specific address.
+ This is an ad hoc solution for cases where no STACK directive is available
  in the linker script or gplink is not instructed to create a stack section.
 \newline
 The
@@ -22742,10 +24506,14 @@ The old format (ie.
 
 \newline
 The format is as follows:
+\newline
+
 \end_layout
 
 \begin_layout LyX-Code
 #pragma stack bottom_address [stack_size]
+\newline
+
 \end_layout
 
 \begin_layout Standard
@@ -22780,14 +24548,13 @@ If the stack_size field is omitted then a stack is created with the default
  with deep function nesting or excessive stack usage.
 \end_layout
 
-\begin_layout List
-\labelwidthstring 00.00.0000
+\begin_layout Description
 code
 \begin_inset LatexCommand \index{PIC16!Pragmas!\#pragma code}
 
 \end_inset
 
- place a function symbol at static FLASH address
+ Force a function to a static FLASH address.
 \end_layout
 
 \begin_layout LyX-Code
@@ -22810,8 +24577,7 @@ Example:
 
 \end_layout
 
-\begin_layout List
-\labelwidthstring 00.00.0000
+\begin_layout Description
 library instructs the linker to use a library module.
 \newline
 Usage:
@@ -23061,10 +24827,9 @@ ignore
  keyword will reject all modules specified by the library pragma.
 \end_layout
 
-\begin_layout List
-\labelwidthstring 00.00.0000
-udata pragma udata instructs the compiler to emit code so that linker will
- place a variable at a specific memory bank
+\begin_layout Description
+udata The pragma udata instructs the compiler to emit code so that linker
+ will place a variable at a specific memory bank.
 \end_layout
 
 \begin_layout LyX-Code
@@ -23295,7 +25060,7 @@ Before using SDCC/pic16 there are some libraries that need to be compiled.
 \end_layout
 
 \begin_layout Standard
-The steps to compile the pic16 libraries under Linux are:
+The steps to compile the pic16 libraries under Linux and Mac OS X are:
 \end_layout
 
 \begin_layout LyX-Code
@@ -23354,6 +25119,118 @@ device/lib/pic16/pics.build
 make lib-io
 \end_layout
 
+\begin_layout Subsection
+Adding New Devices to the Port
+\end_layout
+
+\begin_layout Standard
+Adding support for a new 16
+\begin_inset ERT
+status open
+
+\begin_layout Standard
+
+
+\backslash
+,
+\end_layout
+
+\end_inset
+
+bit PIC MCU requires the following steps:
+\end_layout
+
+\begin_layout Enumerate
+Create picDEVICE.c and picDEVICE.h from pDEVICE.inc using
+\newline
+
+\family typewriter
+perl /path/to/sdcc/support/scripts/inc2h-pic16.pl /path/to/gputils/header/pDEVICE.
+inc
+\end_layout
+
+\begin_layout Enumerate
+
+\family typewriter
+mv picDEVICE.h /path/to/sdcc/device/include/pic16
+\end_layout
+
+\begin_layout Enumerate
+
+\family typewriter
+mv picDEVICE.c /path/to/sdcc/device/lib/pic16/libdev
+\end_layout
+
+\begin_layout Enumerate
+Add DEVICE to 
+\family typewriter
+/path/to/sdcc/device/lib/pics.all
+\family default
+ (and 
+\family typewriter
+.build
+\family default
+).
+\newline
+Note: No 18f prefix here!
+\end_layout
+
+\begin_layout Enumerate
+Adjust 
+\family typewriter
+/path/to/sdcc/device/lib/pic16/libio/*.ignore
+\family default
+
+\newline
+Add your DEVICE if it does not compile in 
+\family typewriter
+adc
+\family default
+, 
+\family typewriter
+i2c
+\family default
+, or 
+\family typewriter
+usart
+\family default
+.
+\end_layout
+
+\begin_layout Enumerate
+Edit 
+\family typewriter
+/path/to/sdcc/device/include/pic16/pic18fregs.h
+\family default
+.
+ The file format is self-explanatory, just add
+\newline
+
+\family typewriter
+#elif defined(picDEVICE)
+\newline
+# include <picDEVICE.h>
+\family default
+
+\newline
+at the right place (keep it sorted).
+\end_layout
+
+\begin_layout Enumerate
+Edit 
+\family typewriter
+/path/to/sdcc/src/pic16/devices.inc
+\family default
+.
+ Copy and modify an existing entry and insert it at the correct place (keep
+ the file sorted).
+ The file is hardly documented, look at the entries for the 18f2221...
+\end_layout
+
+\begin_layout Enumerate
+Recompile SDCC, including the pic16 libraries.
+\end_layout
+
 \begin_layout Subsection
 Memory Models
 \end_layout
@@ -23518,13 +25395,11 @@ The stack
  FSR2.
 \end_layout
 
-\begin_layout List
-\labelwidthstring 00.00.0000
+\begin_layout Description
 FSR1 is assigned as stack pointer
 \end_layout
 
-\begin_layout List
-\labelwidthstring 00.00.0000
+\begin_layout Description
 FSR2 is assigned as frame pointer
 \end_layout
 
@@ -23708,8 +25583,7 @@ In addition to the standard SDCC function keywords, PIC16
  port makes available two more:
 \end_layout
 
-\begin_layout List
-\labelwidthstring 00.00.0000
+\begin_layout Description
 wparam
 \begin_inset LatexCommand \index{PIC16!wparam}
 
@@ -23747,8 +25621,7 @@ void func_wparam(int a) wparam
 }
 \end_layout
 
-\begin_layout List
-\labelwidthstring 00.00.0000
+\begin_layout Description
 shadowregs
 \begin_inset LatexCommand \index{PIC16!shadowregs}
 
@@ -24907,8 +26780,7 @@ In the libc library there exist the functions that are used to write to
  These are
 \end_layout
 
-\begin_layout List
-\labelwidthstring 00.00.0000
+\begin_layout Description
 _
 \begin_inset ERT
 status collapsed
@@ -24925,8 +26797,7 @@ status collapsed
 _stream_usart_putchar writes a character at the USART stream
 \end_layout
 
-\begin_layout List
-\labelwidthstring 00.00.0000
+\begin_layout Description
 _
 \begin_inset ERT
 status collapsed
@@ -24943,8 +26814,7 @@ status collapsed
 _stream_mssp_putchar writes a character at the MSSP stream
 \end_layout
 
-\begin_layout List
-\labelwidthstring 00.00.0000
+\begin_layout Description
 putchar dummy function.
  This writes a character to a user specified manner.
 \end_layout
@@ -25005,9 +26875,17 @@ void main(void)
 \end_layout
 
 \begin_layout LyX-Code
-    printf (¨This is a printf test
+    printf (
+\begin_inset Quotes sld
+\end_inset
+
+This is a printf test
 \backslash
-n¨);
+n
+\begin_inset Quotes srd
+\end_inset
+
+);
 \end_layout
 
 \begin_layout LyX-Code
@@ -25732,7 +27610,7 @@ status collapsed
 \end_layout
 
 \begin_layout Subsection
-Known bugs
+Known Bugs
 \end_layout
 
 \begin_layout Standard
@@ -25746,19 +27624,10 @@ The PIC16 Port currently does not pass SDCC's regression test
 
 \end_inset
 
-) and thus the nightly regression tests for the PIC16 target are currently
- disabled for all hosts except for 
+) and thus the snapshot build regression tests for the PIC16 target are
+ currently disabled for all hosts
 \emph on
-Linux on Opteron.
-
-\emph default
- This means you can see the result of the PIC16 regression tests f.e.
- by checking the log files in 
-\begin_inset LatexCommand \url{http://sdcc.sourceforge.net/regression_test_results/amd64-unknown-linux2.3/}
-
-\end_inset
-
- (pick the most up to date file there, scroll down, lend a hand).
+.
 \end_layout
 
 \begin_layout Chapter
@@ -25834,7 +27703,7 @@ status collapsed
 
 \end_inset
 
- ) on howto handle syntax extensions like __xdata, __at(), ...
+) on how to handle syntax extensions like __xdata, __at(), ...
  
 \end_layout
 
@@ -26476,7 +28345,7 @@ Interfacing SDCDB with DDD
 \end_layout
 
 \begin_layout Standard
-\begin_inset Note Comment
+\begin_inset Note Note
 status collapsed
 
 \begin_layout Standard
 raphics File 
 \size footnotesize
 
-\begin_inset LatexCommand \url{http://svn.sourceforge.net/viewcvs.cgi/*checkout*/sdcc/trunk/sdcc/doc/figures/ddd_example.png}
+\begin_inset LatexCommand \url{http://sdcc.svn.sourceforge.net/viewvc/*checkout*/sdcc/trunk/sdcc/doc/figures/ddd_example.png}
 
 \end_inset
 
@@ -27463,9 +29332,7 @@ Toggle list mode
 ;; 
 \newline
 
-\end_layout
-
-\begin_layout Standard
+\family default
 
 \newpage
 
@@ -27676,14 +29543,14 @@ check the device specific header files
 \end_inset
 
 > 
-\begin_inset LatexCommand \url{http://svn.sourceforge.net/viewvc/sdcc/trunk/sdcc/device/include/mcs51/compiler.h?view=markup}
+\begin_inset LatexCommand \url{http://sdcc.svn.sourceforge.net/viewvc/sdcc/trunk/sdcc/device/include/mcs51/compiler.h?view=markup}
 
 \end_inset
 
  to allow using common header files.
  (see f.e.
  cc2510fx.h 
-\begin_inset LatexCommand \url{http://svn.sourceforge.net/viewvc/sdcc/trunk/sdcc/device/include/mcs51/cc2510fx.h?view=markup}
+\begin_inset LatexCommand \url{http://sdcc.svn.sourceforge.net/viewvc/sdcc/trunk/sdcc/device/include/mcs51/cc2510fx.h?view=markup}
 
 \end_inset
 
@@ -28418,7 +30285,7 @@ online at:
 
 \newline
 
-\begin_inset LatexCommand \url{http://svn.sourceforge.net/viewvc/*checkout*/sdcc/trunk/sdcc/ChangeLog}
+\begin_inset LatexCommand \url{http://sdcc.svn.sourceforge.net/viewvc/*checkout*/sdcc/trunk/sdcc/ChangeLog}
 
 \end_inset
 
@@ -28476,7 +30343,7 @@ online at:
 
 \newline
 
-\begin_inset LatexCommand \url{http://svn.sourceforge.net/viewvc/*checkout*/sdcc/trunk/sdcc/as/doc/asxhtm.html}
+\begin_inset LatexCommand \url{http://sdcc.svn.sourceforge.net/viewvc/*checkout*/sdcc/trunk/sdcc/as/doc/asxhtm.html}
 
 \end_inset
 
@@ -28553,7 +30420,7 @@ online at:
 
 \newline
 
-\begin_inset LatexCommand \url{http://svn.sourceforge.net/viewvc/sdcc/trunk/sdcc/doc/}
+\begin_inset LatexCommand \url{http://sdcc.svn.sourceforge.net/viewvc/sdcc/trunk/sdcc/doc/}
 
 \end_inset
 
@@ -28594,7 +30461,7 @@ online at
 :
 \newline
 
-\begin_inset LatexCommand \url{http://svn.sourceforge.net/viewvc/*checkout*/sdcc/trunk/sdcc/debugger/README}
+\begin_inset LatexCommand \url{http://sdcc.svn.sourceforge.net/viewvc/*checkout*/sdcc/trunk/sdcc/debugger/README}
 
 \end_inset
 
@@ -28640,7 +30507,6 @@ sdcc/sim/ucsim/doc
 \emph default
 \bar default
 \noun default
-\color default
 /index.html 
 \emph on
 \InsetSpace ~
@@ -28653,7 +30519,7 @@ online at:
 
 \newline
 
-\begin_inset LatexCommand \url{http://svn.sourceforge.net/viewvc/*checkout*/sdcc/trunk/sdcc/sim/ucsim/doc/index.html}
+\begin_inset LatexCommand \url{http://sdcc.svn.sourceforge.net/viewvc/*checkout*/sdcc/trunk/sdcc/sim/ucsim/doc/index.html}
 
 \end_inset
 
@@ -28694,7 +30560,7 @@ online at:
 
 \emph default
 
-\begin_inset LatexCommand \url{http://svn.sourceforge.net/viewvc/*checkout*/sdcc/trunk/sdcc/src/pic16/NOTES}
+\begin_inset LatexCommand \url{http://sdcc.svn.sourceforge.net/viewvc/*checkout*/sdcc/trunk/sdcc/src/pic16/NOTES}
 
 \end_inset
 
@@ -28735,7 +30601,6 @@ cdbfileformat.pd
 \emph default
 \bar default
 \noun default
-\color default
 f
 \emph on
  \InsetSpace ~
@@ -30306,7 +32171,7 @@ You can follow the status of the Subversion version
  in the Subversion repository
 \size footnotesize
  
-\begin_inset LatexCommand \htmlurl{http://svn.sourceforge.net/viewcvs.cgi/*checkout*/sdcc/trunk/sdcc/ChangeLog}
+\begin_inset LatexCommand \htmlurl{http://sdcc.svn.sourceforge.net/viewcvs.cgi/*checkout*/sdcc/trunk/sdcc/ChangeLog}
 
 \end_inset
 
@@ -30429,7 +32294,7 @@ web site or at
 \end_layout
 
 \begin_layout Standard
-\begin_inset Note Comment
+\begin_inset Note Note
 status collapsed
 
 \begin_layout Standard
@@ -30466,7 +32331,7 @@ Quality control
 \end_layout
 
 \begin_layout Standard
-The compiler is passed through nightly compile and build checks.
+The compiler is passed through snaphot build compile and build checks.
  The so called 
 \shape italic
 regression tests
@@ -30477,7 +32342,7 @@ regression tests
 \end_inset
 
  check that SDCC itself compiles flawlessly on several host platforms (i386,
- Opteron, 64 bit Alpha, ppc64, MacOS X on PPC, Solaris on Sparc) and checks
+ Opteron, 64 bit Alpha, ppc64, Mac OS X on PPC, Solaris on Sparc) and checks
  the quality of the code generated by SDCC by running the code for several
  target platforms through simulators.
  The regression test suite comprises more than 100 files which expand to
@@ -30549,7 +32414,7 @@ make test-mcs51
 \end_layout
 
 \begin_layout Standard
-The 14bit pic port uses a different set of regression tests 
+The PIC14 port uses a different set of regression tests 
 \begin_inset LatexCommand \index{Regression test (PIC14)}
 
 \end_inset
@@ -30656,8 +32521,8 @@ not tie students to a specific host platform and instead allow them to use
 \emph on
 their
 \emph default
- choice (among them Alpha, i386, i386_64, MacOs, Mips, Sparc, Windows and
- eventually 
+ choice (among them Alpha, i386, i386_64, Mac OS X, Mips, Sparc, Windows
and eventually 
 \begin_inset LatexCommand \url[OLPC]{http://www.laptop.org}
 
 \end_inset
@@ -30700,10 +32565,6 @@ give students a chance to publically prove their skills and to possibly
 \begin_layout Standard
 then SDCC is probably among the first choices.
  Well, probably SDCC might be the only choice.
-\end_layout
-
-\begin_layout Standard
-
 \newpage
 
 \end_layout
@@ -31860,7 +33721,7 @@ then both the switch statements will be implemented using jump-tables whereas
 \end_layout
 
 \begin_layout Standard
-\begin_inset Note Comment
+\begin_inset Note Note
 status collapsed
 
 \begin_layout Standard
@@ -36336,7 +38197,7 @@ src/mcs51/gen.c
 \end_layout
 
 \begin_layout Standard
-\begin_inset Note Comment
+\begin_inset Note Note
 status collapsed
 
 \begin_layout Standard
@@ -37805,38 +39666,23 @@ Thanks to all the other volunteer developers who have helped with coding,
 \newline
 
 \emph on
-Also thanks to Sourceforge 
+Thanks to Sourceforge 
 \begin_inset LatexCommand \url{http://www.sf.net}
 
 \end_inset
 
  which has hosted the project since 1999 and donates significant download
- bandwidth and probably more than 
-\begin_inset ERT
-status collapsed
-
-\begin_layout Standard
-
-$10^{13}$
-\end_layout
-
-\end_inset
+ bandwidth.
+\emph default
 
-CPU cycles per day.
 \newline
-\begin_inset Note Note
-status open
 
-\begin_layout Standard
-more than 10^13 is an estimate: on my Athlon 2800+ it takes about (0.5+6.5+20)
- minutes for (configure+make+regression test), and there is (i386, amd64,
- alpha, ppc64, (mingw32), sparc, macosx).
-\end_layout
-
-\end_inset
+\newline
 
+\emph on
+Also thanks to all SDCC Distributed Compile Farm members for donating CPU
+ cycles and bandwidth for snapshot builds.
+\newline
 
 \end_layout