* src/SDCC.lex, src/SDCCmain.c, sdc/SDCCglobl.h, doc/sdccman.lyx:
[fw/sdcc] / doc / sdccman.lyx
index 014985e89c02de93ec953f4c51bbfda09de982b8..eb16337ed11ee2e862c4ece108fe103efdf91ed1 100644 (file)
@@ -7,8 +7,8 @@
   pdftitle={SDCC Compiler User Guide},
   pdfauthor={SDCC development team},
   pdfsubject={installation, user manual},
-  pdfkeywords={8032 8051 ansi c compiler CPU DS390
-               embedded GPL HC08 manual mcs51 microcontroller PIC Z80},
+  pdfkeywords={68hc08 8032 8051 ansi c compiler assembler CPU DS390 embedded development free Floating Point Arithmetic Freescale GPL HC08 inline Intel ISO/IEC 9899:1990 Linux MAC OS X manual Maxim mcs51 Microchip microcontroller open source PIC Unix Windows Z80 Zilog},
+  pdfpagemode=UseOutlines,
   colorlinks=true,
   linkcolor=blue] {hyperref}
 %
@@ -82,7 +82,7 @@ SDCC Compiler User Guide
 
 
 \size normal 
-SDCC 2.5.6
+SDCC 2.6.4
 \size footnotesize 
 
 \newline 
@@ -142,8 +142,8 @@ Sandeep Dutta
 
 , etc.), Dallas DS80C390 variants, Freescale (formerly Motorola) HC08 and
  Zilog Z80 based MCUs.
- It can be retargetted for other microprocessors, support for Microchip
PIC, Atmel AVR is under development.
+ It can be retargeted for other microprocessors, support for Microchip PIC,
+ Atmel AVR is under development.
  The entire source code for the compiler is distributed under GPL.
  SDCC uses ASXXXX
 \begin_inset LatexCommand \index{asXXXX (as-gbz80, as-hc08, asx8051, as-z80)}
@@ -155,7 +155,7 @@ Sandeep Dutta
 
 \end_inset 
 
-, an open source retargettable assembler & linker.
+, an open source retargetable assembler & linker.
  SDCC has extensive language extensions suitable for utilizing various microcont
 rollers and underlying hardware effectively.
  
@@ -212,7 +212,7 @@ Supported data-types are:
 <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">
+<column alignment="block" valignment="top" leftline="true" rightline="true" width="20text%">
 <row topline="true" bottomline="true">
 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
 \begin_inset Text
@@ -461,7 +461,7 @@ signed
 
 \layout Standard
 
-0, +4.294.967.296
+0, +4.294.967.295
 \end_inset 
 </cell>
 </row>
@@ -479,7 +479,7 @@ float
 
 \layout Standard
 
-4 bytes IEEE
+4 bytes IEEE 754
 \end_inset 
 </cell>
 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
@@ -502,6 +502,16 @@ signed
 
 \layout Standard
 
+1.175494351E-38, 
+\family roman 
+\series medium 
+\shape up 
+\size normal 
+\emph off 
+\bar no 
+\noun off 
+\color none
+3.402823466E+38
 \end_inset 
 </cell>
 </row>
@@ -578,9 +588,7 @@ status Collapsed
 
 \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.
- SDCDB and ucSim are currently not available on Win32 platforms.
+ currently uses ucSim a freeware simulator for 8051 and other micro-controllers.<
 \newline 
 
 \newline 
@@ -683,7 +691,12 @@ typewriter font.
 italic.
 \layout Section
 
-Compatibility with previous versions
+Compatibility
+\begin_inset LatexCommand \label{sec:Compatibility-with-previous}
+
+\end_inset 
+
+ with previous versions
 \begin_inset LatexCommand \index{Compatibility with previous versions}
 
 \end_inset 
@@ -718,8 +731,24 @@ the default directory for gcc-builds where include, library and documentation
  files are stored is now in /usr/local/share.
 \layout Itemize
 
-char type parameters to vararg functions are casted to int unless explicitly
- casted, e.g.: 
+char type parameters to vararg
+\begin_inset LatexCommand \index{vararg, va\_arg}
+
+\end_inset 
+
+ functions are casted to int unless explicitly casted
+\begin_inset Marginal
+collapsed true
+
+\layout Standard
+
+
+\series bold 
+\SpecialChar ~
+!
+\end_inset 
+
+, e.g.: 
 \newline 
 
 \family typewriter 
@@ -820,7 +849,24 @@ bit b;
 \newline 
 \SpecialChar ~
 \SpecialChar ~
-b = ~b; /* equivalent to b=1 instead of toggling b */
+b = ~
+\begin_inset LatexCommand \index{\~\/ Operator}
+
+\end_inset 
+
+b; /* equivalent to b=1 instead of toggling b */
+\begin_inset Marginal
+collapsed true
+
+\layout Standard
+
+
+\series bold 
+\SpecialChar ~
+!
+\end_inset 
+
+
 \newline 
 \SpecialChar ~
 \SpecialChar ~
@@ -937,13 +983,13 @@ For most users it is sufficient to skip to either section
 
 \end_inset 
 
- or section 
(Unix) or section 
 \begin_inset LatexCommand \ref{sub:Windows-Install}
 
 \end_inset 
 
-.
- More detailled instructions follow below.
+ (Windows).
+ More detailed instructions follow below.
 \layout Section
 
 Configure Options
@@ -1016,18 +1062,42 @@ status Collapsed
 \layout List
 \labelwidthstring 00.00.0000
 
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash 
+/
+\end_inset 
+
+-datarootdir see table below
+\newline 
+
+\layout List
+\labelwidthstring 00.00.0000
+
+\SpecialChar ~
+\SpecialChar ~
 docdir environment variable, see table below
 \layout List
 \labelwidthstring 00.00.0000
 
+\SpecialChar ~
+\SpecialChar ~
 include_dir_suffix environment variable, see table below
 \layout List
 \labelwidthstring 00.00.0000
 
+\SpecialChar ~
+\SpecialChar ~
 lib_dir_suffix environment variable, see table below
 \layout List
 \labelwidthstring 00.00.0000
 
+\SpecialChar ~
+\SpecialChar ~
 sdccconf_h_dir_separator environment variable, either / or 
 \backslash 
 
@@ -1035,6 +1105,8 @@ sdccconf_h_dir_separator environment variable, either / or
  makes sense here.
  This character will only be used in sdccconf.h; don't forget it's a C-header,
  therefore a double-backslash is needed there.
+\newline 
+
 \layout List
 \labelwidthstring 00.00.0000
 
@@ -1189,6 +1261,8 @@ status Collapsed
 \end_inset 
 
 -disable-packihx Disables building packihx
+\newline 
+
 \layout List
 \labelwidthstring 00.00.0000
 
@@ -1291,7 +1365,7 @@ These defaults are:
 \align center 
 
 \begin_inset  Tabular
-<lyxtabular version="3" rows="8" columns="3">
+<lyxtabular version="3" rows="9" columns="3">
 <features>
 <column alignment="block" valignment="top" leftline="true" width="0in">
 <column alignment="block" valignment="top" leftline="true" width="0in">
@@ -1402,7 +1476,7 @@ BINDIR
 
 
 \emph on 
-$EXECPREFIX
+$EXEC_PREFIX
 \emph default 
 /bin
 \end_inset 
@@ -1414,7 +1488,7 @@ $EXECPREFIX
 
 
 \emph on 
-$EXECPREFIX
+$EXEC_PREFIX
 \emph default 
 
 \backslash 
@@ -1439,6 +1513,38 @@ DATADIR
 \layout Standard
 
 
+\emph on 
+$DATAROOTDIR
+\end_inset 
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+
+\emph on 
+$DATAROOTDIR
+\end_inset 
+</cell>
+</row>
+<row topline="true">
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+
+\emph on 
+DATAROOTDIR
+\end_inset 
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+
 \emph on 
 $PREFIX
 \emph default 
@@ -1474,7 +1580,7 @@ DOCDIR
 
 
 \emph on 
-$DATADIR
+$DATAROOTDIR
 \emph default 
 /sdcc/doc
 \end_inset 
@@ -1486,7 +1592,7 @@ $DATADIR
 
 
 \emph on 
-$DATADIR
+$DATAROOTDIR
 \emph default 
 
 \backslash 
@@ -1724,7 +1830,7 @@ status Collapsed
 /
 \end_inset 
 
--datadir=
+-datarootdir=
 \begin_inset Quotes srd
 \end_inset 
 
@@ -1841,7 +1947,7 @@ status Collapsed
 /
 \end_inset 
 
--datadir=
+-datarootdir=
 \begin_inset Quotes srd
 \end_inset 
 
@@ -1857,7 +1963,9 @@ docdir=
 \begin_inset Quotes srd
 \end_inset 
 
-/sdcc/doc
+
+\backslash 
+${datarootdir}/doc
 \begin_inset Quotes srd
 \end_inset 
 
@@ -1933,7 +2041,7 @@ status Collapsed
 /
 \end_inset 
 
--disable-ucsim
+-host=i586-mingw32msvc
 \backslash 
 
 \newline 
@@ -1947,16 +2055,6 @@ status Collapsed
 /
 \end_inset 
 
--host=i586-mingw32msvc -
-\begin_inset ERT
-status Collapsed
-
-\layout Standard
-
-\backslash 
-/
-\end_inset 
-
 -build=unknown-unknown-linux-gnu
 \layout Standard
 
@@ -1975,30 +2073,6 @@ compile on Cygwin for Mingw32 (see also sdcc/support/scripts/sdcc_cygwin_mingw32
 ./configure -C 
 \backslash 
 
-\newline 
-CFLAGS=
-\begin_inset Quotes srd
-\end_inset 
-
--mno-cygwin -O2
-\begin_inset Quotes srd
-\end_inset 
-
-\backslash 
-
-\newline 
-LDFLAGS=
-\begin_inset Quotes srd
-\end_inset 
-
--mno-cygwin
-\begin_inset Quotes srd
-\end_inset 
-
-\backslash 
-
 \newline 
 -
 \begin_inset ERT
@@ -2032,7 +2106,7 @@ status Collapsed
 /
 \end_inset 
 
--datadir=
+-datarootdir=
 \begin_inset Quotes srd
 \end_inset 
 
@@ -2048,7 +2122,9 @@ docdir=
 \begin_inset Quotes srd
 \end_inset 
 
-/sdcc/doc
+
+\backslash 
+${datarootdir}/doc
 \begin_inset Quotes srd
 \end_inset 
 
@@ -2100,17 +2176,27 @@ sdccconf_h_dir_separator=
 \backslash 
 
 \newline 
--
-\begin_inset ERT
-status Collapsed
+CC=
+\begin_inset Quotes srd
+\end_inset 
 
-\layout Standard
+gcc -mno-cygwin
+\begin_inset Quotes srd
+\end_inset 
 
 \backslash 
-/
+
+\newline 
+CXX=
+\begin_inset Quotes srd
 \end_inset 
 
--disable-ucsim
+g++ -mno-cygwin
+\begin_inset Quotes srd
+\end_inset 
+
 \layout Standard
 
 'configure' is quite slow on Cygwin (at least on windows before Win2000/XP).
@@ -2146,10 +2232,10 @@ Install paths
 \begin_inset  Tabular
 <lyxtabular version="3" rows="5" columns="4">
 <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" rightline="true" width="0">
+<column alignment="left" valignment="top" leftline="true" width="0">
+<column alignment="left" valignment="top" leftline="true" width="0">
+<column alignment="left" valignment="top" leftline="true" width="0">
+<column alignment="left" valignment="top" leftline="true" rightline="true" width="0">
 <row topline="true" bottomline="true">
 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
 \begin_inset Text
@@ -3393,14 +3479,6 @@ With the Mingw32 gcc cross compiler it's easy to compile SDCC for Win32.
  See section 'Configure Options'.
 \layout Subsection
 
-Building SDCC on Windows 
-\layout Standard
-
-With the exception of Cygwin the SDCC binaries uCsim and sdcdb can't be
- built on Windows.
- They use Unix-sockets, which are not available on Win32.
-\layout Subsection
-
 Building SDCC using Cygwin and Mingw32
 \layout Standard
 
@@ -3600,8 +3678,7 @@ Download the source package
 
 \series default 
  SDCC is distributed with all the projects, workspaces, and files you need
- to build it using Visual C++ 6.0/NET (except for sdcdb.exe which currently
- doesn't build under MSVC).
+ to build it using Visual C++ 6.0/NET (except for SDCDB and ucSim).
  The workspace name is 'sdcc.dsw'.
  Please note that as it is now, all the executables are created in a folder
  called sdcc
@@ -3801,7 +3878,7 @@ Building SDCC Using Borland
 
 From the sdcc directory, run the command "make -f Makefile.bcc".
  This should regenerate all the .exe files in the bin directory except for
sdcdb.exe (which currently doesn't build under Borland C++).
SDCDB and ucSim.
 \layout Enumerate
 
 If you modify any source files and need to rebuild, be aware that the dependenci
@@ -3893,7 +3970,7 @@ sdcc-x.y.z-setup.exe
 
  or a setup program for one of the snapshots 
 \emph on 
-sdcc_yyyymmdd_setup.exe
+sdcc-yyyymmdd-xxxx-setup.exe
 \emph default 
  from 
 \begin_inset LatexCommand \url{http://sdcc.sf.net/snap.php}
@@ -4064,6 +4141,11 @@ x).
 \layout Section
 
 Reading the Documentation
+\begin_inset LatexCommand \index{Documentation}
+
+\end_inset 
+
+
 \layout Standard
 
 Currently reading the document in pdf format is recommended, as for unknown
@@ -4223,8 +4305,16 @@ status Collapsed
 
 \family default 
 \series default 
- at the prompt, and the program should run and tell you the version.
- If it doesn't run, or gives a message about not finding sdcc program, then
+ at the prompt, and the program should run and output its version like:
+\newline 
+
+\family typewriter 
+SDCC : mcs51/z80/avr/ds390/pic16/pic14/ds400/hc08 2.5.6 #4169 (May 8 2006)
+ (UNIX)
+\layout Standard
+
+If it doesn't run, or gives a message about not finding sdcc program, then
  you need to check over your installation.
  Make sure that the sdcc bin directory is in your executable search path
  defined by the PATH environment setting (
@@ -4613,11 +4703,9 @@ link-gbz80 - The Z80 and GameBoy Z80 linkers.
 \layout Itemize
 
 s51 - The ucSim 8051 simulator.
- Not available on Win32 platforms.
 \layout Itemize
 
 sdcdb - The source debugger.
- Not available on Win32 platforms.
 \layout Itemize
 
 packihx - A tool to pack (compress) Intel hex files.
@@ -4661,7 +4749,17 @@ The preprocessor
 
 \end_inset 
 
- is a modified version of the GNU preprocessor.
+ is a modified version of the GNU cpp
+\begin_inset LatexCommand \index{cpp|see{sdcpp}}
+
+\end_inset 
+
+ preprocessor 
+\begin_inset LatexCommand \url{http://gcc.gnu.org/}
+
+\end_inset 
+
+.
  The C preprocessor is used to pull in #include sources, process #ifdef
  statements, #defines and so on.
 \layout Subsection
@@ -4701,19 +4799,18 @@ S51
 .
  It currently supports the core mcs51, the Dallas DS80C390 and the Phillips
  XA51 family.
- S51 is currently not available on Win32 platfors.
 \layout Subsection
 
 sdcdb - Source Level Debugger
 \layout Standard
 
-Sdcdb
-\begin_inset LatexCommand \index{sdcdb (debugger)}
+SDCDB
+\begin_inset LatexCommand \index{SDCDB (debugger)}
 
 \end_inset 
 
  is the companion source level debugger.
- More about sdcdb in section 
+ More about SDCDB in section 
 \begin_inset LatexCommand \ref{cha:Debugging-with-SDCDB}
 
 \end_inset 
@@ -4725,7 +4822,6 @@ Sdcdb
 \end_inset 
 
 , but can be easily changed to use other simulators.
- Sdcdb is currently not available on Win32 platfors.
 \layout Chapter
 
 Using SDCC
@@ -4910,7 +5006,7 @@ sourcefile.adb
  - An intermediate file containing debug information needed to create the
  .cdb file (with -
 \begin_inset ERT
-status Open
+status Collapsed
 
 \layout Standard
 
@@ -4956,7 +5052,12 @@ sourcefile.
 
 \end_inset 
 
- file containing debug information (generated with option -
+\begin_inset LatexCommand \label{OMF file}
+
+\end_inset 
+
+file containing debug information (generated with option -
 \begin_inset ERT
 status Collapsed
 
@@ -5029,88 +5130,219 @@ Anatomy of the compiler
 ).
 \layout Subsection
 
-Projects with Multiple Source Files
-\layout Standard
+Postprocessing the Intel Hex
+\begin_inset LatexCommand \index{Intel hex format}
 
-SDCC can compile only ONE file at a time.
- Let us for example assume that you have a project containing the following
- files:
-\newline 
+\end_inset 
 
-\newline 
-foo1.c (contains some functions)
-\newline 
-foo2.c (contains some more functions)
-\newline 
-foomain.c (contains more functions and the function main)
-\newline 
+ file
+\layout Standard
 
-\size footnotesize 
+In most cases this won't be needed but the Intel Hex file
+\begin_inset LatexCommand \index{<file>.ihx}
 
-\newline 
+\end_inset 
 
-\size default 
-The first two files will need to be compiled separately with the commands:
-\size footnotesize 
+ which is generated by SDCC might include lines of varying length and the
+ addresses within the file are not guaranteed to be strictly ascending.
+ If your toolchain or a bootloader does not like this you can use the tool
  
-\size default 
+\family typewriter 
+packihx
+\family default 
 
-\newline 
+\begin_inset LatexCommand \index{packihx (tool)}
 
-\newline 
+\end_inset 
 
-\family sans 
-\series bold 
-sdcc\SpecialChar ~
--c\SpecialChar ~
-foo1.c
-\family default 
-\series default 
-\size footnotesize 
+ which is part of the SDCC distribution: 
+\newline 
 
 \newline 
 
 \family sans 
 \series bold 
-\size default 
-sdcc\SpecialChar ~
--c\SpecialChar ~
-foo2.c
+ packihx sourcefile.ihx >sourcefile.hex
 \family default 
 \series default 
 
 \newline 
 
 \newline 
-Then compile the source file containing the 
+The separately available
 \emph on 
-main()
+ srecord
 \emph default 
- function and link
-\begin_inset LatexCommand \index{Linker}
+
+\begin_inset LatexCommand \index{srecord (bin, hex, ... tool)}
 
 \end_inset 
 
- the files together with the following command: 
+ package additionally allows to set undefined locations to a predefined
+ value, to insert checksums
+\begin_inset LatexCommand \index{checksum}
+
+\end_inset 
+
+ of various flavours (crc, add, xor) and to perform other manipulations
+ (convert, split, crop, offset, ...).
 \newline 
 
 \newline 
 
 \family sans 
 \series bold 
-sdcc\SpecialChar ~
-foomain.c\SpecialChar ~
-foo1.rel\SpecialChar ~
-foo2.rel
+srec_cat\SpecialChar ~
+\SpecialChar ~
+sourcefile.ihx -intel\SpecialChar ~
+\SpecialChar ~
+-o sourcefile.hex -intel
+\newline 
+
+\newline 
+
 \family default 
 \series default 
+An example for a more complex command line
+\begin_inset Foot
+collapsed false
 
-\begin_inset LatexCommand \index{<file>.rel}
-
-\end_inset 
+\layout Standard
 
+the command backfills
+\begin_inset LatexCommand \index{backfill unused memory}
 
-\newline 
+\end_inset 
+
+ unused memory with 0x12 and the overall 16 bit sum of the complete 64 kByte
+ block is zero.
+ If the program counter on an mcs51 runs wild the backfill pattern 0x12
+ will be interpreted as an 
+\family typewriter 
+lcall
+\family default 
+ to address 
+\family typewriter 
+0x1212
+\family default 
+ (where an emergency routine could sit).
+\end_inset 
+
+ could look like:
+\newline 
+
+\newline 
+
+\family sans 
+\series bold 
+\size footnotesize 
+srec_cat\SpecialChar ~
+sourcefile.ihx -intel\SpecialChar ~
+\SpecialChar ~
+-fill 0x12 0x0000 0xfffe\SpecialChar ~
+-little-endian-checksum-nega
+tive 0xfffe 0x02 0x02\SpecialChar ~
+\SpecialChar ~
+-o sourcefile.hex -intel
+\size default 
+
+\newline 
+
+\newline 
+
+\family default 
+\series default 
+The srecord package is available at 
+\begin_inset LatexCommand \url{http://sf.net/projects/srecord}
+
+\end_inset 
+
+ .
+\layout Subsection
+
+Projects with Multiple Source Files
+\layout Standard
+
+SDCC can compile only ONE file at a time.
+ Let us for example assume that you have a project containing the following
+ files:
+\newline 
+
+\newline 
+foo1.c (contains some functions)
+\newline 
+foo2.c (contains some more functions)
+\newline 
+foomain.c (contains more functions and the function main)
+\newline 
+
+\size footnotesize 
+
+\newline 
+
+\size default 
+The first two files will need to be compiled separately with the commands:
+\size footnotesize 
+\size default 
+
+\newline 
+
+\newline 
+
+\family sans 
+\series bold 
+sdcc\SpecialChar ~
+-c\SpecialChar ~
+foo1.c
+\family default 
+\series default 
+\size footnotesize 
+
+\newline 
+
+\family sans 
+\series bold 
+\size default 
+sdcc\SpecialChar ~
+-c\SpecialChar ~
+foo2.c
+\family default 
+\series default 
+
+\newline 
+
+\newline 
+Then compile the source file containing the 
+\emph on 
+main()
+\emph default 
+ function and link
+\begin_inset LatexCommand \index{Linker}
+
+\end_inset 
+
+ the files together with the following command: 
+\newline 
+
+\newline 
+
+\family sans 
+\series bold 
+sdcc\SpecialChar ~
+foomain.c\SpecialChar ~
+foo1.rel\SpecialChar ~
+foo2.rel
+\family default 
+\series default 
+
+\begin_inset LatexCommand \index{<file>.rel}
+
+\end_inset 
+
+
+\newline 
 
 \newline 
 Alternatively, 
@@ -5477,10 +5709,10 @@ __mulint
 \newline 
 
 \layout Standard
-
+\added_space_bottom bigskip 
 If the source files are compiled using -
 \begin_inset ERT
-status Open
+status Collapsed
 
 \layout Standard
 
@@ -5652,7 +5884,7 @@ Processor Selection Options
 
 \end_inset 
 
- processor (In development, not complete).
+ processor (Not maintained, not complete).
  AVR users should probably have a look at winavr 
 \begin_inset LatexCommand \url{http://sourceforge.net/projects/winavr}
 
@@ -5724,7 +5956,7 @@ p16f627 p16f628 p16f84 p16f873 p16f877?
 
  processor (Not maintained, not complete).
 \layout List
-\labelwidthstring 00.00.0000
+\added_space_bottom bigskip \labelwidthstring 00.00.0000
 
 
 \series bold 
@@ -5943,6 +6175,33 @@ Like `-dD' except that the macro arguments and contents are omitted.
 \labelwidthstring 00.00.0000
 
 
+\series bold 
+-pedantic-parse-number
+\begin_inset LatexCommand \index{-pedantic-parse-number}
+
+\end_inset 
+
+
+\size large 
+\bar under 
+\series default 
+\size default 
+\bar default 
+Pedentic 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
+\begin_inset LatexCommand \ref{sec:Pragmas}
+
+\end_inset 
+
+\emph on 
+Note: this functionality is not in conformance with standard!
+\layout List
+\added_space_bottom bigskip \labelwidthstring 00.00.0000
+
+
 \series bold 
 -Wp\SpecialChar ~
 preprocessorOption[,preprocessorOption]
@@ -5963,9 +6222,29 @@ sdcpp
 \end_inset 
 
 .
- SDCC uses an adapted version of the preprocessor cpp of the GNU Compiler
- Collection (gcc), if you need more dedicated options please refer to the
- documentation at 
+ SDCC uses an adapted version of the preprocessor 
+\emph on 
+cpp
+\emph default 
+ of the GNU Compiler Collection
+\begin_inset LatexCommand \index{gcc (GNU Compiler Collection)}
+
+\end_inset 
+
+ (
+\emph on 
+gcc
+\emph default 
+\begin_inset LatexCommand \url{http://gcc.gnu.org/}
+
+\end_inset 
+
+), if you need more dedicated options please refer to the GCC\SpecialChar ~
+4.1.1\SpecialChar ~
+CPP\SpecialChar ~
+Manual
+ at 
 \begin_inset LatexCommand \htmlurl{http://www.gnu.org/software/gcc/onlinedocs/}
 
 \end_inset 
@@ -6106,8 +6385,12 @@ status Collapsed
 \end_inset 
 
  segment, default value 0.
- Note when this option is used the interrupt vector table is also relocated
- to the given address.
+ Note when this option is used the interrupt vector table
+\begin_inset LatexCommand \index{interrupt vector table}
+
+\end_inset 
+
+ is also relocated to the given address.
  The value entered can be in Hexadecimal or Decimal format, e.g.: -
 \begin_inset ERT
 status Collapsed
@@ -6257,7 +6540,12 @@ status Collapsed
 
 \end_inset 
 
- is placed after the pdata segment.
+ is placed after the pdata
+\begin_inset LatexCommand \index{pdata (mcs51, ds390 storage class)}
+
+\end_inset 
+
+ segment.
  Using this option the xstack can be placed anywhere in the external memory
  space of the 8051.
  The value entered can be in Hexadecimal or Decimal format, e.g.
@@ -6522,6 +6810,11 @@ status Collapsed
 \end_inset 
 
 
+\begin_inset LatexCommand \index{HC08!Options!-\/-out-fmt-elf}
+
+\end_inset 
+
+
 \bar under 
  
 \series default 
@@ -6532,9 +6825,14 @@ The linker output (final object code) is in ELF format
 \end_inset 
 
 .
- (Currently only supported for the HC08 processors)
+ (Currently only supported for the HC08
+\begin_inset LatexCommand \index{HC08}
+
+\end_inset 
+
+ processors)
 \layout List
-\labelwidthstring 00.00.0000
+\added_space_bottom bigskip \labelwidthstring 00.00.0000
 
 
 \series bold 
@@ -6548,7 +6846,23 @@ linkOption[,linkOption]
 
 ...
  Pass the linkOption to the linker.
- See file sdcc/as/doc/asxhtm.html for more on linker options.
+ If a bootloader is used an option like 
+\begin_inset Quotes sld
+\end_inset 
+
+-Wl\SpecialChar ~
+-bCSEG=0x1000
+\begin_inset Quotes srd
+\end_inset 
+
+ would be typical to set the start of the code segment.
+ See also #pragma constseg and #pragma codeseg in section 
+\begin_inset LatexCommand \ref{sec:Pragmas}
+
+\end_inset 
+
+ .
+ File sdcc/as/doc/asxhtm.html has more on linker options.
 \layout Subsection
 
 MCS51 Options
@@ -6668,8 +6982,13 @@ status Collapsed
 
 
 \series default 
- Uses a pseudo stack in the first 256 bytes in the external ram for allocating
- variables and passing parameters.
+ Uses a pseudo stack in the pdata
+\begin_inset LatexCommand \index{pdata (mcs51, ds390 storage class)}
+
+\end_inset 
+
+ area (usually the first 256 bytes in the external ram) for allocating variables
+ and passing parameters.
  See section 
 \begin_inset LatexCommand \ref{sub:External-Stack}
 
@@ -6803,7 +7122,7 @@ status Collapsed
  data, idata and stack together.
  This is the default now.
 \layout List
-\labelwidthstring 00.00.0000
+\added_space_bottom bigskip \labelwidthstring 00.00.0000
 
 
 \series bold 
@@ -6834,7 +7153,7 @@ DS390 / DS400 Options
 \end_inset 
 
 
-\begin_inset LatexCommand \index{DS390 options}
+\begin_inset LatexCommand \index{DS390}
 
 \end_inset 
 
@@ -6857,7 +7176,7 @@ status Collapsed
 -model-flat24
 \series default 
 
-\begin_inset LatexCommand \index{-\/-model-flat24}
+\begin_inset LatexCommand \index{DS390!Options!-\/-model-flat24}
 
 \end_inset 
 
@@ -6891,7 +7210,7 @@ status Collapsed
 \end_inset 
 
 -protect-sp-update
-\begin_inset LatexCommand \index{-\/-protect-sp-update}
+\begin_inset LatexCommand \index{DS390!Options!-\/-protect-sp-update}
 
 \end_inset 
 
@@ -6916,7 +7235,7 @@ status Collapsed
 -stack-10bit
 \series default 
 
-\begin_inset LatexCommand \index{-\/-stack-10bit}
+\begin_inset LatexCommand \index{DS390!Options!-\/-stack-10bit}
 
 \end_inset 
 
@@ -7011,7 +7330,7 @@ status Collapsed
 \end_inset 
 
 -stack-probe
-\begin_inset LatexCommand \index{-\/-stack-probe}
+\begin_inset LatexCommand \index{DS390!Options!-\/-stack-probe}
 
 \end_inset 
 
@@ -7034,7 +7353,7 @@ status Collapsed
 \end_inset 
 
 -tini-libid
-\begin_inset LatexCommand \index{-\/-tini-libid}
+\begin_inset LatexCommand \index{DS390!Options!-\/-tini-libid}
 
 \end_inset 
 
@@ -7043,7 +7362,7 @@ status Collapsed
  <nnnn> LibraryID used in -mTININative.
  
 \layout List
-\labelwidthstring 00.00.0000
+\added_space_bottom bigskip \labelwidthstring 00.00.0000
 
 
 \series bold 
@@ -7058,7 +7377,7 @@ status Collapsed
 \end_inset 
 
 -use-accelerator
-\begin_inset LatexCommand \index{-\/-use-accelerator}
+\begin_inset LatexCommand \index{DS390!Options!-\/-use-accelerator}
 
 \end_inset 
 
@@ -7074,7 +7393,7 @@ Z80 Options
 \end_inset 
 
 
-\begin_inset LatexCommand \index{Z80 options}
+\begin_inset LatexCommand \index{Z80}
 
 \end_inset 
 
@@ -7097,7 +7416,7 @@ status Collapsed
 -callee-saves-bc
 \series default 
 
-\begin_inset LatexCommand \index{-\/-callee-saves-bc}
+\begin_inset LatexCommand \index{Z80!Options!-\/-callee-saves-bc}
 
 \end_inset 
 
@@ -7109,7 +7428,7 @@ status Collapsed
 \emph default 
 Force a called function to always save BC.
 \layout List
-\labelwidthstring 00.00.0000
+\added_space_bottom bigskip \labelwidthstring 00.00.0000
 
 
 \series bold 
@@ -7126,7 +7445,7 @@ status Collapsed
 -no-std-crt0
 \series default 
 
-\begin_inset LatexCommand \index{-\/-no-std-crt0}
+\begin_inset LatexCommand \index{Z80!Options!-\/-no-std-crt0}
 
 \end_inset 
 
@@ -7533,7 +7852,7 @@ status Collapsed
  The compiler will optimize code generation towards fast code, possibly
  at the expense of code size.
 \layout List
-\labelwidthstring 00.00.0000
+\added_space_bottom bigskip \labelwidthstring 00.00.0000
 
 
 \series bold 
@@ -7956,8 +8275,8 @@ status Collapsed
 \series default 
  This option can be used if the code generated is called by a monitor program
  or if the main routine includes an endless loop.
- This option might result in slightly smaller code and save two bytes of
- stack space.
+ This option results in slightly smaller code and saves two bytes of stack
+ space.
  The return from the 'main'
 \begin_inset LatexCommand \index{main return}
 
@@ -8227,7 +8546,19 @@ status Collapsed
 
 \series default 
  Display errors and warnings using MSVC style, so you can use SDCC with
- visual studio.
+ the visual studio IDE
+\begin_inset LatexCommand \index{IDE}
+
+\end_inset 
+
+.
+ With SDCC both offering a GCC-like (the default) and a MSVC-like
+\begin_inset LatexCommand \index{MSVC output style}
+
+\end_inset 
+
+ output style, integration into most programming editors should be straightforwa
+rd.
 \layout List
 \labelwidthstring 00.00.0000
 
@@ -8445,6 +8776,29 @@ status Collapsed
 \labelwidthstring 00.00.0000
 
 
+\series bold 
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash 
+/
+\end_inset 
+
+-fdollars-in-identifiers
+\begin_inset LatexCommand \index{-\/-fdollars-in-identifiers}
+
+\end_inset 
+
+
+\series default 
+ Permit '$' as an identifier character
+\layout List
+\added_space_bottom bigskip \labelwidthstring 00.00.0000
+
+
 \series bold 
 more-pedantic
 \series default 
@@ -8828,7 +9182,7 @@ status Collapsed
 \series default 
  Will create a dump of the live ranges of iTemp's
 \layout List
-\labelwidthstring 00.00.0000
+\added_space_bottom bigskip \labelwidthstring 00.00.0000
 
 
 \series bold 
@@ -8859,7 +9213,7 @@ Will cause all the above mentioned dumps to be created.
 
 Redirecting output on Windows Shells
 \layout Standard
-
+\added_space_bottom bigskip 
 By default SDCC writes it's error messages to 
 \begin_inset Quotes sld
 \end_inset 
@@ -9102,7 +9456,7 @@ Search Paths
 
 ..
 \layout Standard
-
+\added_space_bottom bigskip 
 There are some more environment variables recognized by SDCC, but these
  are solely used for debugging purposes.
  They can change or disappear very quickly, and will never be documented.
@@ -9157,6 +9511,14 @@ data
  and 
 \emph on 
 near
+\emph default 
+ or the more ANSI-C compliant forms 
+\emph on 
+__data
+\emph default 
+ and 
+\emph on 
+__near
 \emph default 
  can be used synonymously).
  Variables declared with this storage class will be allocated in the directly
@@ -9165,7 +9527,7 @@ near
 
 
 \family typewriter 
-data unsigned char test_data;
+__data unsigned char test_data;
 \layout Standard
 
 Writing 0x01 to this variable generates the assembly code:
@@ -9178,7 +9540,7 @@ Writing 0x01 to this variable generates the assembly code:
 \SpecialChar ~
 mov\SpecialChar ~
 \SpecialChar ~
-_test_data,#0x01 
+_test_data,#0x01
 \layout Subsubsection
 
 xdata
@@ -9215,7 +9577,7 @@ default
 
 
 \family typewriter 
-xdata unsigned char test_xdata;
+__xdata unsigned char test_xdata;
 \layout Standard
 
 Writing 0x01 to this variable generates the assembly code:
@@ -9273,7 +9635,7 @@ Variables declared with this storage class will be allocated into the indirectly
 
 
 \family typewriter 
-idata unsigned char test_idata;
+__idata unsigned char test_idata;
 \layout Standard
 
 Writing 0x01 to this variable generates the assembly code:
@@ -9357,7 +9719,7 @@ default
 
 
 \family typewriter 
-pdata unsigned char test_pdata;
+__pdata unsigned char test_pdata;
 \layout Standard
 
 Writing 0x01 to this variable generates the assembly code:
@@ -9431,7 +9793,7 @@ code
 
 
 \family typewriter 
-code unsigned char test_code;
+__code unsigned char test_code;
 \layout Standard
 
 Read access to this variable generates the assembly code:
@@ -9476,7 +9838,7 @@ char
 
 
 \family typewriter 
-code char test_array[] = {'c','h','e','a','p'}; 
+__code char test_array[] = {'c','h','e','a','p'}; 
 \layout Standard
 
 Read access to this array using an 8-bit unsigned index generates the assembly
@@ -9536,7 +9898,7 @@ This is a data-type and a storage class specifier.
 
 
 \family typewriter 
-bit test_bit;
+__bit test_bit;
 \layout Standard
 
 Writing 1 to this variable generates the assembly code:
@@ -9616,6 +9978,11 @@ sfr
 \end_inset 
 
 
+\begin_inset LatexCommand \index{sbit}
+
+\end_inset 
+
+
 \layout Standard
 
 Like the bit keyword, 
@@ -9648,7 +10015,7 @@ bit
 
 
 \family typewriter 
-sfr at
+__sfr __at
 \begin_inset LatexCommand \index{at}
 
 \end_inset 
@@ -9658,15 +10025,22 @@ sfr at
 
 \end_inset 
 
0x80 P0;\SpecialChar ~
(0x80) P0;\SpecialChar ~
  /* special function register P0 at location 0x80 */
 \newline 
-/* 16 bit special function register combination for timer 0 */
+
 \newline 
-/* with the high byte at location 0x8C and the low byte at location 0x8A
- */
+/* 16 bit special function register combination for timer 0
+\newline 
+\SpecialChar ~
+\SpecialChar ~
+ with the high byte at location 0x8C and the low byte at location 0x8A */
+\newline 
+__sfr16 __at (0x8C8A) TMR0;
 \newline 
-sfr16 at
+
+\newline 
+__sbit __at
 \begin_inset LatexCommand \index{at}
 
 \end_inset 
@@ -9676,9 +10050,8 @@ sfr16 at
 
 \end_inset 
 
- 0x8C8A TMR0;
-\newline 
-sbit at 0xd7 CY; /* CY (Carry Flag
+ (0xd7) CY;\SpecialChar ~
+ /* CY (Carry Flag
 \begin_inset LatexCommand \index{Flags}
 
 \end_inset 
@@ -9710,21 +10083,76 @@ sfr32.
 \emph default 
  Allthough SDCC usually accesses them Least Significant Byte (LSB) first,
  this is not guaranteed.
-\layout Subsubsection
+\newline 
 
-Pointers
-\begin_inset LatexCommand \index{Pointer}
+\layout Standard
 
-\end_inset 
+Please note, if you use a header file which was written for another compiler
+ then the sfr / sfr16 / sfr32 / sbit Storage Class extensions will most
+ likely be 
+\emph on 
+not 
+\emph default 
+compatible.
+ Specifically the syntax 
+\family typewriter 
+\SpecialChar ~
+sfr P0 = 0x80;\SpecialChar ~
 
- to MCS51/DS390 specific memory spaces
-\layout Standard
+\family default 
+ is compiled 
+\emph on 
+without warning
+\emph default 
+ by SDCC to an assignment of 0x80 to a variable called P0 
+\family typewriter 
 
-SDCC allows (via language extensions) pointers to explicitly point to any
- of the memory spaces
-\begin_inset LatexCommand \index{Memory model}
+\begin_inset Marginal
+collapsed true
 
-\end_inset 
+\layout Standard
+
+
+\series bold 
+\SpecialChar ~
+!
+\end_inset 
+
+.
+\family default 
+Nevertheless it is possible to write header files
+\begin_inset LatexCommand \index{Header files}
+
+\end_inset 
+
+
+\begin_inset LatexCommand \index{Include files}
+
+\end_inset 
+
+ which can be shared among different compilers (see section 
+\begin_inset LatexCommand \ref{sec:Porting-code-to-other-compilers}
+
+\end_inset 
+
+).
+\layout Subsubsection
+
+Pointers
+\begin_inset LatexCommand \index{Pointer}
+
+\end_inset 
+
+ to MCS51/DS390 specific memory spaces
+\layout Standard
+
+SDCC allows (via language extensions) pointers to explicitly point to any
+ of the memory spaces
+\begin_inset LatexCommand \index{Memory model}
+
+\end_inset 
 
  of the 8051.
  In addition to the explicit pointers, the compiler uses (by default) generic
@@ -9740,40 +10168,49 @@ Pointer declaration examples:
 /* pointer physically in internal ram pointing to object in external ram
  */ 
 \newline 
-xdata unsigned char * data p;
+__xdata unsigned char * __data p;
 \newline 
 
 \newline 
 /* pointer physically in external ram pointing to object in internal ram
  */ 
 \newline 
-data unsigned char * xdata p;
+__data unsigned char * __xdata p;
 \newline 
 
 \newline 
 /* pointer physically in code rom pointing to data in xdata space */ 
 \newline 
-xdata unsigned char * code p;
+__xdata unsigned char * __code p;
 \newline 
 
 \newline 
 /* pointer physically in code space pointing to data in code space */ 
 \newline 
-code unsigned char * code p;
+__code unsigned char * __code p;
 \newline 
 
 \newline 
-/* the following is a generic pointer physically located in xdata space
- */
+/* generic pointer physically located in xdata space */
 \newline 
-char * xdata p;
+unsigned char * __xdata p;
 \newline 
 
 \newline 
-/* the following is a function pointer physically located in data space
- */
+/* generic pointer physically located in default memory space */
+\newline 
+unsigned char * p;
+\newline 
+
+\newline 
+/* the following is a function pointer
+\begin_inset LatexCommand \index{function pointer}
+
+\end_inset 
+
+ physically located in data space */
 \newline 
-char (* data fp)(void);
+char (* __data fp)(void);
 \layout Standard
 
 Well you get the idea.
@@ -9811,8 +10248,12 @@ generic
 \end_inset 
 
  routines.
- Explicitly specifying the pointer type will generate the most efficient
- code.
+ Explicitly specifying the pointer
+\begin_inset LatexCommand \index{pointer}
+
+\end_inset 
+
+ type will generate the most efficient code.
 \layout Subsubsection
 
 Notes on MCS51 memory
@@ -10008,6 +10449,8 @@ idata
 \emph default 
 ).
  
+\newline 
+
 \layout Standard
 
 By default the 8051 linker will place the stack after the last byte of (i)data
@@ -10104,7 +10547,7 @@ status Collapsed
  If in doubt, don't specify any options and see if the resulting memory
  layout is appropriate, then you can adjust it.
 \layout Standard
-
+\added_space_bottom bigskip 
 The linker generates two files with memory allocation information.
  The first, with extension .map
 \begin_inset LatexCommand \index{<file>.map}
@@ -10127,7 +10570,7 @@ The linker generates two files with memory allocation information.
 \layout Subsection
 
 Z80/Z180 Storage Class
-\begin_inset LatexCommand \index{Storage class}
+\begin_inset LatexCommand \index{Z80!Storage class}
 
 \end_inset 
 
@@ -10164,6 +10607,16 @@ utput memory.
  I/O memory
 \begin_inset LatexCommand \index{I/O memory (Z80, Z180)}
 
+\end_inset 
+
+
+\begin_inset LatexCommand \index{Z80!I/O memory}
+
+\end_inset 
+
+
+\begin_inset LatexCommand \index{Z180!I/O memory}
+
 \end_inset 
 
  is accessed with special instructions, e.g.:
@@ -10277,13 +10730,13 @@ sfr
 \end_inset 
 
 /HD64180
-\begin_inset LatexCommand \index{HD64180}
+\begin_inset LatexCommand \index{HD64180 (see Z180)}
 
 \end_inset 
 
 )
 \layout Standard
-
+\added_space_bottom bigskip 
 The compiler option -
 \begin_inset ERT
 status Collapsed
@@ -10294,13 +10747,18 @@ status Collapsed
 /
 \end_inset 
 
--portmode=180 (80) and a compiler #pragma\SpecialChar ~
+-portmode
+\begin_inset LatexCommand \index{Z180!Options!-\/-portmode}
+
+\end_inset 
+
+=180 (80) and a compiler #pragma\SpecialChar ~
 portmode
-\begin_inset LatexCommand \index{\#pragma portmode}
+\begin_inset LatexCommand \index{Z180!Pragmas!\#pragma portmode}
 
 \end_inset 
 
-=z180 (z80) is used to turn on (off) the Z180/HD64180 port addressing instructio
+ z180 (z80) is used to turn on (off) the Z180/HD64180 port addressing instructio
 ns 
 \family typewriter 
 in0/out0
@@ -10314,7 +10772,7 @@ in/out
 \layout Subsection
 
 HC08 Storage Class
-\begin_inset LatexCommand \index{Storage class}
+\begin_inset LatexCommand \index{HC08!Storage class}
 
 \end_inset 
 
@@ -10336,8 +10794,12 @@ data
 
 The data storage class declares a variable that resides in the first 256
  bytes of memory (the direct page).
- The HC08 is most efficient at accessing variables (especially pointers)
- stored here.
+ The HC08
+\begin_inset LatexCommand \index{HC08}
+
+\end_inset 
+
+ is most efficient at accessing variables (especially pointers) stored here.
 \layout Subsubsection
 
 xdata
@@ -10352,7 +10814,7 @@ xdata
 
  
 \layout Standard
-
+\added_space_bottom bigskip 
 The xdata storage class declares a variable that can reside anywhere in
  memory.
  This is the default if no storage class is specified.
@@ -10409,14 +10871,33 @@ xdata
  0x7ffe unsigned int chksum;
 \layout Standard
 
+or, better conforming to ISO/IEC 9899 C:
+\layout Verse
+
+
+\family typewriter 
+__xdata __at (0x7ffe) unsigned int chksum;
+\layout Standard
+
 In the above example the variable chksum will be located at 0x7ffe and 0x7fff
  of the external ram.
  The compiler does 
 \emph on 
 not
 \emph default 
- reserve any space for variables declared in this way (they are implemented
- with an equate in the assembler).
+ reserve any space for variables declared in this way
+\begin_inset Marginal
+collapsed true
+
+\layout Standard
+
+
+\series bold 
+\SpecialChar ~
+!
+\end_inset 
+
+ (they are implemented with an equate in the assembler).
  Thus it is left to the programmer to make sure there are no overlaps with
  other variables that are declared without the absolute address.
  The assembler listing file (.lst
@@ -10438,6 +10919,18 @@ not
  Variables with an absolute address are 
 \emph on 
 not
+\begin_inset Marginal
+collapsed true
+
+\layout Standard
+
+
+\series bold 
+\SpecialChar ~
+!
+\end_inset 
+
+
 \emph default 
  initialized
 \begin_inset LatexCommand \index{Variable initialization}
@@ -10461,17 +10954,17 @@ volatile
 
 \end_inset 
 
- xdata
__xdata
 \begin_inset LatexCommand \index{xdata (mcs51, ds390 storage class)}
 
 \end_inset 
 
- at
__at
 \begin_inset LatexCommand \index{at}
 
 \end_inset 
 
0x8000 unsigned char PORTA_8255;
(0x8000) unsigned char PORTA_8255;
 \layout Standard
 
 For some architectures (mcs51) array accesses are more efficient if an (xdata/fa
@@ -10504,17 +10997,17 @@ Absolute addresses can be specified for variables in all storage classes,
 
 
 \family typewriter 
-bit
+__bit
 \begin_inset LatexCommand \index{bit}
 
 \end_inset 
 
- at
__at
 \begin_inset LatexCommand \index{at}
 
 \end_inset 
 
0x02 bvar;
(0x02) bvar;
 \layout Standard
 
 The above example will allocate the variable at offset 0x02 in the bit-addressab
@@ -10534,19 +11027,19 @@ extern volatile
 
 \end_inset 
 
- bit MOSI;\SpecialChar ~
__bit MOSI;\SpecialChar ~
 \SpecialChar ~
 \SpecialChar ~
 \SpecialChar ~
 /* master out, slave in */
 \newline 
-extern volatile bit MISO;\SpecialChar ~
+extern volatile __bit MISO;\SpecialChar ~
 \SpecialChar ~
 \SpecialChar ~
 \SpecialChar ~
 /* master in, slave out */
 \newline 
-extern volatile bit MCLK;\SpecialChar ~
+extern volatile __bit MCLK;\SpecialChar ~
 \SpecialChar ~
 \SpecialChar ~
 \SpecialChar ~
@@ -10682,7 +11175,7 @@ Then, someplace in the code for the first hardware you would use
 
 
 \family typewriter 
-bit at
+__bit __at
 \begin_inset LatexCommand \index{at}
 
 \end_inset 
@@ -10692,19 +11185,19 @@ bit at
 
 \end_inset 
 
0x80 MOSI;\SpecialChar ~
(0x80) MOSI;\SpecialChar ~
 \SpecialChar ~
 \SpecialChar ~
 \SpecialChar ~
 /* I/O port 0, bit 0 */
 \newline 
-bit at 0x81 MISO;\SpecialChar ~
+__bit __at (0x81) MISO;\SpecialChar ~
 \SpecialChar ~
 \SpecialChar ~
 \SpecialChar ~
 /* I/O port 0, bit 1 */
 \newline 
-bit at 0x82 MCLK;\SpecialChar ~
+__bit __at (0x82) MCLK;\SpecialChar ~
 \SpecialChar ~
 \SpecialChar ~
 \SpecialChar ~
@@ -10716,30 +11209,30 @@ Similarly, for the second hardware you would use
 
 
 \family typewriter 
-bit at 0x83 MOSI;\SpecialChar ~
+__bit __at (0x83) MOSI;\SpecialChar ~
 \SpecialChar ~
 \SpecialChar ~
 \SpecialChar ~
 /* I/O port 0, bit 3 */
 \newline 
-bit at 0x91 MISO;\SpecialChar ~
+__bit __at (0x91) MISO;\SpecialChar ~
 \SpecialChar ~
 \SpecialChar ~
 \SpecialChar ~
 /* I/O port 1, bit 1 */
 \newline 
-bit
+__bit
 \begin_inset LatexCommand \index{bit}
 
 \end_inset 
 
at 0x92 MCLK;\SpecialChar ~
__at (0x92) MCLK;\SpecialChar ~
 \SpecialChar ~
 \SpecialChar ~
 \SpecialChar ~
 /* I/O port 1, bit 2 */
 \layout Standard
-
+\added_space_bottom bigskip 
 and you can use the same hardware dependent routine without changes, as
  for example in a library.
  This is somehow similar to sbit, but only one absolute address has to be
@@ -10840,7 +11333,7 @@ reentrant
 
 
 \family typewriter 
-unsigned char foo(char i) reentrant 
+unsigned char foo(char i) __reentrant 
 \newline 
 { 
 \newline 
@@ -10910,24 +11403,24 @@ unsigned char foo()
 \SpecialChar ~
 \SpecialChar ~
 \SpecialChar ~
-xdata unsigned char i;
+__xdata unsigned char i;
 \newline 
 \SpecialChar ~
 \SpecialChar ~
 \SpecialChar ~
 \SpecialChar ~
-bit bvar;
+__bit bvar;
 \newline 
 \SpecialChar ~
 \SpecialChar ~
 \SpecialChar ~
 \SpecialChar ~
-data at
+__data __at
 \begin_inset LatexCommand \index{at}
 
 \end_inset 
 
0x31 unsigned char j;
(0x31) unsigned char j;
 \newline 
 \SpecialChar ~
 \SpecialChar ~
@@ -10990,8 +11483,12 @@ Parameters
 It is however allowed to use bit parameters in reentrant functions and also
  non-static local bit variables are supported.
  Efficient use is limited to 8 semi-bitregisters in bit space.
- They are pushed and popped to stack as a single byte just like the normal
- registers.
+ They are pushed and popped to stack
+\begin_inset LatexCommand \index{stack}
+
+\end_inset 
+
+ as a single byte just like the normal registers.
 \layout Section
 
 Overlaying
@@ -11041,8 +11538,18 @@ no other function calls and the function is non-reentrant and the memory
 
 Note that the compiler (not the linkage editor) makes the decision for overlayin
 g the data items.
- Functions that are called from an interrupt service routine should be preceded
- by a #pragma\SpecialChar ~
+ Functions that are called from an interrupt service routine
+\begin_inset Marginal
+collapsed true
+
+\layout Standard
+
+
+\series bold 
+!
+\end_inset 
+
+ should be preceded by a #pragma\SpecialChar ~
 nooverlay
 \begin_inset LatexCommand \index{\#pragma nooverlay}
 
@@ -11101,12 +11608,12 @@ P3 = errcd;
 \newline 
 
 \newline 
-void some_isr () interrupt
+void some_isr () __interrupt
 \begin_inset LatexCommand \index{interrupt}
 
 \end_inset 
 
- 2
+ (2)
 \newline 
 {
 \newline 
@@ -11131,7 +11638,7 @@ set_error(10);
 \newline 
 }
 \layout Standard
-
+\added_space_bottom bigskip 
 In the above example the parameter 
 \emph on 
 errcd
@@ -11177,7 +11684,7 @@ outines to be coded in C, with some extended keywords.
 
 
 \family typewriter 
-void timer_isr (void) interrupt 1 using 1 
+void timer_isr (void) __interrupt (1) __using (1) 
 \newline 
 { 
 \newline 
@@ -11207,7 +11714,12 @@ interrupt
 \emph default 
  keyword is the interrupt number this routine will service.
  When present, the compiler will insert a call to this routine in the interrupt
- vector table for the interrupt number specified.
+ vector table
+\begin_inset LatexCommand \index{interrupt vector table}
+
+\end_inset 
+
+ for the interrupt number specified.
  If you have multiple source files in your project, interrupt service routines
  can be present in any of them, but a prototype of the isr MUST be present
  or included in the file that contains the function 
@@ -11215,7 +11727,7 @@ interrupt
 main
 \emph default 
 .
- The optional 
+ The optional (8051 specific) keyword 
 \emph on 
 using
 \begin_inset LatexCommand \index{using (mcs51, ds390 register bank)}
@@ -11229,15 +11741,23 @@ using
 
 
 \emph default 
- keyword can be used to tell the compiler to use the specified register
bank (8051 specific) when generating code for this function.
+ can be used to tell the compiler to use the specified register bank when
+ generating code for this function.
  
 \newline 
+Interrupt service routines open the door for some very interesting bugs:
+\layout Subsubsection
+
+
+\begin_inset LatexCommand \label{sub:Common-interrupt-pitfall-volatile}
+
+\end_inset 
 
+Common interrupt pitfall: variable not declared 
+\emph on 
+volatile
 \layout Standard
 
-Interrupt service routines open the door for some very interesting bugs:
-\newline 
 If an interrupt service routine changes variables which are accessed by
  other functions these variables have to be declared 
 \emph on 
@@ -11249,7 +11769,22 @@ volatile
 \end_inset 
 
 .
+ See 
+\begin_inset LatexCommand \url{http://en.wikipedia.org/wiki/Volatile_variable}
+
+\end_inset 
+
+ .
+\layout Subsubsection
+
+
+\begin_inset LatexCommand \label{sub:Common-interrupt-pitfall-non-atomic}
+
+\end_inset 
+
+Common interrupt pitfall: 
+\emph on 
+non-atomic access
 \layout Standard
 
 If the access to these variables is not 
@@ -11265,8 +11800,10 @@ atomic
  the processor needs more than one instruction for the access and could
  be interrupted while accessing the variable) the interrupt must be disabled
  during the access to avoid inconsistent data.
- Access to 16 or 32 bit variables is obviously not atomic on 8 bit CPUs
- and should be protected by disabling interrupts.
+\newline 
+Access to 16 or 32 bit variables is obviously not atomic on 8 bit CPUs and
+ should be protected by disabling interrupts.
  You're not automatically on the safe side if you use 8 bit variables though.
  We need an example here: f.e.
  on the 8051 the harmless looking 
@@ -11323,8 +11860,19 @@ counter\SpecialChar ~
 counter
 \family default 
  is located in data memory.
- Bugs like these are hard to reproduce and can cause a lot of trouble.
+\newline 
+Bugs like these are hard to reproduce and can cause a lot of trouble.
  
+\layout Subsubsection
+
+
+\begin_inset LatexCommand \label{sub:Common-interrupt-pitfall-stack-overflow}
+
+\end_inset 
+
+Common interrupt pitfall: 
+\emph on 
+stack overflow
 \layout Standard
 
 The return address and the registers used in the interrupt service routine
@@ -11355,6 +11903,16 @@ deepest
 
  subroutine when the stack is already in use for f.e.
  many return addresses.
+\layout Subsubsection
+
+
+\begin_inset LatexCommand \label{sub:Common-interrupt-pitfall-non-reentrant}
+
+\end_inset 
+
+Common interrupt pitfall: 
+\emph on 
+use of non-reentrant functions
 \layout Standard
 
 A special note here, int (16 bit) and long (32 bit) integer division
@@ -11377,8 +11935,7 @@ A special note here, int (16 bit) and long (32 bit) integer division
 
 \end_inset 
 
- operations are implemented using external support routines developed in
- ANSI-C.
+ operations are implemented using external support routines.
  If an interrupt service routine needs to do any of these operations then
  the support routines (as mentioned in a following section) will have to
  be recompiled using the
@@ -11420,8 +11977,39 @@ status Collapsed
 \end_inset 
 
  compiler option.
+\newline 
+Note, the type promotion
+\begin_inset LatexCommand \index{type promotion}
+
+\end_inset 
+
+ required by ANSI C can cause 16 bit routines to be used
+\begin_inset Marginal
+collapsed true
+
 \layout Standard
 
+
+\series bold 
+\SpecialChar ~
+!
+\end_inset 
+
+ without the programmer being aware of it.
+ See f.e.
+ the cast 
+\family typewriter 
+(unsigned char)(tail-1)
+\family default 
+ within the if clause in section 
+\begin_inset LatexCommand \ref{sub:A-Step-by Assembler Introduction}
+
+\end_inset 
+
+.
+\layout Standard
+\added_space_bottom bigskip 
 Calling other functions from an interrupt service routine is not recommended,
  avoid it if possible.
  Note that when some function is called from an interrupt service routine
@@ -11442,9 +12030,7 @@ nooverlay
 \emph default 
  if all parameters are passed in registers.
 \newline 
-
-\newline 
-Also see section 
+ Also see section 
 \begin_inset LatexCommand \ref{sub:Overlaying}
 
 \end_inset 
@@ -11462,21 +12048,30 @@ about Functions using private register banks.
 MCS51/DS390 Interrupt Service Routines
 \layout Standard
 
-Interrupt numbers and the corresponding address & descriptions for the Standard
- 8051/8052 are listed below.
- SDCC will automatically adjust the interrupt vector table to the maximum
- interrupt number specified.
+Interrupt
+\begin_inset LatexCommand \index{interrupt}
+
+\end_inset 
+
+ numbers and the corresponding address & descriptions for the Standard 8051/8052
+ are listed below.
+ SDCC will automatically adjust the 
+\begin_inset LatexCommand \index{interrupt vector table}
+
+\end_inset 
+
+ to the maximum interrupt number specified.
 \newline 
 
 \layout Standard
 \align center 
 
 \begin_inset  Tabular
-<lyxtabular version="3" rows="7" columns="3">
+<lyxtabular version="3" rows="9" columns="3">
 <features>
 <column alignment="center" valignment="top" leftline="true" width="0in">
-<column alignment="center" valignment="top" leftline="true" width="0in">
-<column alignment="center" valignment="top" leftline="true" rightline="true" width="0in">
+<column alignment="left" valignment="top" leftline="true" width="0in">
+<column alignment="left" valignment="top" leftline="true" rightline="true" width="0in">
 <row topline="true" bottomline="true">
 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
 \begin_inset Text
@@ -11551,7 +12146,7 @@ Timer 0
 
 \layout Standard
 
-0x000B
+0x000b
 \end_inset 
 </cell>
 </row>
@@ -11603,7 +12198,7 @@ Timer 1
 
 \layout Standard
 
-0x001B
+0x001b
 \end_inset 
 </cell>
 </row>
@@ -11633,8 +12228,8 @@ Serial
 \end_inset 
 </cell>
 </row>
-<row topline="true" bottomline="true">
-<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+<row topline="true">
+<cell multicolumn="1" alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
 \begin_inset Text
 
 \layout Standard
@@ -11655,7 +12250,57 @@ Timer 2 (8052)
 
 \layout Standard
 
-0x002B
+0x002b
+\end_inset 
+</cell>
+</row>
+<row topline="true">
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+...
+\end_inset 
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+\end_inset 
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+...
+\end_inset 
+</cell>
+</row>
+<row topline="true" bottomline="true">
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+n
+\end_inset 
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+\end_inset 
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+0x0003 + 8*n
 \end_inset 
 </cell>
 </row>
@@ -11693,7 +12338,7 @@ using
  This scheme may be advantageous for small interrupt service routines which
  have low register usage.
 \layout Standard
-
+\added_space_bottom bigskip 
 If the interrupt service routine is defined to be using a specific register
  bank then only 
 \emph on 
@@ -11701,16 +12346,31 @@ a, b, dptr
 \emph default 
  & psw are saved and restored, if such an interrupt service routine calls
  another function (using another register bank) then the entire register
- bank of the called function will be saved on the stack.
+ bank of the called function will be saved on the stack
+\begin_inset LatexCommand \index{stack}
+
+\end_inset 
+
+.
  This scheme is recommended for larger interrupt service routines.
 \layout Subsection
 
-HC08 Interrupt Service Routines
+HC08
+\begin_inset LatexCommand \index{HC08}
+
+\end_inset 
+
+ Interrupt Service Routines
 \layout Standard
+\added_space_bottom bigskip 
+Since the number of interrupts
+\begin_inset LatexCommand \index{HC08!interrupt}
 
-Since the number of interrupts available is chip specific and the interrupt
- vector table always ends at the last byte of memory, the interrupt numbers
- corresponds to the interrupt vectors in reverse order of address.
+\end_inset 
+
+ available is chip specific and the interrupt vector table always ends at
+ the last byte of memory, the interrupt numbers corresponds to the interrupt
+ vectors in reverse order of address.
  For example, interrupt 1 will use the interrupt vector at 0xfffc, interrupt
  2 will use the interrupt vector at 0xfffa, and so on.
  However, interrupt 0 (the reset vector at 0xfffe) is not redefinable in
@@ -11725,11 +12385,20 @@ Since the number of interrupts available is chip specific and the interrupt
 Z80 Interrupt Service Routines
 \layout Standard
 
-The Z80 uses several different methods for determining the correct interrupt
- vector depending on the hardware implementation.
- Therefore, SDCC ignores the optional interrupt number and does not attempt
- to generate an interrupt vector table.
-\layout Standard
+The Z80
+\begin_inset LatexCommand \index{Z80}
+
+\end_inset 
+
+ uses several different methods for determining the correct interrupt
+\begin_inset LatexCommand \index{Z80!interrupt}
+
+\end_inset 
+
+ vector depending on the hardware implementation.
+ Therefore, SDCC ignores the optional interrupt number and does not attempt
+ to generate an interrupt vector table.
+\layout Standard
 
 By default, SDCC generates code for a maskable interrupt, which uses a RETI
  instruction to return from the interrupt.
@@ -11756,7 +12425,7 @@ void nmi_isr (void) critical interrupt
 \newline 
 }
 \layout Standard
-
+\added_space_bottom bigskip 
 However if you need to create a non-interruptable interrupt service routine
  you would also require the 
 \emph on 
@@ -11796,7 +12465,7 @@ critical
 
 
 \family typewriter 
-int foo () critical
+int foo () __critical
 \begin_inset LatexCommand \index{critical}
 
 \end_inset 
@@ -11842,7 +12511,7 @@ critical
 
 
 \family typewriter 
-critical{ i++; }
+__critical{ i++; }
 \layout Standard
 
 More than one statement could have been included in the block.
@@ -11997,7 +12666,12 @@ On other architectures which have seperate opcodes for enabling and disabling
 
 \end_inset 
 
- (HC08):
+ (HC08
+\begin_inset LatexCommand \index{HC08!interrupt}
+
+\end_inset 
+
+):
 \layout Verse
 
 
@@ -12271,7 +12945,23 @@ possible exception: if a function is called ONLY from 'interrupt' functions
 \newline 
 
 \emph on 
-(pending: I don't think this has been done yet)
+(pending: Note, nowadays the 
+\emph default 
+using
+\emph on 
+ attribute has an effect on
+\emph default 
+\emph on 
+the generated code for a 
+\emph default 
+non-interrupt
+\emph on 
+ function
+\emph default 
+.
+\emph on 
+)
 \layout Standard
 
 An 
@@ -12311,7 +13001,7 @@ used
  own: I suggest using the default bank zero and taking the small performance
  hit.
 \layout Standard
-
+\added_space_bottom bigskip 
 It is most efficient if your ISR calls no other functions.
  If your ISR must call other functions, it is most efficient if those functions
  use the same bank as the ISR (see note 1 below); the next best is if the
@@ -12379,7 +13069,12 @@ _sdcc_external_startup()
 \end_inset 
 
  memory has to be explicitly enabled before it can be accessed or if the
- watchdog needs to be disabled, this is the place to do it.
+ watchdog
+\begin_inset LatexCommand \index{watchdog}
+
+\end_inset 
+
+ needs to be disabled, this is the place to do it.
  The startup code clears all internal data memory, 256 bytes by default,
  but from 0 to n-1 if 
 \emph on 
  is used.
  (recommended for Chipcon CC1010).
 \layout Standard
-
-See also the compiler option 
+\added_space_bottom bigskip 
+See also the compiler options 
 \emph on 
 -
 \begin_inset ERT
@@ -12425,6 +13120,25 @@ opt
 
 \begin_inset LatexCommand \index{-\/-no-xinit-opt}
 
+\end_inset 
+
+, 
+\emph on 
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash 
+/
+\end_inset 
+
+-main-return
+\emph default 
+
+\begin_inset LatexCommand \index{-\/-main-return}
+
 \end_inset 
 
  and section 
@@ -12432,21 +13146,30 @@ opt
 
 \end_inset 
 
-\SpecialChar ~
-about MCS51-variants.
+ about MCS51-variants.
 \layout Subsection
 
 HC08 Startup Code
 \layout Standard
+\added_space_bottom bigskip 
+The HC08
+\begin_inset LatexCommand \index{HC08}
+
+\end_inset 
 
-The HC08 startup code follows the same scheme as the MCS51 startup code.
+ startup code follows the same scheme as the MCS51 startup code.
 \layout Subsection
 
 Z80 Startup Code
 \layout Standard
+\added_space_bottom bigskip 
+On the Z80
+\begin_inset LatexCommand \index{Z80}
+
+\end_inset 
 
-On the Z80 the startup code is inserted by linking with crt0.o which is generated
from sdcc/device/lib/z80/crt0.s.
+ the startup code is inserted by linking with crt0.o which is generated from
+ sdcc/device/lib/z80/crt0.s.
  If you need a different startup code you can use the compiler option 
 \emph on 
 -
@@ -12502,7 +13225,7 @@ Starting from a small snippet of c-code this example shows for the MCS51
 
 \family typewriter 
 \size footnotesize 
-unsigned char far
+unsigned char __far
 \begin_inset LatexCommand \index{far (storage class)}
 
 \end_inset 
@@ -12512,7 +13235,7 @@ unsigned char far
 
 \end_inset 
 
- at
__at
 \begin_inset LatexCommand \index{at}
 
 \end_inset 
@@ -12522,14 +13245,92 @@ unsigned char far
 
 \end_inset 
 
- 0x7f00 buf[0x100];
+(0x7f00) buf[0x100];
 \begin_inset LatexCommand \index{Aligned array}
 
 \end_inset 
 
 
 \newline 
-unsigned char head,tail;
+unsigned char head, tail;\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+/* if interrupts
+\begin_inset LatexCommand \index{interrupt}
+
+\end_inset 
+
+ are involved see
+\newline 
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+section 
+\begin_inset LatexCommand \ref{sub:Common-interrupt-pitfall-volatile}
+
+\end_inset 
+
+ about
+\series bold 
+ volatile
+\series default 
+ */
 \newline 
 
 \newline 
@@ -12541,7 +13342,34 @@ void to_buffer( unsigned char c )
 \SpecialChar ~
 \SpecialChar ~
 \SpecialChar ~
-if( head != tail-1 ) 
+if( head != (unsigned char)(tail-1) )\SpecialChar ~
+/* cast 
+\series bold 
+needed
+\series default 
+ to avoid promotion
+\begin_inset LatexCommand \index{promotion to signed int}
+
+\end_inset 
+
+
+\begin_inset LatexCommand \index{type promotion}
+
+\end_inset 
+
+ to integer */
+\begin_inset Marginal
+collapsed true
+
+\layout Standard
+
+
+\series bold 
+\SpecialChar ~
+!
+\end_inset 
+
+
 \newline 
 \SpecialChar ~
 \SpecialChar ~
@@ -12555,6 +13383,18 @@ buf[ head++ ] = c;\SpecialChar ~
 \SpecialChar ~
 \SpecialChar ~
 \SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
 /* access to a 256 byte aligned array */
 \newline 
 } 
@@ -12625,7 +13465,22 @@ mov\SpecialChar ~
 \SpecialChar ~
 r2,dpl 
 \newline 
-;buffer.c if( head != tail-1 ) 
+;buffer.c if( head != (unsigned char)(tail-1) ) \SpecialChar ~
+/* cast 
+\series bold 
+needed
+\series default 
+ to avoid promotion
+\begin_inset LatexCommand \index{promotion to signed int}
+
+\end_inset 
+
+
+\begin_inset LatexCommand \index{type promotion}
+
+\end_inset 
+
+ to integer */
 \newline 
 \SpecialChar ~
 \SpecialChar ~
@@ -12762,9 +13617,9 @@ The new file buffer.c should compile with only one warning about the unreference
 
 \family typewriter 
 \size footnotesize 
-unsigned char far at 0x7f00 buf[0x100];
+unsigned char __far __at(0x7f00) buf[0x100];
 \newline 
-unsigned char head,tail;
+unsigned char head, tail;
 \newline 
 #define USE_ASSEMBLY (1)
 \newline 
@@ -12782,7 +13637,7 @@ void to_buffer( unsigned char c )
 \SpecialChar ~
 \SpecialChar ~
 \SpecialChar ~
-if( head != tail-1 )
+if( head != (unsigned char)(tail-1) )
 \newline 
 \SpecialChar ~
 \SpecialChar ~
@@ -12850,7 +13705,7 @@ _asm
 ; If we were still using r2,r3 we would have to push them here.
  
 \newline 
-; if( head != tail-1 )
+; if( head != (unsigned char)(tail-1) )
 \newline 
 \SpecialChar ~
 \SpecialChar ~
@@ -13027,13 +13882,8 @@ _endasm
 \layout Standard
 
 The inline assembler code can contain any valid code understood by the assembler
-, this includes any assembler directives and comment lines
-\begin_inset Foot
-collapsed false
-
-\layout Standard
-
-The assembler does not like some characters like ':' or ''' in comments.
+, this includes any assembler directives and comment lines.
+ The assembler does not like some characters like ':' or ''' in comments.
  You'll find an 100+ pages assembler manual in sdcc/as/doc/asxhtm.html
 \begin_inset LatexCommand \index{asXXXX (as-gbz80, as-hc08, asx8051, as-z80)}
 
@@ -13044,11 +13894,16 @@ The assembler does not like some characters like ':' or ''' in comments.
 
 \end_inset 
 
+ or online at 
+\begin_inset LatexCommand \url{http://svn.sourceforge.net/viewvc/*checkout*/sdcc/trunk/sdcc/as/doc/asxhtm.html}
 
 \end_inset 
 
+\SpecialChar ~
 .
- The compiler does not do any validation of the code within the 
+\layout Standard
+
+The compiler does not do any validation of the code within the 
 \family typewriter 
 _asm
 \begin_inset LatexCommand \index{\_asm}
@@ -13193,7 +14048,7 @@ volatile
 \newline 
 
 \newline 
-void simpleInterrupt(void) interrupt
+void simpleInterrupt(void) __interrupt
 \begin_inset LatexCommand \index{interrupt}
 
 \end_inset 
@@ -13203,7 +14058,7 @@ void simpleInterrupt(void) interrupt
 
 \end_inset 
 
- 1
+ (1)
 \newline 
 {
 \newline 
@@ -13217,7 +14072,7 @@ counter++;
 \newline 
 
 \newline 
-void nakedInterrupt(void) interrupt 2 _naked
+void nakedInterrupt(void) __interrupt (2) __naked
 \newline 
 {
 \newline 
@@ -13286,6 +14141,20 @@ For an 8051 target, the generated simpleInterrupt looks like:
 
 
 \family typewriter 
+Note, this is an 
+\emph on 
+outdated
+\emph default 
+ example, recent versions of SDCC generate
+\newline 
+the 
+\emph on 
+same
+\emph default 
+ code for simpleInterrupt() and nakedInterrupt()!
+\newline 
+
+\newline 
 _simpleInterrupt:
 \newline 
 \SpecialChar ~
@@ -14125,7 +14994,7 @@ pop  _bp
 \SpecialChar ~
 ret
 \layout Standard
-
+\added_space_bottom bigskip 
 The compiling and linking procedure remains the same, however note the extra
  entry & exit linkage required for the assembler code, _bp is the stack
  frame pointer and is used to compute the offset into the stack for parameters
@@ -14160,8 +15029,8 @@ For signed & unsigned int (16 bit) and long (32 bit) variables, division,
 \begin_inset  Tabular
 <lyxtabular version="3" rows="11" columns="2">
 <features>
-<column alignment="center" valignment="top" leftline="true" width="0">
-<column alignment="center" valignment="top" leftline="true" rightline="true" width="0">
+<column alignment="left" valignment="top" leftline="true" width="0">
+<column alignment="left" valignment="top" leftline="true" rightline="true" width="0">
 <row topline="true" bottomline="true">
 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
 \begin_inset Text
@@ -14441,9 +15310,9 @@ Floating Point Support
 
 \layout Standard
 
-SDCC supports IEEE (single precision 4 bytes) floating point numbers.The
- floating point support routines are derived from gcc's floatlib.c and consist
- of the following routines:
+SDCC supports IEEE (single precision 4 bytes) floating point numbers.
+ The floating point support routines are derived from gcc's floatlib.c and
consist of the following routines:
 \newline 
 
 \layout Standard
@@ -14454,8 +15323,8 @@ SDCC supports IEEE (single precision 4 bytes) floating point numbers.The
 \begin_inset  Tabular
 <lyxtabular version="3" rows="17" columns="2">
 <features>
-<column alignment="center" valignment="top" leftline="true" width="0">
-<column alignment="center" valignment="top" leftline="true" rightline="true" width="0">
+<column alignment="left" valignment="top" leftline="true" width="0">
+<column alignment="left" valignment="top" leftline="true" rightline="true" width="0">
 <row topline="true" bottomline="true">
 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
 \begin_inset Text
@@ -15076,7 +15945,7 @@ convert long to floating point number
 \newline 
 
 \layout Standard
-
+\added_space_bottom bigskip 
 These support routines are developed in ANSI-C so there is room for space
  and speed improvement
 \begin_inset Foot
@@ -15084,7 +15953,12 @@ collapsed false
 
 \layout Standard
 
-The floating point routines for the mcs51 are implemented in assembler
+These floating point routines (
+\emph on 
+not
+\emph default 
+ sinf(), cosf(), ...) for the mcs51 are implemented in assembler.
 \end_inset 
 
 .
@@ -15147,6 +16021,19 @@ putchar()
  routines.
  SDCC does not know whether the system connects to a serial line with or
  without handshake, LCD, keyboard or other device.
+ And whether a 
+\family typewriter 
+lf
+\family default 
+ to 
+\family typewriter 
+crlf
+\family default 
+ conversion within 
+\family typewriter 
+putchar()
+\family default 
+ is intended.
  You'll find examples for serial routines f.e.
  in sdcc/device/lib.
 \layout Standard
@@ -15187,7 +16074,7 @@ DUSE_FLOATS=1
  on the command line.
  Use
 \emph on 
--
+ -
 \begin_inset ERT
 status Collapsed
 
@@ -15234,7 +16121,7 @@ printf_tiny()
 
 
 \family default 
- and 
(subset of printf using less than 270 bytes) and 
 \family typewriter 
 printf_fast()
 \begin_inset LatexCommand \index{printf\_fast() (mcs51)}
@@ -15252,15 +16139,64 @@ and
 
 
 \family default 
- which should fit the requirements of many embedded systems (printf_fast()
- can be customized by unsetting #defines to 
+ (floating-point aware version of printf_fast) which should fit the requirements
+ of many embedded systems (printf_fast() can be customized by unsetting
+ #defines to 
 \emph on 
 not
 \emph default 
  support long variables and field widths).
+\layout Subsubsection
+
+<malloc.h>
+\begin_inset LatexCommand \index{malloc.h}
+
+\end_inset 
+
+
+\layout Standard
+
+As of SDCC 2.6.2 you no longer need to call an initialization routine before
+ using dynamic memory allocation
+\begin_inset LatexCommand \index{dynamic memory allocation (malloc)}
+
+\end_inset 
+
+ and a default heap
+\begin_inset LatexCommand \index{heap (malloc)}
+
+\end_inset 
+
+ space of 1024 bytes is provided for malloc to allocate memory from.
+ If you need a different heap size you need to recompile _heap.c with the
+ required size defined in HEAP_SIZE.
+ It is recommended to make a copy of this file into your project directory
+ and compile it there with:
+\layout Verse
+
+
+\family typewriter 
+sdcc -c _heap.c -D HEAD_SIZE=2048
+\newline 
+
+\family default 
+And then link it with:
+\layout Verse
+
+
+\family typewriter 
+sdcc main.rel _heap.rel
+\newline 
+
 \layout Subsection
 
-Math functions (sin, pow, sqrt etc.)
+Math functions (sinf, powf, sqrtf etc.)
+\layout Subsubsection
+
+<math.h>
+\layout Standard
+
+See definitions in file <math.h>.
 \layout Subsection
 
 Other libraries
@@ -15308,7 +16244,9 @@ C, CAN, Ethernet, Profibus, Modbus, USB, SPI, JTAG ...), Media (IDE, Memory
 
 \SpecialChar ~
 would certainly like to hear about it.
- Programmers coding for embedded systems are not especially famous for being
+\layout Standard
+\added_space_bottom bigskip 
+Programmers coding for embedded systems are not especially famous for being
  enthusiastic, so don't expect a big hurray but as the mailing list is searchabl
 e these references are very valuable.
  Let's help to create a climate where information is shared.
@@ -15565,6 +16503,11 @@ status Collapsed
 \layout Section
 
 Pragmas
+\begin_inset LatexCommand \label{sec:Pragmas}
+
+\end_inset 
+
+
 \begin_inset LatexCommand \index{Pragmas}
 
 \end_inset 
@@ -15575,17 +16518,25 @@ Pragmas
 SDCC supports the following #pragma directives:
 \layout Itemize
 
+
+\series bold 
 save
+\series default 
+
 \begin_inset LatexCommand \index{\#pragma save}
 
 \end_inset 
 
- - this will save all current options to the save/restore stack.
+ - this will save most current options to the save/restore stack.
  See #pragma\SpecialChar ~
 restore.
 \layout Itemize
 
+
+\series bold 
 restore
+\series default 
+
 \begin_inset LatexCommand \index{\#pragma restore}
 
 \end_inset 
@@ -15600,7 +16551,11 @@ save.
 
 \layout Itemize
 
+
+\series bold 
 callee_saves
+\series default 
+
 \begin_inset LatexCommand \index{\#pragma callee\_saves}
 
 \end_inset 
@@ -15646,7 +16601,11 @@ callee_saves
  is appended to the list of functions specified in the command line.
 \layout Itemize
 
+
+\series bold 
 exclude
+\series default 
+
 \begin_inset LatexCommand \index{\#pragma exclude}
 
 \end_inset 
@@ -15698,7 +16657,11 @@ none
 .
 \layout Itemize
 
+
+\series bold 
 less_pedantic
+\series default 
+
 \begin_inset LatexCommand \index{\#pragma less\_pedantic}
 
 \end_inset 
@@ -15707,7 +16670,11 @@ less_pedantic
  your own now ;-(
 \layout Itemize
 
-disable_warning <nnnn>
+
+\series bold 
+disable_warning
+\series default 
+ <nnnn>
 \begin_inset LatexCommand \index{\#pragma disable\_warning}
 
 \end_inset 
@@ -15715,7 +16682,11 @@ disable_warning <nnnn>
  - the compiler will not warn you anymore about warning number <nnnn>.
 \layout Itemize
 
+
+\series bold 
 nogcse
+\series default 
+
 \begin_inset LatexCommand \index{\#pragma nogcse}
 
 \end_inset 
@@ -15723,7 +16694,11 @@ nogcse
  - will stop global common subexpression elimination.
 \layout Itemize
 
+
+\series bold 
 noinduction
+\series default 
+
 \begin_inset LatexCommand \index{\#pragma noinduction}
 
 \end_inset 
@@ -15731,7 +16706,11 @@ noinduction
  - will stop loop induction optimizations.
 \layout Itemize
 
+
+\series bold 
 noinvariant
+\series default 
+
 \begin_inset LatexCommand \index{\#pragma noinvariant}
 
 \end_inset 
@@ -15745,7 +16724,11 @@ noinvariant
 .
 \layout Itemize
 
+
+\series bold 
 noiv
+\series default 
+
 \begin_inset LatexCommand \index{\#pragma noiv}
 
 \end_inset 
@@ -15755,7 +16738,12 @@ noiv
 
 \end_inset 
 
- vector table entries for all ISR functions defined after the pragma.
+ vector table
+\begin_inset LatexCommand \index{interrupt vector table}
+
+\end_inset 
+
+ entries for all ISR functions defined after the pragma.
  This is useful in cases where the interrupt vector table must be defined
  manually, or when there is a secondary, manually defined interrupt vector
  table (e.g.
@@ -15770,7 +16758,11 @@ noiv
 about interrupts.
 \layout Itemize
 
+
+\series bold 
 nojtbound
+\series default 
+
 \begin_inset LatexCommand \index{\#pragma nojtbound}
 
 \end_inset 
@@ -15785,7 +16777,11 @@ nojtbound
 .
 \layout Itemize
 
+
+\series bold 
 noloopreverse
+\series default 
+
 \begin_inset LatexCommand \index{\#pragma noloopreverse}
 
 \end_inset 
@@ -15793,7 +16789,11 @@ noloopreverse
  - Will not do loop reversal optimization
 \layout Itemize
 
+
+\series bold 
 nooverlay
+\series default 
+
 \begin_inset LatexCommand \index{\#pragma nooverlay}
 
 \end_inset 
@@ -15802,7 +16802,11 @@ nooverlay
  function.
 \layout Itemize
 
+
+\series bold 
 stackauto
+\series default 
+
 \begin_inset LatexCommand \index{\#pragma stackauto}
 
 \end_inset 
@@ -15830,25 +16834,39 @@ status Collapsed
  Parameters and Local Variables.
 \layout Itemize
 
-opt_code_speed 
+
+\series bold 
+opt_code_speed
+\series default 
 \begin_inset LatexCommand \index{\#pragma opt\_code\_speed}
 
 \end_inset 
 
 - The compiler will optimize code generation towards fast code, possibly
  at the expense of code size.
+ Currently this has little effect.
 \layout Itemize
 
-opt_code_size 
+
+\series bold 
+opt_code_size
+\series default 
 \begin_inset LatexCommand \index{\#pragma opt\_code\_size}
 
 \end_inset 
 
 - The compiler will optimize code generation towards compact code, possibly
  at the expense of code speed.
+ Currently this has little effect.
 \layout Itemize
 
-opt_code_balanced 
+
+\series bold 
+opt_code_balanced
+\series default 
 \begin_inset LatexCommand \index{\#pragma opt\_code\_balanced}
 
 \end_inset 
@@ -15859,7 +16877,11 @@ opt_code_balanced
  
 \layout Itemize
 
-std_sdcc89 
+
+\series bold 
+std_sdcc89
+\series default 
 \begin_inset LatexCommand \index{\#pragma std\_sdcc89}
 
 \end_inset 
@@ -15868,7 +16890,11 @@ std_sdcc89
  with the standard (default).
 \layout Itemize
 
-std_c89 
+
+\series bold 
+std_c89
+\series default 
 \begin_inset LatexCommand \index{\#pragma std\_c89}
 
 \end_inset 
@@ -15877,7 +16903,11 @@ std_c89
  standard.
 \layout Itemize
 
-std_sdcc99 
+
+\series bold 
+std_sdcc99
+\series default 
 \begin_inset LatexCommand \index{\#pragma std\_sdcc99}
 
 \end_inset 
@@ -15886,7 +16916,11 @@ std_sdcc99
  with the standard (incomplete support).
 \layout Itemize
 
-std_c99 
+
+\series bold 
+std_c99
+\series default 
 \begin_inset LatexCommand \index{\#pragma std\_c99}
 
 \end_inset 
@@ -15895,163 +16929,396 @@ std_c99
  standard (incomplete support).
 \layout Itemize
 
-codeseg <name>
+
+\series bold 
+codeseg
+\series default 
+ <name>
 \begin_inset LatexCommand \index{\#pragma codeseg}
 
 \end_inset 
 
 - Use this name (max.
  8 characters) for the code segment.
+ See option -
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash 
+/
+\end_inset 
+
+-codeseg.
 \layout Itemize
 
-constseg <name>
+
+\series bold 
+constseg
+\series default 
+ <name>
 \begin_inset LatexCommand \index{\#pragma constseg}
 
 \end_inset 
 
 - Use this name (max.
  8 characters) for the const segment.
+ See option -
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash 
+/
+\end_inset 
+
+-constseg.
 \layout Standard
 
-SDCPP supports the following #pragma directives:
+The preprocessor SDCPP
+\begin_inset LatexCommand \index{sdcpp (preprocessor)}
+
+\end_inset 
+
+ supports the following #pragma directives:
 \layout Itemize
 
-preproc_asm
-\begin_inset LatexCommand \index{\#pragma preproc\_asm}
+
+\series bold 
+pedantic_parse_number
+\series default 
+
+\begin_inset LatexCommand \index{\#pragma pedantic\_parse\_number}
 
 \end_inset 
 
- (+ | -) - switch _asm _endasm block preprocessing on / off.
- Default is on.
-\layout Standard
+ (+ | -) - 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.
 
-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.
- 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.
+\emph on 
+ Note: this functionality is not in conformance with standard!
 \layout Verse
 
 
 \family typewriter 
-#pragma save
-\begin_inset LatexCommand \index{\#pragma save}
+#pragma pedantic_parse_number +
+\begin_inset LatexCommand \index{\#pragma pedantic\_parse\_number}
 
 \end_inset 
 
- \SpecialChar ~
+
+\newline 
+
+\newline 
+#define LO_B(x) ((x) & 0xff)
+\newline 
+
+\newline 
+unsigned char foo(void)
+\newline 
+{
+\newline 
 \SpecialChar ~
 \SpecialChar ~
 \SpecialChar ~
+unsigned char c=0xfe-LO_B(3);
+\newline 
+
+\newline 
 \SpecialChar ~
 \SpecialChar ~
 \SpecialChar ~
-/* save the current settings */ 
+return c;
 \newline 
-#pragma nogcse
-\begin_inset LatexCommand \index{\#pragma nogcse}
+}
+\newline 
+
+\layout Itemize
+
+
+\series bold 
+preproc_asm
+\series default 
+
+\begin_inset LatexCommand \index{\#pragma preproc\_asm}
 
 \end_inset 
 
- \SpecialChar ~
+ (+ | -) - switch _asm _endasm block preprocessing on / off.
+ Default is on.
+ You use this prama to define multilines of assembly code.
+ This will prevent the preprocessor from changing the formating required
+ by assembly code.
+ Below is an example on how to use this pragma.
+\layout Verse
+
+
+\family typewriter 
+#pragma preproc_asm -
+\begin_inset LatexCommand \index{\#pragma preproc\_asm}
+
+\end_inset 
+
+
+\newline 
+#define MYDELAY _asm
+\newline 
 \SpecialChar ~
 \SpecialChar ~
 \SpecialChar ~
+nop ;my assembly comment...
+\newline 
 \SpecialChar ~
-/* turnoff global subexpression elimination */ 
+\SpecialChar ~
+\SpecialChar ~
+nop
+\newline 
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+nop
+\newline 
+_endasm
+\newline 
+#pragma preproc_asm +
 \newline 
-#pragma noinduction
-\begin_inset LatexCommand \index{\#pragma noinduction}
-
-\end_inset 
 
- /* turn off induction optimizations */ 
 \newline 
-int foo (
+void foo (void
 \newline 
 { 
 \newline 
 \SpecialChar ~
- \SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
  ...
  
 \newline 
 \SpecialChar ~
- \SpecialChar ~
- /* large code */ 
+\SpecialChar ~
+\SpecialChar ~
+ MYDELAY;
 \newline 
 \SpecialChar ~
- \SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
  ...
  
 \newline 
 } 
 \newline 
-#pragma restore
-\begin_inset LatexCommand \index{\#pragma restore}
-
-\end_inset 
-
- /* turn the optimizations back on */
-\layout Standard
-
-The compiler will generate a warning message when extra space is allocated.
- It is strongly recommended that the save and restore pragma's be used when
- changing options for a function.
-\layout Section
-
-Defines Created by the Compiler
-\layout Standard
 
-The compiler creates the following #defines
-\begin_inset LatexCommand \index{\#defines}
+\layout Itemize
 
-\end_inset 
 
+\series bold 
+sdcc_hash
+\series default 
 
-\begin_inset LatexCommand \index{Defines created by the compiler}
+\begin_inset LatexCommand \index{\#pragma sdcc\_hash}
 
 \end_inset 
 
-:
+ (+ | -) - Allow "naked" hash in macro definition, for example:
 \newline 
 
-\layout Standard
-
+\family typewriter 
+#define DIR_LO(x) #(x & 0xff)
+\family default 
 
-\begin_inset  Tabular
-<lyxtabular version="3" rows="11" columns="2">
-<features>
-<column alignment="center" valignment="top" leftline="true" width="0">
-<column alignment="center" valignment="top" leftline="true" rightline="true" width="0">
-<row topline="true" bottomline="true">
-<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
-\begin_inset Text
+\newline 
+Default is off.
+ Below is an example on how to use this pragma.
+\layout Verse
 
-\layout Standard
 
+\family typewriter 
+#pragma preproc_asm +
+\newline 
+#pragma sdcc_hash +
+\begin_inset LatexCommand \index{\#pragma sdcc\_hash}
 
-\series bold 
-#define
 \end_inset 
-</cell>
-<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
-\begin_inset Text
 
-\layout Standard
 
+\newline 
 
-\series bold 
-Description
-\end_inset 
-</cell>
-</row>
-<row topline="true">
-<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
-\begin_inset Text
+\newline 
+#define ROMCALL(x) 
+\backslash 
+
+\newline 
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+mov R6_B3, #(x & 0xff) 
+\backslash 
+
+\newline 
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+mov R7_B3, #((x >> 8) & 0xff) 
+\backslash 
+
+\newline 
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+lcall __romcall
+\newline 
+
+\newline 
+...
+\newline 
+_asm
+\newline 
+ROMCALL(72)
+\newline 
+_endasm;
+\newline 
+...
+\newline 
+
+\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.
+ 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.
+\layout Verse
+
+
+\family typewriter 
+#pragma save
+\begin_inset LatexCommand \index{\#pragma save}
+
+\end_inset 
+
+ \SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+/* save the current settings */ 
+\newline 
+#pragma nogcse
+\begin_inset LatexCommand \index{\#pragma nogcse}
+
+\end_inset 
+
+ \SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+/* turnoff global subexpression elimination */ 
+\newline 
+#pragma noinduction
+\begin_inset LatexCommand \index{\#pragma noinduction}
+
+\end_inset 
+
+ /* turn off induction optimizations */ 
+\newline 
+int foo () 
+\newline 
+{ 
+\newline 
+\SpecialChar ~
+ \SpecialChar ~
+ ...
+\newline 
+\SpecialChar ~
+ \SpecialChar ~
+ /* large code */ 
+\newline 
+\SpecialChar ~
+ \SpecialChar ~
+ ...
+\newline 
+} 
+\newline 
+#pragma restore
+\begin_inset LatexCommand \index{\#pragma restore}
+
+\end_inset 
+
+ /* turn the optimizations back on */
+\layout Standard
+
+The compiler will generate a warning message when extra space is allocated.
+ It is strongly recommended that the save and restore pragma's be used when
+ changing options for a function.
+\newline 
+
+\newline 
+
+\newline 
+
+\layout Section
+
+Defines Created by the Compiler
+\layout Standard
+
+The compiler creates the following #defines
+\begin_inset LatexCommand \index{\#defines}
+
+\end_inset 
+
+
+\begin_inset LatexCommand \index{Defines created by the compiler}
+
+\end_inset 
+
+:
+\newline 
+
+\layout Standard
+
+
+\begin_inset  Tabular
+<lyxtabular version="3" rows="11" columns="2">
+<features>
+<column alignment="left" valignment="top" leftline="true" width="3in">
+<column alignment="left" valignment="top" leftline="true" rightline="true" width="3in">
+<row topline="true" bottomline="true">
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+
+\series bold 
+#define
+\end_inset 
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+
+\series bold 
+Description
+\end_inset 
+</cell>
+</row>
+<row topline="true">
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
 
 \layout Standard
 
@@ -16068,8 +17335,8 @@ SDCC
 
 \layout Standard
 
-this Symbol is always defined.
- Since version 2.5.6 it's this version number as an int (ex.
+Always defined.
+ Since version 2.5.6 the version number as an int (ex.
  256)
 \end_inset 
 </cell>
@@ -16095,7 +17362,7 @@ SDCC_mcs51
 
 \end_inset 
 
-, etc
+, etc.
 \end_inset 
 </cell>
 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
@@ -16103,7 +17370,7 @@ SDCC_mcs51
 
 \layout Standard
 
-depending on the model used (e.g.: -mds390
+depending on the model used (e.g.: -mds390)
 \end_inset 
 </cell>
 </row>
@@ -16459,17 +17726,17 @@ sfr
 
 
 \family typewriter 
-sfr at 0x92 _XPAGE; /* Cypress EZ-USB family */
+__sfr __at (0x92) _XPAGE; /* Cypress EZ-USB family */
 \layout Verse
 
 
 \family typewriter 
-sfr at 0xaf _XPAGE; /* some Silicon Labs (Cygnal) chips */
+__sfr __at (0xaf) _XPAGE; /* some Silicon Labs (Cygnal) chips */
 \layout Verse
 
 
 \family typewriter 
-sfr at 0xaa _XPAGE; /* some Silicon Labs (Cygnal) chips */
+__sfr __at (0xaa) _XPAGE; /* some Silicon Labs (Cygnal) chips */
 \layout Standard
 
 For more exotic implementations further customizations may be needed.
@@ -16483,7 +17750,7 @@ For more exotic implementations further customizations may be needed.
 
 Other Features available by SFR
 \layout Standard
-
+\added_space_bottom bigskip 
 Some MCS51 variants offer features like Double DPTR
 \begin_inset LatexCommand \index{DPTR}
 
@@ -16497,8 +17764,18 @@ Some MCS51 variants offer features like Double DPTR
 
 DS400 port
 \layout Standard
+\added_space_bottom bigskip 
+The DS80C400
+\begin_inset LatexCommand \index{DS80C400}
+
+\end_inset 
 
-The DS80C400 microcontroller has a rich set of peripherals.
+
+\begin_inset LatexCommand \index{DS400}
+
+\end_inset 
+
+ microcontroller has a rich set of peripherals.
  In its built-in ROM library it includes functions to access some of the
  features, among them is a TCP stack with IP4 and IP6 support.
  Library headers (currently in beta status) and other files are provided
@@ -16516,7 +17793,7 @@ The DS80C400 microcontroller has a rich set of peripherals.
 The Z80 and gbz80 port
 \layout Standard
 
-SDCC can target both the Zilog 
+SDCC can target both the Zilog Z80
 \begin_inset LatexCommand \index{Z80}
 
 \end_inset 
@@ -16536,15 +17813,20 @@ regressions tests
 
 
 \emph default 
- as the MCS51 and DS390 ports, so floating point support, support for long
+ (see section 
+\begin_inset LatexCommand \ref{sec:Quality-control}
+
+\end_inset 
+
+) as the MCS51 and DS390 ports, so floating point support, support for long
  variables and bitfield support is fine.
  See mailing lists and forums about interrupt routines.
 \layout Standard
-
+\added_space_bottom bigskip 
 As always, the code is the authoritative reference - see z80/ralloc.c and
  z80/gen.c.
  The stack
-\begin_inset LatexCommand \index{stack}
+\begin_inset LatexCommand \index{Z80!stack}
 
 \end_inset 
 
@@ -16552,7 +17834,7 @@ As always, the code is the authoritative reference - see z80/ralloc.c and
  IX is used as the base pointer, HL and IY are used as a temporary registers,
  and BC and DE are available for holding variables.
  Return values
-\begin_inset LatexCommand \index{return value}
+\begin_inset LatexCommand \index{Z80!return value}
 
 \end_inset 
 
@@ -16566,7 +17848,7 @@ As always, the code is the authoritative reference - see z80/ralloc.c and
 The HC08 port
 \layout Standard
 
-The port to the Motorola HC08
+The port to the Freescale/Motorola HC08
 \begin_inset LatexCommand \index{HC08}
 
 \end_inset 
@@ -16577,12 +17859,16 @@ The port to the Motorola HC08
  unoptimized.
  Some of the SDCC's standard C library functions have embedded non-HC08
  inline assembly and so are not yet usable.
-\newline 
+\layout Standard
+\added_space_bottom bigskip 
+The HC08 port passes the regression test suite (see section 
+\begin_inset LatexCommand \ref{sec:Quality-control}
 
-\newline 
+\end_inset 
 
+).
 \layout Section
-
+\pagebreak_top 
 The PIC14 port
 \layout Standard
 
@@ -16592,7 +17878,17 @@ The 14bit PIC
 \end_inset 
 
  port still requires a major effort from the development community.
- However it can work for very simple code.
+ However it can work for simple code.
+ It passes its (smaller set of) regression tests
+\begin_inset LatexCommand \index{Regression test (PIC14)}
+
+\end_inset 
+
+ in the directory 
+\shape italic 
+sdcc/src/regression
+\shape default 
+.
 \layout Subsection
 
 C code and 14bit PIC code page
@@ -16616,19 +17912,13 @@ The linker organizes allocation for the code page and RAM banks.
  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 treats all local variables of a single C file as being in
- the same RAM bank unless it is an extern.
 \newline 
 
 \newline 
 To get the best follow these guide lines:
 \layout Enumerate
 
-make local functions static, as non static functions require code page selection
- overhead.
-\layout Enumerate
-
-Make local variables static as extern variables require RAM bank selection
+Make local functions static, as non static functions require code page selection
  overhead.
 \layout Enumerate
 
@@ -16637,24 +17927,29 @@ For devices that have multiple code pages it is more efficient to use the
  for the 16F877 use 4 separate files and i.e.
  for the 16F874 use 2 separate files.
  This way the linker can put the code for each file into different code
- pages and the compiler can allocate reusable variables more efficiently
- and there's less page selection overhead.
+ pages and there's less page selection overhead.
+\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'.
+ instruction set), use 'unsigned char' whereever possible instead of 'int'.
 \layout Subsection
 
 Creating a device include file 
 \layout Standard
 
-For generating a device include file use the support perl script inc2h.pl
- kept in directory support/script.
+For generating a device include file
+\begin_inset LatexCommand \index{PIC14!Header files}
+
+\end_inset 
+
+ use the support perl script inc2h.pl kept in directory support/script.
 \layout Subsection
 
 Interrupt code
 \layout Standard
 
-For the interrupt function, use the keyword 'interrupt'
-\begin_inset LatexCommand \index{interrupt}
+For the interrupt function, use the keyword '__interrupt'
+\begin_inset LatexCommand \index{PIC14!interrupt}
 
 \end_inset 
 
@@ -16665,7 +17960,7 @@ For the interrupt function, use the keyword 'interrupt'
 
 
 \family typewriter 
-void Intr(void) interrupt 0
+void Intr(void) __interrupt 0
 \newline 
 {
 \newline 
@@ -16824,7 +18119,51 @@ status Collapsed
 /
 \end_inset 
 
--debug-extra emit debug info in assembly output
+-debug-extra
+\begin_inset LatexCommand \index{PIC14!Options!-\/-debug-extra}
+
+\end_inset 
+
+ emit debug info in assembly output
+\layout List
+\labelwidthstring 00.00.0000
+
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash 
+/
+\end_inset 
+
+-no-pcode-opt
+\begin_inset LatexCommand \index{PIC14!Options!-\/-no-pcode-opt}
+
+\end_inset 
+
+ disable (slightly faulty) optimization on pCode
+\layout List
+\labelwidthstring 00.00.0000
+
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash 
+/
+\end_inset 
+
+-stack-loc
+\begin_inset LatexCommand \index{PIC14!Options!-\/-stack-loc}
+
+\end_inset 
+
+ sets the lowest address of the argument passing stack (defaults to a suitably
+ large shared databank to reduce BANKSEL overhead)
 \layout List
 \labelwidthstring 00.00.0000
 
@@ -16838,7 +18177,12 @@ status Collapsed
 /
 \end_inset 
 
--no-pcode-opt disable (slightly faulty) optimization on pCode
+-stack-size
+\begin_inset LatexCommand \index{PIC14!Options!-\/-stack-size}
+
+\end_inset 
+
+ sets the size if the argument passing stack (default: 16, minimum: 4)
 \layout Subsection
 
 The library
@@ -16885,7 +18229,12 @@ XXX
 \layout Standard
 
 This warning can usually be ignored due to the very good compatibility amongst
- 14 bit PIC devices.
+ 14 bit PIC
+\begin_inset LatexCommand \index{PIC14}
+
+\end_inset 
+
+ devices.
 \layout Standard
 
 You might also consider recompiling the library for your specific device
@@ -16919,17 +18268,32 @@ main()
 not
 \series default 
  be initialized.
-\layout Section
-
-The PIC16
-\begin_inset LatexCommand \index{PIC16}
+\family typewriter 
+\size footnotesize 
 
-\end_inset 
+\begin_inset Marginal
+collapsed true
 
- port
 \layout Standard
 
-The PIC16
+
+\series bold 
+\SpecialChar ~
+!
+\end_inset 
+
+
+\layout Section
+\pagebreak_top 
+The PIC16
+\begin_inset LatexCommand \index{PIC16}
+
+\end_inset 
+
+ port
+\layout Standard
+
+The PIC16
 \begin_inset LatexCommand \index{PIC16}
 
 \end_inset 
@@ -17178,7 +18542,12 @@ status Collapsed
 /
 \end_inset 
 
--callee-saves See -
+-callee-saves
+\begin_inset LatexCommand \index{PIC16!Options!-\/-callee-saves}
+
+\end_inset 
+
+ See -
 \begin_inset ERT
 status Collapsed
 
@@ -17202,7 +18571,12 @@ status Collapsed
 /
 \end_inset 
 
--all-callee-saves All function arguments are passed on stack by default.
+-all-callee-saves
+\begin_inset LatexCommand \index{PIC16!Options!-\/-all-callee-saves}
+
+\end_inset 
+
+ All function arguments are passed on stack by default.
  
 \emph on 
 There is no need to specify this in the command line.
@@ -17219,8 +18593,12 @@ status Collapsed
 /
 \end_inset 
 
--fommit-frame-pointer Frame pointer will be omitted when the function uses
- no local variables.
+-fommit-frame-pointer
+\begin_inset LatexCommand \index{PIC16!Options!-\/-fommit-frame-pointer}
+
+\end_inset 
+
+ Frame pointer will be omitted when the function uses no local variables.
 \layout Subsection
 
 Port Specific Options
@@ -17252,7 +18630,7 @@ status Collapsed
 /
 \end_inset 
 
--stack-model=[model] Used in conjuction with the command above.
+-pstack-model=[model] Used in conjuction with the command above.
  Defines the stack model to be used, valid stack models are : 
 \begin_deeper 
 \layout List
@@ -17348,7 +18726,12 @@ status Collapsed
 /
 \end_inset 
 
--mplab-comp MPLAB compatibility option.
+-mplab-comp MPLAB
+\begin_inset LatexCommand \index{PIC16!MPLAB}
+
+\end_inset 
+
+ compatibility option.
  Currently only suppresses special gpasm directives.
 \layout Subsubsection
 
@@ -17623,8 +19006,12 @@ NO_REG_OPT do not perform pCode registers optimization.
 Preprocessor Macros
 \layout Standard
 
-PIC16 port defines the following preprocessor macros while translating a
- source.
+PIC16
+\begin_inset LatexCommand \index{PIC16}
+
+\end_inset 
+
+ port defines the following preprocessor macros while translating a source.
 \layout Standard
 \align center 
 
@@ -18005,12 +19392,27 @@ Pragmas
 
 \layout Standard
 
-PIC16 port currently supports the following pragmas:
+PIC16
+\begin_inset LatexCommand \index{PIC16}
+
+\end_inset 
+
+ port currently supports the following pragmas:
 \layout List
 \labelwidthstring 00.00.0000
 
-stack pragma stack forces the code generator to initialize the stack & frame
- pointers at a specific address.
+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
  in the linker script or gplink is not instructed to create a stack section.
 \newline 
@@ -18063,18 +19465,12 @@ If the stack_size field is omitted then a stack is created with the default
 \layout List
 \labelwidthstring 00.00.0000
 
-wparam 
-\emph on 
-This pragma is deprecated.
- Its use will cause a warning message to be issued.
-\emph default 
-
-\newline 
+code
+\begin_inset LatexCommand \index{PIC16!Pragmas!\#pragma code}
 
-\layout List
-\labelwidthstring 00.00.0000
+\end_inset 
 
-code place a function symbol at static FLASH address
+ place a function symbol at static FLASH address
 \layout LyX-Code
 
 Example:
@@ -18432,8 +19828,17 @@ Header Files
 
 \layout Standard
 
-There is one main header file that can be included to the source files using
- the pic16 port.
+There is one main header file
+\begin_inset LatexCommand \index{PIC16!Header files}
+
+\end_inset 
+
+ that can be included to the source files using the pic16
+\begin_inset LatexCommand \index{PIC16}
+
+\end_inset 
+
+ port.
  That file is the 
 \series bold 
 pic18fregs.h
@@ -18455,7 +19860,12 @@ The specific microcontroller is selected within the pic18fregs.h automatically,
 Libraries
 \layout Standard
 
-The libraries that PIC16
+The libraries
+\begin_inset LatexCommand \index{PIC16!Libraries}
+
+\end_inset 
+
+ that PIC16
 \begin_inset LatexCommand \index{PIC16}
 
 \end_inset 
@@ -18672,8 +20082,13 @@ The standard device libraries (see
 Stack
 \layout Standard
 
-The stack implementation for the PIC16 port uses two indirect registers,
- FSR1 and FSR2.
+The stack
+\begin_inset LatexCommand \index{PIC16!stack}
+
+\end_inset 
+
+ implementation for the PIC16 port uses two indirect registers, FSR1 and
+ FSR2.
 \layout List
 \labelwidthstring 00.00.0000
 
@@ -18836,12 +20251,21 @@ These limitations are caused by the fact that only FSRxL is modified when
 Functions
 \layout Standard
 
-In addition to the standard SDCC function keywords, PIC16 port makes available
- two more:
+In addition to the standard SDCC function keywords, PIC16
+\begin_inset LatexCommand \index{PIC16}
+
+\end_inset 
+
+ port makes available two more:
 \layout List
 \labelwidthstring 00.00.0000
 
-wparam Use the WREG to pass one byte of the first function argument.
+wparam
+\begin_inset LatexCommand \index{PIC16!wparam}
+
+\end_inset 
+
+ Use the WREG to pass one byte of the first function argument.
  This improves speed but you may not use this for functions with arguments
  that are called via function pointers, otherwise the first byte of the
  first parameter will get lost.
@@ -18865,15 +20289,17 @@ void func_wparam(int a) wparam
 \layout LyX-Code
 
 }
-\layout Standard
-
-This keyword replaces the deprecated wparam pragma.
 \layout List
 \labelwidthstring 00.00.0000
 
-shadowregs When entering/exiting an ISR, it is possible to take advantage
- of the PIC18F hardware shadow registers which hold the values of WREG,
- STATUS and BSR registers.
+shadowregs
+\begin_inset LatexCommand \index{PIC16!shadowregs}
+
+\end_inset 
+
+ When entering/exiting an ISR, it is possible to take advantage of the PIC18F
+ hardware shadow registers which hold the values of WREG, STATUS and BSR
+ registers.
  This can be done by adding the keyword 
 \emph on 
 shadowregs
@@ -19037,7 +20463,12 @@ on stack, FSR0 points to the beginning
 Interrupts
 \layout Standard
 
-An interrupt servive routine (ISR) is declared using the 
+An interrupt
+\begin_inset LatexCommand \index{PIC16!interrupt}
+
+\end_inset 
+
+ service routine (ISR) is declared using the 
 \emph on 
 interrupt
 \emph default 
@@ -19354,7 +20785,7 @@ rest of the pointer
 
 \layout Standard
 
-descrption
+description
 \end_inset 
 </cell>
 </row>
@@ -19968,7 +21399,7 @@ void main(void)
 {
 \layout LyX-Code
 
-    stdout = STREAM_USER;    /* this is not necessery, since stdout points
+    stdout = STREAM_USER;    /* this is not necessary, since stdout points
 \layout LyX-Code
 
                               * by default to STREAM_USER */
@@ -20562,7 +21993,12 @@ Here you can find some general tips for compiling programs with SDCC/pic16.
 Stack size
 \layout Standard
 
-The default stack size (that is 64 bytes) probably is enough for many programs.
+The default stack
+\begin_inset LatexCommand \index{PIC16!stack}
+
+\end_inset 
+
+ size (that is 64 bytes) probably is enough for many programs.
  One must take care that when there are many levels of function nesting,
  or there is excessive usage of stack, its size should be extended.
  An example of such a case is the printf/sprintf family of functions.
@@ -20590,46 +22026,64 @@ status Collapsed
 -fommit-frame-pointer might reduce stack usage by not creating unnecessery
  stack frames.
  Other ways to reduce stack usage may exist.
-\layout Chapter
+\layout Subsection
 
-Debugging with SDCDB
-\begin_inset LatexCommand \label{cha:Debugging-with-SDCDB}
+Known bugs
+\layout Standard
+
+The PIC16 Port currently does not pass SDCC's regression test
+\begin_inset LatexCommand \index{Regression test (PIC16)}
+
+\end_inset 
+
+ suite (see section 
+\begin_inset LatexCommand \ref{sec:Quality-control}
 
 \end_inset 
 
+) and thus the nightly regression tests for the PIC16 target are currently
+ disabled for all hosts except for 
+\emph on 
+Linux on Opteron.
 
-\begin_inset LatexCommand \index{sdcdb (debugger)}
+\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).
+\layout Chapter
+
+Debugging
 \layout Standard
 
-SDCC is distributed with a source level debugger
-\begin_inset LatexCommand \index{Debugger}
+There are several approaches to debugging your code.
+ This chapter is meant to show your options and to give detail on some of
+ them:
+\newline 
 
-\end_inset 
+\newline 
+When writing your code:
+\layout Itemize
 
-.
- The debugger uses a command line interface, the command repertoire of the
- debugger has been kept as close to gdb
-\begin_inset LatexCommand \index{gdb}
+write your code with debugging in mind (avoid duplicating code, put conceptually
+ similar variables into structs, use structured code, have strategic points
+ within your code where all variables are consistent, ...)
+\layout Itemize
+
+run a syntax-checking tool like splint
+\begin_inset LatexCommand \index{splint (syntax checking tool)}
 
 \end_inset 
 
- (the GNU debugger) as possible.
- The configuration and build process is part of the standard compiler installati
-on, which also builds and installs the debugger in the target directory
- specified during configuration.
- The debugger allows you debug BOTH at the C source and at the ASM source
- level.
- Sdcdb is currently not available on Win32 platforms.
-\layout Section
 
-Compiling for Debugging
-\layout Standard
+\begin_inset LatexCommand \index{lint (syntax checking tool)}
 
-The -
+\end_inset 
+
+ (see -
 \begin_inset ERT
 status Collapsed
 
@@ -20639,141 +22093,416 @@ status Collapsed
 /
 \end_inset 
 
--debug
-\begin_inset LatexCommand \index{-\/-debug}
+-more-pedantic 
+\begin_inset LatexCommand \ref{lyx:more-pedantic-SPLINT}
 
 \end_inset 
 
- option must be specified for all files for which debug information is to
- be generated.
- The complier generates a .adb file for each of these files.
- The linker creates the .cdb
-\begin_inset LatexCommand \index{<file>.cdb}
+) over the code.
+\layout Itemize
+
+for the high level code use a C-compiler (like f.e.
+ GCC) to compile run and debug the code on your host.
+ See (see -
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
 
+\backslash 
+/
 \end_inset 
 
- file from the .adb
-\begin_inset LatexCommand \index{<file>.adb}
+-more-pedantic 
+\begin_inset LatexCommand \ref{lyx:more-pedantic-SPLINT}
 
 \end_inset 
 
files and the address information.
- This .cdb is used by the debugger.
-\layout Section
) on howto handle syntax extensions like __xdata, __at(), ...
+\layout Itemize
 
-How the Debugger Works
+use another C-compiler to compile code for your target.
+ Always an option but not recommended:) And not very likely to help you.
+ If you seriously consider walking this path you should at least occasionally
+ check portability of your code.
+ Most commercial compiler vendors will offer an evaluation version so you
+ can test compile your code or snippets of your code.
 \layout Standard
 
-When the -
-\begin_inset ERT
-status Collapsed
+Debugging on a simulator:
+\layout Itemize
 
-\layout Standard
+there is a separate section about SDCDB (section 
+\begin_inset LatexCommand \ref{cha:Debugging-with-SDCDB}
 
-\backslash 
-/
 \end_inset 
 
--debug option is specified the compiler generates extra symbol information
- some of which are put into the assembler source and some are put into the
- .adb file.
-  Then the linker creates the .cdb file from the individual .adb files with
- the address information for the symbols.
- The debugger reads the symbolic information generated by the compiler &
- the address information generated by the linker.
- It uses the SIMULATOR (Daniel's S51) to execute the program, the program
- execution is controlled by the debugger.
- When a command is issued for the debugger, it translates it into appropriate
- commands for the simulator.
-\layout Section
-
-Starting the Debugger
-\layout Standard
+) below.
+\layout Itemize
 
-The debugger can be started using the following command line.
- (Assume the file you are debugging has the file name foo).
-\newline 
+or (8051 specific) use a freeware/commercial simulator which interfaces
+ to the AOMF
+\begin_inset LatexCommand \index{AOMF, AOMF51}
 
-\newline 
+\end_inset 
 
-\family sans 
-\series bold 
-sdcdb foo
-\newline 
+ file (see 
+\begin_inset LatexCommand \ref{OMF file}
 
-\family default 
-\series default 
+\end_inset 
 
-\newline 
-The debugger will look for the following files.
-\layout Itemize
+) optionally generated by SDCC.
+\layout Standard
 
-foo.c - the source file.
+Debugging On-target: 
 \layout Itemize
 
-foo.cdb - the debugger symbol information file.
+use a MCU port pin to serially output debug data to the RS232 port of your
+ host.
+ You'll probably want some level shifting device typically involving a MAX232
+ or similar IC.
+ If the hardware serial port of the MCU is not available search for 'Software
+ UART' in your favourite search machine.
 \layout Itemize
 
-foo.ihx - the Intel hex format
-\begin_inset LatexCommand \index{Intel hex format}
+use an on-target monitor.
+ In this context a monitor is a small program which usually accepts commands
+ via a serial line and allows to set program counter, to single step through
+ a program and read/write memory locations.
+ For the 8051 good examples of monitors are paulmon and cmon51 (see section
+\begin_inset LatexCommand \ref{sec:Related-open-source-tools}
 
 \end_inset 
 
- object file.
-\layout Section
-
-Command Line Options
+).
 \layout Itemize
 
--
-\begin_inset ERT
-status Collapsed
+toggle MCU port pins at strategic points within your code and use an oscilloscop
+e.
+ A 
+\emph on 
+digital oscilloscope
+\emph default 
 
-\layout Standard
+\begin_inset LatexCommand \index{Oscilloscope}
 
-\backslash 
-/
 \end_inset 
 
--directory=<source file directory> this option can used to specify the directory
- search list.
- The debugger will look into the directory list specified for source, cdb
- & ihx files.
- The items in the directory list must be separated by ':', e.g.
- if the source files can be in the directories /home/src1 and /home/src2,
- the -
-\begin_inset ERT
-status Collapsed
-
-\layout Standard
+ with deep trace memory is really helpful especially if you have to debug
+ a realtime application.
+ If you need to monitor more pins than your oscilloscope provides you can
+ sometimes get away with a small R-2R network.
+ On a single channel oscilloscope you could f.e.
+ monitor 2 push-pull driven pins by connecting one via a 10\SpecialChar ~
+k
+\begin_inset Formula $\Omega$
+\end_inset 
 
-\backslash 
-/
+ resistor and the other one by a 5\SpecialChar ~
+k
+\begin_inset Formula $\Omega$
 \end_inset 
 
--directory option should be -
-\begin_inset ERT
-status Collapsed
+ resistor to the oscilloscope probe (check output drive capability of the
+ pins you want to monitor).
+ If you need to monitor many more pins a 
+\emph on 
+logic analyzer
+\emph default 
+ will be handy.
+\layout Itemize
 
-\layout Standard
+use an ICE (
+\emph on 
+i
+\emph default 
+n 
+\emph on 
+c
+\emph default 
+ircuit 
+\emph on 
+e
+\emph default 
+mulator
+\begin_inset LatexCommand \index{ICE (in circuit emulator)}
 
-\backslash 
-/
 \end_inset 
 
--directory=/home/src1:/home/src2.
- Note there can be no spaces in the option.
+).
+ Usually very expensive.
+ And very nice to have too.
+ And usually locks you (for years...) to the devices the ICE can emulate.
  
 \layout Itemize
 
--cd <directory> - change to the <directory>.
-\layout Itemize
-
--fullname - used by GUI front ends.
+use a remote debugger.
+ In most 8-bit systems the symbol information is not available on the target,
+ and a complete debugger is too bulky for the target system.
+ Therefore usually a debugger on the host system connects to an on-target
+ debugging stub which accepts only primitive commands.
+\newline 
+Terms to enter into your favourite search engine could be 'remote debugging',
+ 'gdb stub' or 'inferior debugger'.
+ (is there one?)
 \layout Itemize
 
--cpu <cpu-type> - this argument is passed to the simulator please see the
- simulator docs for details.
+use an on target hardware debugger.
+ Some of the more modern MCUs include hardware support for setting break
+ points and monitoring/changing variables by using dedicated hardware pins.
+ This facility doesn't require additional code to run on the target and
+\emph on 
+usually
+\emph default 
+ doesn't affect runtime behaviour until a breakpoint is hit.
+ For the mcs51 most hardware debuggers use the AOMF
+\begin_inset LatexCommand \index{AOMF, AOMF51}
+
+\end_inset 
+
+ file (see 
+\begin_inset LatexCommand \ref{OMF file}
+
+\end_inset 
+
+) as input file.
+\layout Standard
+
+Last not least:
+\layout Itemize
+
+if you are not familiar with any of the following terms you're likely to
+ run into problems rather sooner than later: 
+\emph on 
+volatile
+\emph default 
+, 
+\emph on 
+atomic
+\emph default 
+, 
+\emph on 
+memory map
+\emph default 
+, 
+\emph on 
+overlay
+\emph default 
+.
+ As an embedded programmer you 
+\emph on 
+have
+\emph default 
+ to know them so why not look them up 
+\emph on 
+before
+\emph default 
+ you have problems?)
+\layout Itemize
+
+tell someone else about your problem (actually this is a surprisingly effective
+ means to hunt down the bug even if the listener is not familiar with your
+ environment).
+ As 'failure to communicate' is probably one of the job-induced deformations
+ of an embedded programmer this is highly encouraged.
+\layout Section
+
+Debugging with SDCDB
+\begin_inset LatexCommand \label{cha:Debugging-with-SDCDB}
+
+\end_inset 
+
+
+\begin_inset LatexCommand \index{SDCDB (debugger)}
+
+\end_inset 
+
+\layout Standard
+
+SDCC is distributed with a source level debugger
+\begin_inset LatexCommand \index{Debugger}
+
+\end_inset 
+
+.
+ The debugger uses a command line interface, the command repertoire of the
+ debugger has been kept as close to gdb
+\begin_inset LatexCommand \index{gdb}
+
+\end_inset 
+
+ (the GNU debugger) as possible.
+ The configuration and build process is part of the standard compiler installati
+on, which also builds and installs the debugger in the target directory
+ specified during configuration.
+ The debugger allows you debug BOTH at the C source and at the ASM source
+ level.
+\layout Subsection
+
+Compiling for Debugging
+\layout Standard
+
+The -
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash 
+/
+\end_inset 
+
+-debug
+\begin_inset LatexCommand \index{-\/-debug}
+
+\end_inset 
+
+ option must be specified for all files for which debug information is to
+ be generated.
+ The compiler generates a .adb file for each of these files.
+ The linker creates the .cdb
+\begin_inset LatexCommand \index{<file>.cdb}
+
+\end_inset 
+
+ file from the .adb
+\begin_inset LatexCommand \index{<file>.adb}
+
+\end_inset 
+
+ files and the address information.
+ This .cdb is used by the debugger.
+\layout Subsection
+
+How the Debugger Works
+\layout Standard
+
+When the -
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash 
+/
+\end_inset 
+
+-debug option is specified the compiler generates extra symbol information
+ some of which are put into the assembler source and some are put into the
+ .adb file.
+ Then the linker creates the .cdb file from the individual .adb files with
+ the address information for the symbols.
+ The debugger reads the symbolic information generated by the compiler &
+ the address information generated by the linker.
+ It uses the SIMULATOR (Daniel's S51) to execute the program, the program
+ execution is controlled by the debugger.
+ When a command is issued for the debugger, it translates it into appropriate
+ commands for the simulator.
+ (Currently SDCDM only connects to the simulator but 
+\emph on 
+newcdb
+\emph default 
+ at 
+\begin_inset LatexCommand \url{http://ec2drv.sf.net/}
+
+\end_inset 
+
+ is an effort to connect directly to the hardware.) 
+\layout Subsection
+
+Starting the Debugger SDCDB
+\layout Standard
+
+The debugger can be started using the following command line.
+ (Assume the file you are debugging has the file name foo).
+\newline 
+
+\newline 
+
+\family sans 
+\series bold 
+sdcdb foo
+\newline 
+
+\family default 
+\series default 
+
+\newline 
+The debugger will look for the following files.
+\layout Itemize
+
+foo.c - the source file.
+\layout Itemize
+
+foo.cdb - the debugger symbol information file.
+\layout Itemize
+
+foo.ihx - the Intel hex format
+\begin_inset LatexCommand \index{Intel hex format}
+
+\end_inset 
+
+ object file.
+\layout Subsection
+
+SDCDB Command Line Options
+\layout Itemize
+
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash 
+/
+\end_inset 
+
+-directory=<source file directory> this option can used to specify the directory
+ search list.
+ The debugger will look into the directory list specified for source, cdb
+ & ihx files.
+ The items in the directory list must be separated by ':', e.g.
+ if the source files can be in the directories /home/src1 and /home/src2,
+ the -
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash 
+/
+\end_inset 
+
+-directory option should be -
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash 
+/
+\end_inset 
+
+-directory=/home/src1:/home/src2.
+ Note there can be no spaces in the option.
+\layout Itemize
+
+-cd <directory> - change to the <directory>.
+\layout Itemize
+
+-fullname - used by GUI front ends.
+\layout Itemize
+
+-cpu <cpu-type> - this argument is passed to the simulator please see the
+ simulator docs for details.
 \layout Itemize
 
 -X <Clock frequency > this options is passed to the simulator please see
@@ -20787,9 +22516,9 @@ status Collapsed
 \layout Itemize
 
 -k <port number> passed to simulator see the simulator docs for details.
-\layout Section
+\layout Subsection
 
-Debugger Commands
+SDCDB Debugger Commands
 \layout Standard
 
 As mentioned earlier the command interface for the debugger has been deliberatel
@@ -20938,9 +22667,9 @@ quit
 "Watch me now.
  Iam going Down.
  My name is Bobby Brown"
-\layout Section
+\layout Subsection
 
-Interfacing with DDD
+Interfacing SDCDB with DDD
 \layout Comment
 
 The screenshot was converted from png to eps with: 
@@ -20956,13 +22685,26 @@ bmeps -c -e8f -p3 ddd_example.png >ddd_example.eps
 \layout Comment
 
 The screenshot was included in sdccman.lyx cvs version 1.120 but later removed
- as this broke the build system on Sourceforge (pdf-file was broken).
+ as this broke the build system on Sourceforge (pdf-file was broken.
+ pdflatex does not accept eps files).
 \layout Standard
 
-The .eps File 
+The 
+\emph on 
+p
+\emph default 
+ortable 
+\emph on 
+n
+\emph default 
+etwork 
+\emph on 
+g
+\emph default 
+raphics File 
 \size footnotesize 
 
-\begin_inset LatexCommand \url{http://svn.sourceforge.net/viewcvs.cgi/*checkout*/sdcc/trunk/sdcc/doc/figures/ddd_example.eps}
+\begin_inset LatexCommand \url{http://svn.sourceforge.net/viewcvs.cgi/*checkout*/sdcc/trunk/sdcc/doc/figures/ddd_example.png}
 
 \end_inset 
 
@@ -21023,9 +22765,9 @@ and DDD was invoked with
 
 \newline 
 ddd -debugger 'sdcdb -cpu 8032 ddd_example'
-\layout Section
+\layout Subsection
 
-Interfacing with XEmacs
+Interfacing SDCDB with XEmacs
 \begin_inset LatexCommand \index{XEmacs}
 
 \end_inset 
@@ -21883,10 +23625,32 @@ Use the smallest data type to represent your data-value.
  If it is known in advance that the value is going to be less than 256 then
  use an 'unsigned char' instead of a 'short' or 'int'.
  Please note, that ANSI C requires both signed and unsigned chars to be
- promoted to 'signed int' before doing any operation.
+ promoted to 'signed int'
+\begin_inset LatexCommand \index{promotion to signed int}
+
+\end_inset 
+
+
+\begin_inset Marginal
+collapsed true
+
+\layout Standard
+
+
+\series bold 
+\SpecialChar ~
+!
+\end_inset 
+
+ before doing any operation.
  This promotion
 \begin_inset LatexCommand \index{type promotion}
 
+\end_inset 
+
+
+\begin_inset LatexCommand \label{type promotion}
+
 \end_inset 
 
  can be omitted, if the result is the same.
@@ -21964,6 +23728,8 @@ comp.lang.c FAQ
 :
 \layout Quote
 
+
+\emph on 
 If well-defined overflow characteristics are important and negative values
  are not, or if you want to steer clear of sign-extension problems when
  manipulating bits or bytes, use one of the corresponding unsigned types.
@@ -21992,79 +23758,200 @@ Declare the variables to be local
  whenever possible, especially loop control variables (induction).
 \layout Itemize
 
-Since the compiler does not always do implicit integral promotion, the programme
-r should do an explicit cast when integral promotion is required.
-\layout Itemize
-
-Reducing the size of division, multiplication & modulus operations can reduce
- code size substantially.
- Take the following code for example.
-\begin_deeper 
-\layout Verse
+Have a look at the assembly listing to get a 
+\begin_inset Quotes sld
+\end_inset 
 
+feeling
+\begin_inset Quotes srd
+\end_inset 
 
-\family typewriter 
-foobar(unsigned int p1, unsigned char ch)
-\newline 
-{
-\newline 
-\SpecialChar ~
-\SpecialChar ~
-\SpecialChar ~
-\SpecialChar ~
-unsigned char ch1 = p1 % ch ;
-\newline 
-\SpecialChar ~
-\SpecialChar ~
-\SpecialChar ~
-\SpecialChar ~
-....
-\newline 
-}
-\layout Standard
+ for the code generation.
+\layout Section
 
-For the modulus operation the variable ch will be promoted to unsigned int
- first then the modulus operation will be performed (this will lead to a
- call to support routine _moduint()), and the result will be casted to a
- char.
- If the code is changed to 
-\layout Verse
+Porting code from or to other compilers
+\begin_inset LatexCommand \label{sec:Porting-code-to-other-compilers}
+
+\end_inset 
+
+
+\layout Itemize
+
+check whether endianness of the compilers differs and adapt where needed.
+\layout Itemize
+
+check the device specific header files
+\begin_inset LatexCommand \index{Header files}
+
+\end_inset 
+
+
+\begin_inset LatexCommand \index{Include files}
+
+\end_inset 
+
+ for compiler specific syntax.
+ Eventually include the file <compiler.h
+\begin_inset LatexCommand \index{compiler.h (include file)}
+
+\end_inset 
+
+> 
+\begin_inset LatexCommand \url{http://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}
+
+\end_inset 
+
+).
+\layout Itemize
+
+check whether the startup code contains the correct initialization (watchdog,
+ peripherals).
+\layout Itemize
+
+check whether the sizes of short, int, long match.
+\layout Itemize
+
+check if some 16 or 32 bit hardware registers require a specific addressing
+ order (least significant or most significant byte first) and adapt if needed
+ (
+\emph on 
+first
+\emph default 
+ and 
+\emph on 
+last
+\emph default 
+ relate to time and not to lower/upper memory location here, so this is
+\emph on 
+not
+\emph default 
+ the same as endianness).
+\layout Itemize
+
+check whether the keyword 
+\emph on 
+volatile
+\emph default 
+ is used where needed.
+ The compilers might differ in their optimization characteristics (as different
+ versions of the same compiler might also use more clever optimizations
+ this is good idea anyway).
+ See section 
+\begin_inset LatexCommand \ref{sub:Common-interrupt-pitfall-volatile}
+
+\end_inset 
+
+.
+\layout Itemize
 
+check that the compilers are not told to supress warnings.
+\layout Itemize
+
+check and convert compiler specific extensions (interrupts, memory areas,
+ pragmas etc.).
+\layout Itemize
 
+check for differences in type promotion.
+ Especially check for math operations on 
 \family typewriter 
-foobar(unsigned int p1, unsigned char ch)
-\newline 
-{
-\newline 
-\SpecialChar ~
-\SpecialChar ~
-\SpecialChar ~
-\SpecialChar ~
-unsigned char ch1 = (unsigned char)p1 % ch ;
-\newline 
-\SpecialChar ~
-\SpecialChar ~
-\SpecialChar ~
-\SpecialChar ~
-....
-\newline 
-}
-\layout Standard
+char
+\family default 
+ or 
+\family typewriter 
+unsigned char
+\family default 
+ variables.
+ For the sake of C99 compatibility SDCC will probably promote these to 
+\family typewriter 
+int
+\family default 
+ more often than other compilers.
+ Eventually insert explicit casts to 
+\family typewriter 
+(char) 
+\family default 
+or
+\family typewriter 
+ (unsigned char)
+\family default 
+.
+ Also check that the ~\SpecialChar ~
+operator
+\begin_inset LatexCommand \index{\~\/ Operator}
 
-It would substantially reduce the code generated (future versions of the
- compiler will be smart enough to detect such optimization opportunities).
-\end_deeper 
+\end_inset 
+
+ is not used on 
+\family typewriter 
+bit
+\begin_inset LatexCommand \index{bit}
+
+\end_inset 
+
+
+\family default 
+ variables, use the !\SpecialChar ~
+operator instead.
+ See sections 
+\begin_inset LatexCommand \ref{type promotion}
+
+\end_inset 
+
+ and 
+\begin_inset LatexCommand \ref{sec:Compatibility-with-previous}
+
+\end_inset 
+
+.
 \layout Itemize
 
-Have a look at the assembly listing to get a 
-\begin_inset Quotes sld
+check the assembly code generated for interrupt routines (f.e.
+ for calls to possibly non-reentrant library functions).
+\layout Itemize
+
+check whether timing loops result in proper timing (or preferably consider
+ a rewrite of the code with timer based delays instead).
+\layout Itemize
+
+check for differences in printf parameters (some compilers push (va_arg
+\begin_inset LatexCommand \index{vararg, va\_arg}
+
 \end_inset 
 
-feeling
-\begin_inset Quotes srd
+) char variables as 
+\family typewriter 
+int
+\family default 
+ others push them as 
+\family typewriter 
+char
+\family default 
+.
+ See section 
+\begin_inset LatexCommand \ref{sec:Compatibility-with-previous}
+
 \end_inset 
 
- for the code generation.
+).
+\layout Itemize
+
+check the resulting memory map
+\begin_inset LatexCommand \index{Memory map}
+
+\end_inset 
+
+.
+ Usage of different memory spaces: code, stack, data (for mcs51/ds390 additional
+ly idata, pdata, xdata).
+ Eventually check if unexpected library functions are included.
 \layout Section
 
 Tools
@@ -22074,13 +23961,13 @@ Tools
 
  included in the distribution
 \layout Standard
-\align center 
+\align left 
 
 \begin_inset  Tabular
 <lyxtabular version="3" rows="12" columns="3">
 <features>
-<column alignment="center" valignment="top" leftline="true" width="0pt">
-<column alignment="center" valignment="top" leftline="true" width="0pt">
+<column alignment="left" valignment="top" leftline="true" width="0pt">
+<column alignment="left" valignment="top" leftline="true" width="0pt">
 <column alignment="left" valignment="top" leftline="true" rightline="true" width="0pt">
 <row topline="true" bottomline="true">
 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
@@ -22088,6 +23975,8 @@ Tools
 
 \layout Standard
 
+
+\series bold 
 Name
 \end_inset 
 </cell>
@@ -22096,6 +23985,8 @@ Name
 
 \layout Standard
 
+
+\series bold 
 Purpose
 \end_inset 
 </cell>
@@ -22104,6 +23995,8 @@ Purpose
 
 \layout Standard
 
+
+\series bold 
 Directory
 \end_inset 
 </cell>
@@ -22114,7 +24007,7 @@ Directory
 
 \layout Standard
 
-uCsim
+ucSsim
 \end_inset 
 </cell>
 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
@@ -22148,7 +24041,17 @@ keil2sdcc.pl
 
 \layout Standard
 
-header file conversion
+header file
+\begin_inset LatexCommand \index{Header files}
+
+\end_inset 
+
+
+\begin_inset LatexCommand \index{Include files}
+
+\end_inset 
+
+ conversion
 \end_inset 
 </cell>
 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
@@ -22297,7 +24200,7 @@ sdcc/bin
 
 \layout Standard
 
-sdcdb
+SDCDB
 \end_inset 
 </cell>
 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
@@ -22445,7 +24348,12 @@ packihx
 
 \layout Standard
 
-ihx packer
+Intel Hex packer 
+\begin_inset LatexCommand \index{packihx (tool)}
+
+\end_inset 
+
+
 \end_inset 
 </cell>
 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
@@ -22482,19 +24390,21 @@ Documentation
 
  included in the distribution
 \layout Standard
-\align center 
+\align left 
 
 \begin_inset  Tabular
 <lyxtabular version="3" rows="10" columns="2">
 <features>
-<column alignment="left" valignment="top" leftline="true" width="0">
-<column alignment="left" valignment="top" leftline="true" rightline="true" width="0pt">
-<row topline="true" bottomline="true">
+<column alignment="block" valignment="top" leftline="true" width="40col%">
+<column alignment="block" valignment="top" leftline="true" rightline="true" width="60col%">
+<row topline="true" bottomline="true" endhead="true">
 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
 \begin_inset Text
 
 \layout Standard
 
+
+\series bold 
 Subject / Title
 \end_inset 
 </cell>
@@ -22503,7 +24413,9 @@ Subject / Title
 
 \layout Standard
 
-Where to get / filename
+
+\series bold 
+Filename / Where to get
 \end_inset 
 </cell>
 </row>
@@ -22522,6 +24434,22 @@ SDCC Compiler User Guide
 \layout Standard
 
 You're reading it right now
+\emph on 
+ \SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+
+\hfill 
+online at:
+\emph default 
+
+\newline 
+
+\begin_inset LatexCommand \url{http://sdcc.sourceforge.net/doc/sdccman.pdf}
+
+\end_inset 
+
+
 \end_inset 
 </cell>
 </row>
@@ -22540,6 +24468,22 @@ Changelog of SDCC
 \layout Standard
 
 sdcc/Changelog
+\emph on 
+ \SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+
+\hfill 
+online at:
+\emph default 
+
+\newline 
+
+\begin_inset LatexCommand \url{http://svn.sourceforge.net/viewvc/*checkout*/sdcc/trunk/sdcc/ChangeLog}
+
+\end_inset 
+
+
 \end_inset 
 </cell>
 </row>
@@ -22559,7 +24503,9 @@ ASXXXX
 
 \end_inset 
 
- Assemblers and ASLINK
+ Assemblers and
+\newline 
+ASLINK
 \begin_inset LatexCommand \index{aslink}
 
 \end_inset 
@@ -22577,7 +24523,23 @@ ASXXXX
 
 \layout Standard
 
-sdcc/as/doc/asxhtm.html
+sdcc/as/doc/asxhtm.html 
+\emph on 
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+
+\hfill 
+online at:
+\emph default 
+
+\newline 
+
+\begin_inset LatexCommand \url{http://svn.sourceforge.net/viewvc/*checkout*/sdcc/trunk/sdcc/as/doc/asxhtm.html}
+
+\end_inset 
+
+
 \end_inset 
 </cell>
 </row>
@@ -22600,7 +24562,23 @@ SDCC regression test
 
 \layout Standard
 
-sdcc/doc/test_suite_spec.pdf
+sdcc/doc/test_suite_spec.pdf 
+\emph on 
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+
+\hfill 
+online at:
+\emph default 
+
+\newline 
+
+\begin_inset LatexCommand \url{http://sdcc.sourceforge.net/doc/test_suite_spec.pdf}
+
+\end_inset 
+
+
 \end_inset 
 </cell>
 </row>
@@ -22618,7 +24596,23 @@ Various notes
 
 \layout Standard
 
-sdcc/doc/*
+sdcc/doc/* 
+\emph on 
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+
+\hfill 
+online at:
+\emph default 
+
+\newline 
+
+\begin_inset LatexCommand \url{http://svn.sourceforge.net/viewvc/sdcc/trunk/sdcc/doc/}
+
+\end_inset 
+
+
 \end_inset 
 </cell>
 </row>
@@ -22628,8 +24622,8 @@ sdcc/doc/*
 
 \layout Standard
 
-Notes on debugging with sdcdb
-\begin_inset LatexCommand \index{sdcdb (debugger)}
+Notes on debugging with SDCDB
+\begin_inset LatexCommand \index{SDCDB (debugger)}
 
 \end_inset 
 
@@ -22641,8 +24635,24 @@ Notes on debugging with sdcdb
 
 \layout Standard
 
-sdcc/debugger/README
-\end_inset 
+sdcc/debugger/README 
+\emph on 
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+
+\hfill 
+online at
+\emph default 
+:
+\newline 
+
+\begin_inset LatexCommand \url{http://svn.sourceforge.net/viewvc/*checkout*/sdcc/trunk/sdcc/debugger/README}
+
+\end_inset 
+
+
+\end_inset 
 </cell>
 </row>
 <row topline="true">
@@ -22677,7 +24687,23 @@ sdcc/sim/ucsim/doc
 \bar default 
 \noun default 
 \color default
-/index.html
+/index.html 
+\emph on 
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+
+\hfill 
+online at:
+\emph default 
+
+\newline 
+
+\begin_inset LatexCommand \url{http://svn.sourceforge.net/viewvc/*checkout*/sdcc/trunk/sdcc/sim/ucsim/doc/index.html}
+
+\end_inset 
+
+
 \end_inset 
 </cell>
 </row>
@@ -22700,7 +24726,23 @@ Temporary notes on the pic16
 
 \layout Standard
 
-sdcc/src/pic16/NOTES
+sdcc/src/pic16/NOTES 
+\emph on 
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+
+\hfill 
+online at:
+\newline 
+
+\emph default 
+
+\begin_inset LatexCommand \url{http://svn.sourceforge.net/viewvc/*checkout*/sdcc/trunk/sdcc/src/pic16/NOTES}
+
+\end_inset 
+
+
 \end_inset 
 </cell>
 </row>
@@ -22737,6 +24779,22 @@ cdbfileformat.pd
 \noun default 
 \color default
 f
+\emph on 
+ \SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+
+\hfill 
+online at:
+\emph default 
+
+\newline 
+
+\begin_inset LatexCommand \url{http://sdcc.sourceforge.net/doc/cdbfileformat.pdf}
+
+\end_inset 
+
+
 \end_inset 
 </cell>
 </row>
 \layout Section
 
 Related open source tools
+\begin_inset LatexCommand \label{sec:Related-open-source-tools}
+
+\end_inset 
+
+
 \begin_inset LatexCommand \index{Related tools}
 
 \end_inset 
 
 
 \layout Standard
-\align center 
+\align left 
 
 \begin_inset  Tabular
-<lyxtabular version="3" rows="11" columns="3">
+<lyxtabular version="3" rows="14" columns="3">
 <features>
-<column alignment="center" valignment="top" leftline="true" width="0pt">
+<column alignment="left" valignment="top" leftline="true" width="0pt">
 <column alignment="block" valignment="top" leftline="true" width="30line%">
 <column alignment="left" valignment="top" leftline="true" rightline="true" width="0pt">
 <row topline="true" bottomline="true">
@@ -22770,6 +24833,8 @@ Related open source tools
 
 \layout Standard
 
+
+\series bold 
 Name
 \end_inset 
 </cell>
@@ -22778,6 +24843,8 @@ Name
 
 \layout Standard
 
+
+\series bold 
 Purpose
 \end_inset 
 </cell>
@@ -22786,6 +24853,8 @@ Purpose
 
 \layout Standard
 
+
+\series bold 
 Where to get
 \end_inset 
 </cell>
@@ -22890,6 +24959,38 @@ PIC programmer
 \end_inset 
 
 
+\end_inset 
+</cell>
+</row>
+<row topline="true">
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+ec2drv/newcdb
+\end_inset 
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+Tools for Silicon Laboratories JTAG debug adapter, partly based on SDCDB
+ (Unix only)
+\end_inset 
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+
+\begin_inset LatexCommand \url{http://sourceforge.net/projects/ec2drv}
+
+\end_inset 
+
+
 \end_inset 
 </cell>
 </row>
@@ -23002,6 +25103,37 @@ Part of binutils (should be there anyway)
 
 \layout Standard
 
+cmon51
+\end_inset 
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+8051 monitor (hex up-/download, single step, disassemble)
+\end_inset 
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+
+\begin_inset LatexCommand \url{http://sourceforge.net/projects/cmon51}
+
+\end_inset 
+
+
+\end_inset 
+</cell>
+</row>
+<row topline="true">
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
 doxygen
 \begin_inset LatexCommand \index{doxygen (source documentation tool)}
 
@@ -23046,7 +25178,7 @@ kdevelop
 
 \layout Standard
 
-IDE (has anyone tried integrating SDCC & sdcdb? Unix only)
+IDE (has anyone tried integrating SDCC & SDCDB? Unix only)
 \end_inset 
 </cell>
 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
@@ -23060,6 +25192,37 @@ IDE (has anyone tried integrating SDCC & sdcdb? Unix only)
 \end_inset 
 
 
+\end_inset 
+</cell>
+</row>
+<row topline="true">
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+paulmon
+\end_inset 
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+8051 monitor (hex up-/download, single step, disassemble)
+\end_inset 
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+
+\begin_inset LatexCommand \url{http://www.pjrc.com/tech/8051/paulmon2.html}
+
+\end_inset 
+
+
 \end_inset 
 </cell>
 </row>
@@ -23111,7 +25274,7 @@ Statically checks c sources (see
 \layout Standard
 
 ddd
-\begin_inset LatexCommand \index{ddd (debugger)}
+\begin_inset LatexCommand \index{DDD (debugger)}
 
 \end_inset 
 
@@ -23123,8 +25286,8 @@ ddd
 
 \layout Standard
 
-Debugger, serves nicely as GUI to sdcdb
-\begin_inset LatexCommand \index{sdcdb (debugger)}
+Debugger, serves nicely as GUI to SDCDB
+\begin_inset LatexCommand \index{SDCDB (debugger)}
 
 \end_inset 
 
@@ -23156,20 +25319,22 @@ Debugger, serves nicely as GUI to sdcdb
 
 Related documentation / recommended reading
 \layout Standard
-\align center 
+\align left 
 
 \begin_inset  Tabular
-<lyxtabular version="3" rows="6" columns="3">
+<lyxtabular version="3" rows="7" columns="3">
 <features>
-<column alignment="center" valignment="top" leftline="true" width="0pt">
-<column alignment="block" valignment="top" leftline="true" width="30line%">
-<column alignment="center" valignment="top" leftline="true" rightline="true" width="0pt">
+<column alignment="left" valignment="top" leftline="true" width="0pt">
+<column alignment="left" valignment="top" leftline="true" width="0">
+<column alignment="left" valignment="top" leftline="true" rightline="true" width="0pt">
 <row topline="true" bottomline="true">
 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
 \begin_inset Text
 
 \layout Standard
 
+
+\series bold 
 Name
 \end_inset 
 </cell>
@@ -23178,6 +25343,8 @@ Name
 
 \layout Standard
 
+
+\series bold 
 Subject / Title
 \end_inset 
 </cell>
@@ -23186,6 +25353,8 @@ Subject / Title
 
 \layout Standard
 
+
+\series bold 
 Where to get
 \end_inset 
 </cell>
@@ -23249,7 +25418,12 @@ c-faq
 
 \layout Standard
 
-C-FAQ-list
+C-FAQ
+\begin_inset LatexCommand \index{C FAQ}
+
+\end_inset 
+
+
 \end_inset 
 </cell>
 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
@@ -23258,7 +25432,7 @@ C-FAQ-list
 \layout Standard
 
 
-\begin_inset LatexCommand \url{http://www.eskimo.com/~scs/C-faq/top.html}
+\begin_inset LatexCommand \url{http://www.c-faq.com}
 
 \end_inset 
 
@@ -23272,6 +25446,7 @@ C-FAQ-list
 
 \layout Standard
 
+ISO/IEC 9899:TC2
 \end_inset 
 </cell>
 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
@@ -23279,7 +25454,15 @@ C-FAQ-list
 
 \layout Standard
 
-Latest datasheet of the target CPU
+
+\begin_inset Quotes sld
+\end_inset 
+
+C-Standard
+\begin_inset Quotes srd
+\end_inset 
+
+
 \end_inset 
 </cell>
 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
@@ -23287,7 +25470,14 @@ Latest datasheet of the target CPU
 
 \layout Standard
 
-vendor
+
+\size footnotesize 
+
+\begin_inset LatexCommand \url{http://www.open-std.org/jtc1/sc22/wg14/www/standards.html#9899}
+
+\end_inset 
+
+
 \end_inset 
 </cell>
 </row>
@@ -23297,6 +25487,7 @@ vendor
 
 \layout Standard
 
+ISO/IEC DTR 18037
 \end_inset 
 </cell>
 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
@@ -23304,7 +25495,47 @@ vendor
 
 \layout Standard
 
-Revision history of datasheet
+
+\begin_inset Quotes sld
+\end_inset 
+
+Extensions for Embedded C
+\begin_inset Quotes srd
+\end_inset 
+
+
+\end_inset 
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+
+\size footnotesize 
+
+\begin_inset LatexCommand \url{http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1021.pdf}
+
+\end_inset 
+
+
+\end_inset 
+</cell>
+</row>
+<row topline="true">
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+\end_inset 
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+Latest datasheet of target CPU
 \end_inset 
 </cell>
 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
@@ -23322,9 +25553,6 @@ vendor
 
 \layout Standard
 
-S.
- S.
- Muchnick
 \end_inset 
 </cell>
 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
@@ -23332,7 +25560,7 @@ S.
 
 \layout Standard
 
-Advanced Compiler Design and Implementation
+Revision history of datasheet
 \end_inset 
 </cell>
 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
@@ -23340,7 +25568,7 @@ Advanced Compiler Design and Implementation
 
 \layout Standard
 
-bookstore (very dedicated, probably read other books first)
+vendor
 \end_inset 
 </cell>
 </row>
@@ -23353,1323 +25581,1721 @@ bookstore (very dedicated, probably read other books first)
 
 \layout Section
 
-Some Questions
+Application notes specifically for SDCC
 \layout Standard
 
-Some questions answered, some pointers given - it might be time to in turn
- ask 
-\emph on 
-you
-\emph default 
- some questions: 
-\layout Itemize
+SDCC makes no claims about the completeness of this list and about up-to-datenes
+s or correctness of the application notes
+\begin_inset LatexCommand \index{Application notes}
 
-can you solve your project with the selected microcontroller? Would you
- find out early or rather late that your target is too small/slow/whatever?
- Can you switch to a slightly better device if it doesn't fit?
-\layout Itemize
+\end_inset 
 
-should you solve the problem with an 8 bit CPU? Or would a 16/32 bit CPU
- and/or another programming language be more adequate? Would an operating
- system on the target device help?
-\layout Itemize
+.
+\layout Standard
+\align left 
 
-if you solved the problem, will the marketing department be happy?
-\layout Itemize
+\size footnotesize 
 
-if the marketing department is happy, will customers be happy?
-\layout Itemize
+\begin_inset  Tabular
+<lyxtabular version="3" rows="7" columns="3">
+<features>
+<column alignment="block" valignment="top" leftline="true" width="17col%">
+<column alignment="block" valignment="top" leftline="true" width="27col%">
+<column alignment="block" valignment="top" leftline="true" rightline="true" width="57col%">
+<row topline="true" bottomline="true">
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
 
-if you're the project manager, marketing department and maybe even the customer
- in one person, have you tried to see the project from the outside?
-\layout Itemize
+\layout Standard
 
-is the project done if you think it is done? Or is just that other interface/pro
-tocol/feature/configuration/option missing? How about website, manual(s),
- internationali(z|s)ation, packaging, labels, 2nd source for components,
- electromagnetic compatability/interference, documentation for production,
- production test software, update mechanism, patent issues?
-\layout Itemize
 
-is your project adequately positioned in that magic triangle: fame, fortune,
- fun?
+\series bold 
+\size footnotesize 
+Vendor
+\end_inset 
+</cell>
+<cell alignment="left" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
+\begin_inset Text
+
 \layout Standard
 
-Maybe not all answers to these questions are known and some answers may
- even be 
-\emph on 
-no
-\emph defaul
-, nevertheless knowing these questions may help you to avoid burnout
-\begin_inset Foot
-collapsed false
+
+\series bold 
+\size footnotesize 
+Subject / Title
+\end_inse
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
 
 \layout Standard
 
-burnout is bad for electronic devices, programmers and motorcycle tyres
+
+\series bold 
+\size footnotesize 
+Where to get
 \end_inset 
+</cell>
+</row>
+<row topline="true">
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
 
-.
- Chances are you didn't want to hear some of them...
-\layout Chapter
+\layout Standard
 
-Support
-\begin_inset LatexCommand \index{Support}
 
+\size footnotesize 
+Maxim / Dallas
 \end_inset 
-
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
 
 \layout Standard
 
-SDCC has grown to be a large project.
- The compiler alone (without the preprocessor, assembler and linker) is
- well over 100,000 lines of code (blank stripped).
- The open source nature of this project is a key to its continued growth
- and support.
- You gain the benefit and support of many active software developers and
- end users.
- Is SDCC perfect? No, that's why we need your help.
- The developers take pride in fixing reported bugs.
- You can help by reporting the bugs and helping other SDCC users.
- There are lots of ways to contribute, and we encourage you to take part
- in making SDCC a great software package.
-\layout Standard
 
-The SDCC project is hosted on the SDCC sourceforge site at 
-\begin_inset LatexCommand \htmlurl{http://sourceforge.net/projects/sdcc}
+\size footnotesize 
+Using the SDCC Compiler for the DS80C400
+\begin_inset LatexCommand \index{DS80C400}
 
 \end_inset 
 
-.
- You'll find the complete set of mailing lists
-\begin_inset LatexCommand \index{Mailing list(s)}
 
 \end_inset 
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
 
-, forums, bug reporting system, patch submission
-\begin_inset LatexCommand \index{Patch submission}
+\layout Standard
 
-\end_inset 
 
- system, download
-\begin_inset LatexCommand \index{download}
+\size footnotesize 
+
+\begin_inset LatexCommand \url{http://pdfserv.maxim-ic.com/en/an/AN3346.pdf}
 
 \end_inset 
 
- area and Subversion code repository
-\begin_inset LatexCommand \index{Subversion code repository}
 
 \end_inset 
+</cell>
+</row>
+<row topline="true">
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
 
- there.
-\layout Section
+\layout Standard
 
-Reporting Bugs
-\begin_inset LatexCommand \index{Bug reporting}
 
+\size footnotesize 
+Maxim / Dallas
 \end_inset 
+</cell>
+<cell multicolumn="1" alignment="left" valignment="top" topline="true" leftline="true" usebox="none" width="30line%">
+\begin_inset Text
 
+\layout Standard
 
-\begin_inset LatexCommand \index{Reporting bugs}
+
+\size footnotesize 
+Using the Free SDCC C Compiler to Develop Firmware for the DS89C420/430/440/450
+\begin_inset LatexCommand \index{DS89C4x0}
 
 \end_inset 
 
+ Family of Microcontrollers
+\end_inset 
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
 
 \layout Standard
 
-The recommended way of reporting bugs is using the infrastructure of the
- sourceforge site.
- You can follow the status of bug reports there and have an overview about
- the known bugs.
-\layout Standard
 
-Bug reports are automatically forwarded to the developer mailing list and
- will be fixed ASAP.
- When reporting a bug, it is very useful to include a small test program
- (the smaller the better) which reproduces the problem.
- If you can isolate the problem by looking at the generated assembly code,
- this can be very helpful.
- Compiling your program with the -
-\begin_inset ERT
-status Collapsed
+\size footnotesize 
 
-\layout Standard
+\begin_inset LatexCommand \url{http://pdfserv.maxim-ic.com/en/an/AN3477.pdf}
 
-\backslash 
-/
 \end_inset 
 
--dumpall
-\begin_inset LatexCommand \index{-\/-dumpall}
 
 \end_inset 
+</cell>
+</row>
+<row topline="true">
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
 
- option can sometimes be useful in locating optimization problems.
- When reporting a bug please maker sure you:
-\layout Enumerate
-
-Attach the code you are compiling with SDCC.
-\layout Enumerate
-
-Specify the exact command you use to run SDCC, or attach your Makefile.
-\layout Enumerate
+\layout Standard
 
-Specify the SDCC version (type "
-\family sans 
-\series bold 
-sdcc -v
-\family default 
-\series default 
-"), your platform, and operating system.
-\layout Enumerate
 
-Provide an exact copy of any error message or incorrect output.
-\layout Enumerate
+\size footnotesize 
+Silicon Laboratories / Cygnal
+\end_inset 
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
 
-Put something meaningful in the subject of your message.
 \layout Standard
 
-Please attempt to include these 5 important parts, as applicable, in all
- requests for support or when reporting any problems or bugs with SDCC.
- Though this will make your message lengthy, it will greatly improve your
- chance that SDCC users and developers will be able to help you.
- Some SDCC developers are frustrated by bug reports without code provided
- that they can use to reproduce and ultimately fix the problem, so please
- be sure to provide sample code if you are reporting a bug! 
-\layout Standard
 
-Please have a short check that you are using a recent version of SDCC and
- the bug is not yet known.
- This is the link for reporting bugs: 
-\begin_inset LatexCommand \htmlurl{http://sourceforge.net/tracker/?group_id=599&atid=100599}
+\size footnotesize 
+Integrating SDCC 8051 Tools Into The Silicon Labs IDE
+\begin_inset LatexCommand \index{IDE}
 
 \end_inset 
 
-.
-\layout Section
-
-Requesting Features
-\begin_inset LatexCommand \label{sub:Requesting-Features}
 
 \end_inset 
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
 
+\layout Standard
 
-\begin_inset LatexCommand \index{Feature request}
-
-\end_inset 
 
+\size footnotesize 
 
-\begin_inset LatexCommand \index{Requesting features}
+\begin_inset LatexCommand \url{http://www.silabs.com/public/documents/tpub_doc/anote/Microcontrollers/en/an198.pdf}
 
 \end_inset 
 
 
+\end_inset 
+</cell>
+</row>
+<row topline="true">
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
 \layout Standard
 
-Like bug reports feature requests are forwarded to the developer mailing
- list.
- This is the link for requesting features: 
-\begin_inset LatexCommand \htmlurl{http://sourceforge.net/tracker/?group_id=599&atid=350599}
 
+\size footnotesize 
+Ramtron / Goal Semiconductor
 \end_inset 
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
 
-.
-\layout Section
-
-Submitting patches
 \layout Standard
 
-Like bug reports contributed patches are forwarded to the developer mailing
- list.
- This is the link for submitting patches
-\begin_inset LatexCommand \index{Patch submission}
 
+\size footnotesize 
+Interfacing SDCC to Syn and Textpad
 \end_inset 
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
 
-: 
-\begin_inset LatexCommand \url{http://sourceforge.net/tracker/?group_id=599&atid=300599}
+\layout Standard
 
-\end_inset 
 
-.
-\layout Standard
+\size footnotesize 
 
-You need to specify some parameters to the 
-\family typewriter 
-diff
-\family default 
- command for the patches to be useful.
- If you modified more than one file a patch created f.e.
- with 
-\family sans 
-\series bold 
+\begin_inset LatexCommand \url{http://www.ramtron.com/doc/Products/Microcontroller/Support_Tools.asp}
 
-\begin_inset Quotes sld
 \end_inset 
 
-diff -Naur unmodified_directory modified_directory >my_changes.patch
-\begin_inset Quotes srd
+
 \end_inset 
+</cell>
+</row>
+<row topline="true">
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
 
+\layout Standard
 
-\family default 
-\series default 
- will be fine, otherwise 
-\family sans 
-\series bold 
 
-\begin_inset Quotes sld
+\size footnotesize 
+Ramtron / Goal Semiconductor
 \end_inset 
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
 
-diff -u sourcefile.c.orig sourcefile.c >my_changes.patch
-\begin_inset Quotes srd
-\end_inset 
+\layout Standard
 
 
-\series default 
-\family default 
-will do.
-\layout Section
+\size footnotesize 
+Installing and Configuring SDCC and Crimson Editor 
+\end_inset 
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
 
-Getting Help
 \layout Standard
 
-These links should take you directly to the 
-\begin_inset LatexCommand \url[Mailing lists]{http://sourceforge.net/mail/?group_id=599}
-
-\end_inset 
-
 
-\begin_inset Foot
-collapsed false
+\size footnotesize 
 
-\layout Standard
+\begin_inset LatexCommand \url{http://www.ramtron.com/doc/Products/Microcontroller/Support_Tools.asp}
 
-Traffic on sdcc-devel and sdcc-user is about 100 mails/month each not counting
- automated messages (mid 2003)
 \end_inset 
 
- and the 
-\begin_inset LatexCommand \url[Forums]{http://sourceforge.net/forum/?group_id=599}
 
 \end_inset 
+</cell>
+</row>
+<row topline="true" bottomline="true">
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
 
-, lists
-\begin_inset LatexCommand \index{Mailing list(s)}
+\layout Standard
 
-\end_inset 
 
- and forums are archived and searchable so if you are lucky someone already
- had a similar problem.
- While mails to the lists themselves are delivered promptly their web front
- end on sourceforge sometimes shows a severe time lag (up to several weeks),
- if you're seriously using SDCC please consider subscribing to the lists.
-\layout Section
+\size footnotesize 
+Texas Instruments
+\end_inset 
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
 
-ChangeLog
 \layout Standard
 
-You can follow the status of the Subversion version
-\begin_inset LatexCommand \index{version}
 
+\size footnotesize 
+MSC12xx Programming with SDCC
 \end_inset 
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
 
- of SDCC by watching the Changelog
-\begin_inset LatexCommand \index{Changelog}
-
-\end_inset 
+\layout Standard
 
- in the Subversion repository
-\newline 
 
 \size footnotesize 
 
-\begin_inset LatexCommand \htmlurl{http://svn.sourceforge.net/viewcvs.cgi/*checkout*/sdcc/trunk/sdcc/ChangeLog}
+\begin_inset LatexCommand \url{http://focus.ti.com/general/docs/lit/getliterature.tsp?literatureNumber=sbaa109&fileType=pdf}
 
 \end_inset 
 
-.
-\layout Section
 
-Release policy
-\begin_inset LatexCommand \index{Release policy}
+\end_inset 
+</cell>
+</row>
+</lyxtabular>
 
 \end_inset 
 
 
-\layout Standard
+\layout Section
 
-Historically there often were long delays between official releases and
- the sourceforge download area tends to get not updated at all.
- Excuses in the past might have referred to problems with live range analysis,
- but as this was fixed a while ago, the current problem is that another
- excuse has to be found.
- Kidding aside, we have to get better there! On the other hand there are
- daily snapshots available at 
-\begin_inset LatexCommand \htmlurl[snap]{http://sdcc.sourceforge.net/snap.php}
+Some Questions
+\layout Standard
 
-\end_inset 
+Some questions answered, some pointers given - it might be time to in turn
+ ask 
+\emph on 
+you
+\emph default 
+ some questions: 
+\layout Itemize
 
-, and you can always build the very last version (hopefully with many bugs
- fixed, and features added) from the source code available at 
-\begin_inset LatexCommand \htmlurl[Source]{http://sdcc.sourceforge.net/snap.php#Source}
+can you solve your project with the selected microcontroller? Would you
+ find out early or rather late that your target is too small/slow/whatever?
+ Can you switch to a slightly better device if it doesn't fit?
+\layout Itemize
 
-\end_inset 
+should you solve the problem with an 8 bit CPU? Or would a 16/32 bit CPU
+ and/or another programming language be more adequate? Would an operating
+ system on the target device help?
+\layout Itemize
 
-.
-\layout Section
+if you solved the problem, will the marketing department be happy?
+\layout Itemize
 
-Examples
-\begin_inset LatexCommand \index{Examples}
+if the marketing department is happy, will customers be happy?
+\layout Itemize
 
-\end_inset 
+if you're the project manager, marketing department and maybe even the customer
+ in one person, have you tried to see the project from the outside?
+\layout Itemize
 
+is the project done if you think it is done? Or is just that other interface/pro
+tocol/feature/configuration/option missing? How about website, manual(s),
+ internationali(z|s)ation, packaging, labels, 2nd source for components,
+ electromagnetic compatability/interference, documentation for production,
+ production test software, update mechanism, patent issues?
+\layout Itemize
 
+is your project adequately positioned in that magic triangle: fame, fortune,
+ fun?
 \layout Standard
 
-You'll find some small examples in the directory 
+Maybe not all answers to these questions are known and some answers may
+ even be 
 \emph on 
-sdcc/device/examples/.
+no
 \emph default 
-More examples and libraries are available at
-\emph on 
- The SDCC Open Knowledge Resource 
-\begin_inset LatexCommand \url{http://sdccokr.dl9sec.de/}
-
-\end_inset 
+, nevertheless knowing these questions may help you to avoid burnout
+\begin_inset Foot
+collapsed false
 
-\emph default 
-web site or at 
-\begin_inset LatexCommand \url{http://www.pjrc.com/tech/8051/}
+\layout Standard
 
+burnout is bad for electronic devices, programmers and motorcycle tyres
 \end_inset 
 
 .
-\layout Comment
-
-I did insert a reference to Paul's web site here although it seems rather
- dedicated to a specific 8032 board (I think it's okay because it f.e.
- shows LCD/Harddisc interface and has a free 8051 monitor.
- Independent 8032 board vendors face hard competition of heavily subsidized
- development boards anyway).
-\layout Comment
-
-Maybe we should include some links to real world applications.
- Preferably pointer to pointers (one for each architecture) so this stays
- manageable here?
-\layout Section
+ Chances are you didn't want to hear some of them...
+\layout Chapter
 
-Quality control
-\begin_inset LatexCommand \index{Quality control}
+Support
+\begin_inset LatexCommand \index{Support}
 
 \end_inset 
 
 
 \layout Standard
 
-The compiler is passed through nightly compile and build checks.
- The so called 
-\shape italic 
-regression tests
-\shape default 
+SDCC has grown to be a large project.
+ The compiler alone (without the preprocessor, assembler and linker) is
+ well over 150,000 lines of code (blank stripped).
+ The open source nature of this project is a key to its continued growth
+ and support.
+ You gain the benefit and support of many active software developers and
+ end users.
+ Is SDCC perfect? No, that's why we need your help.
+ The developers take pride in fixing reported bugs.
+ You can help by reporting the bugs and helping other SDCC users.
+ There are lots of ways to contribute, and we encourage you to take part
+ in making SDCC a great software package.
+\layout Standard
 
-\begin_inset LatexCommand \index{Regression test}
+The SDCC project is hosted on the SDCC sourceforge site at 
+\begin_inset LatexCommand \htmlurl{http://sourceforge.net/projects/sdcc}
 
 \end_inset 
 
- check that SDCC itself compiles flawlessly on several platforms and checks
- the quality of the code generated by SDCC by running the code through simulator
-s.
- There is a separate document 
-\shape italic 
-test_suite.pdf
-\begin_inset LatexCommand \index{Test suite}
+.
+ You'll find the complete set of mailing lists
+\begin_inset LatexCommand \index{Mailing list(s)}
 
 \end_inset 
 
+, forums, bug reporting system, patch submission
+\begin_inset LatexCommand \index{Patch submission}
 
-\shape default 
- about this.
-\layout Standard
+\end_inset 
 
-You'll find the test code in the directory 
-\shape italic 
-sdcc/support/regression
-\shape default 
-.
- You can run these tests manually by running 
-\family sans 
-make
-\family default 
- in this directory (or f.e.
-\family sans 
-\series bold 
+ system, download
+\begin_inset LatexCommand \index{download}
 
-\begin_inset Quotes sld
 \end_inset 
 
-make test-mcs51
-\begin_inset Quotes srd
+ area and Subversion code repository
+\begin_inset LatexCommand \index{Subversion code repository}
+
 \end_inset 
 
+ there.
+\layout Section
 
-\family default 
-\series default 
- if you don't want to run the complete tests).
- The test code might also be interesting if you want to look for examples
-\begin_inset LatexCommand \index{Examples}
+Reporting Bugs
+\begin_inset LatexCommand \index{Bug reporting}
 
 \end_inset 
 
- checking corner cases of SDCC or if you plan to submit patches
-\begin_inset LatexCommand \index{Patch submission}
+
+\begin_inset LatexCommand \index{Reporting bugs}
 
 \end_inset 
 
-.
-\layout Standard
 
-The pic port uses a different set of regression tests, you'll find them
- in the directory 
-\shape italic 
-sdcc/src/regression
-\shape default 
-.
-\layout Section
+\layout Standard
 
-Use of SDCC in Education
+The recommended way of reporting bugs is using the infrastructure of the
+ sourceforge site.
+ You can follow the status of bug reports there and have an overview about
+ the known bugs.
 \layout Standard
 
-In short: 
-\emph on 
-highly
-\emph default 
- encouraged
-\begin_inset Foot
-collapsed false
+Bug reports are automatically forwarded to the developer mailing list and
+ will be fixed ASAP.
+ When reporting a bug, it is very useful to include a small test program
+ (the smaller the better) which reproduces the problem.
+ If you can isolate the problem by looking at the generated assembly code,
+ this can be very helpful.
+ Compiling your program with the -
+\begin_inset ERT
+status Collapsed
 
 \layout Standard
 
-the phrase "use in education" might evoke the association "
-\emph on 
-only
-\emph default 
- fit for use in education".
- This connotation is not intended but nevertheless risked as the licensing
- of SDCC makes it difficult to offer educational discounts
+\backslash 
+/
 \end_inset 
 
-.
- If your rationales are to:
-\layout Enumerate
-
-give students a chance to understand the 
-\emph on 
-complete
-\emph default 
- steps of code generation
-\layout Enumerate
-
-have a curriculum that can be extended for years.
- Then you could use an fpga board as target and your curriculum will seamlessly
- extend from logic synthesis (
-\begin_inset LatexCommand \url[http://www.opencores.org]{opencores.org}
+-dumpall
+\begin_inset LatexCommand \index{-\/-dumpall}
 
 \end_inset 
 
-, 
-\begin_inset LatexCommand \url[Oregano]{http://www.oregano.at/ip/ip01.htm}
+ option can sometimes be useful in locating optimization problems.
+ When reporting a bug please make sure you:
+\layout Enumerate
 
-\end_inset 
+Attach the code you are compiling with SDCC.
+\layout Enumerate
 
-), over assembly programming, to C to FPGA compilers (
-\begin_inset LatexCommand \url[FPGAC]{http://sf.net/projects/fpgac}
+Specify the exact command you use to run SDCC, or attach your Makefile.
+\layout Enumerate
 
-\end_inset 
+Specify the SDCC version (type "
+\family sans 
+\series bold 
+sdcc -v
+\family default 
+\series default 
+"), your platform, and operating system.
+\layout Enumerate
 
-) and to C.
+Provide an exact copy of any error message or incorrect output.
 \layout Enumerate
 
-be able to insert excursions about skills like using a revision control
- system, submitting/applying patches, using a type-setting (as opposed to
- word-processing) engine LyX/LaTeX, using 
-\begin_inset LatexCommand \url[SourceForge]{http://www.sf.net}
+Put something meaningful in the subject of your message.
+\layout Standard
 
-\end_inset 
+Please attempt to include these 5 important parts, as applicable, in all
+ requests for support or when reporting any problems or bugs with SDCC.
+ Though this will make your message lengthy, it will greatly improve your
+ chance that SDCC users and developers will be able to help you.
+ Some SDCC developers are frustrated by bug reports without code provided
+ that they can use to reproduce and ultimately fix the problem, so please
+ be sure to provide sample code if you are reporting a bug! 
+\layout Standard
 
-, following some 
-\begin_inset LatexCommand \url[netiquette]{http://en.wikipedia.org/wiki/Netiquette}
+Please have a short check that you are using a recent version of SDCC and
+ the bug is not yet known.
+ This is the link for reporting bugs: 
+\begin_inset LatexCommand \htmlurl{http://sourceforge.net/tracker/?group_id=599&atid=100599}
 
 \end_inset 
 
-, understanding BSD/LGPL/GPL/Proprietary licensing, growth models of Open
Source Software, CPU simulation, compiler regression tests
-\begin_inset LatexCommand \index{Regression test}
+.
With SDCC on average having more than 200 downloads
+\begin_inset LatexCommand \index{download}
 
 \end_inset 
 
-.
-\newline 
-And if there should be a shortage of ideas then you can always point students
- to the ever-growing feature request list 
-\begin_inset LatexCommand \htmlurl{http://sourceforge.net/tracker/?group_id=599&atid=350599}
+ on sourceforge per day
+\begin_inset Foot
+collapsed false
 
-\end_inset 
+\layout Standard
 
-.
-\layout Enumerate
+220 daily downloads on average Jan-Sept 2006 and about 150 daily downloads
+ between 2002 and 2005.
+ This does not include other methods of distribution.
+\end_inset 
 
-not tie students to a specific host platform and instead allow them to use
- a host platform of 
+ there must be some users.
+ So it's not exactly easy to find a new bug.
+ If you find one we need it: 
 \emph on 
-their
+reporting bugs is good
 \emph default 
- choice (among them Alpha, i386, i386_64, MacOs, Mips, Sparc, Windows and
- eventually 
-\begin_inset LatexCommand \url[OLPC]{http://wiki.laptop.org/wiki/One_Laptop_per_Child}
+.
+\layout Section
+
+Requesting Features
+\begin_inset LatexCommand \label{sub:Requesting-Features}
 
 \end_inset 
 
-)
-\layout Enumerate
 
-not encourage students to use illegal copies of educational software
-\layout Enumerate
+\begin_inset LatexCommand \index{Feature request}
 
-be immune to licensing/availability/price changes of the chosen tool chain
-\layout Enumerate
+\end_inset 
 
-be able to change to a new target platform without having to adopt a new
- tool chain
-\layout Enumerate
 
-have complete control over and insight into the tool chain
-\layout Enumerate
+\begin_inset LatexCommand \index{Requesting features}
 
-make your students aware about the pros and cons of open source software
- development
-\layout Enumerate
+\end_inset 
 
-give back to the public as you are probably at least partially publically
- funded
-\layout Enumerate
 
-give students a chance to publically prove their skills and to possibly
- see a world wide impact
 \layout Standard
 
-then SDCC is probably among the first choices.
- Well, probably SDCC might be the only choice.
-\layout Chapter
-\pagebreak_top 
-SDCC Technical Data
-\layout Section
-
-Optimizations
-\begin_inset LatexCommand \index{Optimizations}
+Like bug reports feature requests are forwarded to the developer mailing
+ list.
+ This is the link for requesting features: 
+\begin_inset LatexCommand \htmlurl{http://sourceforge.net/tracker/?group_id=599&atid=350599}
 
 \end_inset 
 
+.
+\layout Section
 
+Submitting patches
 \layout Standard
 
-SDCC performs a host of standard optimizations in addition to some MCU specific
- optimizations.
-\layout Subsection
-
-Sub-expression Elimination
-\begin_inset LatexCommand \index{Subexpression elimination}
+Like bug reports contributed patches are forwarded to the developer mailing
+ list.
+ This is the link for submitting patches
+\begin_inset LatexCommand \index{Patch submission}
 
 \end_inset 
 
+: 
+\begin_inset LatexCommand \url{http://sourceforge.net/tracker/?group_id=599&atid=300599}
+
+\end_inset 
 
+.
 \layout Standard
 
-The compiler does local and 
-\emph on 
-g
-\emph default 
-lobal 
-\emph on 
-c
-\emph default 
-ommon 
-\emph on 
-s
-\emph default 
-ubexpression 
-\emph on 
-e
-\emph default 
-limination, e.g.: 
-\layout Verse
+You need to specify some parameters to the 
+\family typewriter 
+diff
+\family default 
+ command for the patches to be useful.
+ If you modified more than one file a patch created f.e.
+ with 
+\family sans 
+\series bold 
 
+\begin_inset Quotes sld
+\end_inset 
 
-\family typewriter 
-i = x + y + 1; 
-\newline 
-j = x + y;
-\layout Standard
+diff -Naur unmodified_directory modified_directory >my_changes.patch
+\begin_inset Quotes srd
+\end_inset 
 
-will be translated to
-\layout Verse
 
+\family default 
+\series default 
+ will be fine, otherwise 
+\family sans 
+\series bold 
 
-\family typewriter 
-iTemp = x + y; 
-\newline 
-i = iTemp + 1; 
-\newline 
-j = iTemp;
-\layout Standard
+\begin_inset Quotes sld
+\end_inset 
 
-Some subexpressions are not as obvious as the above example, e.g.:
-\layout Verse
+diff -u sourcefile.c.orig sourcefile.c >my_changes.patch
+\begin_inset Quotes srd
+\end_inset 
 
 
-\family typewriter 
-a->b[i].c = 10; 
-\newline 
-a->b[i].d = 11;
+\series default 
+\family default 
+will do.
+\layout Section
+
+Getting Help
 \layout Standard
 
-In this case the address arithmetic a->b[i] will be computed only once;
- the equivalent code in C would be.
-\layout Verse
+These links should take you directly to the 
+\begin_inset LatexCommand \url[Mailing lists]{http://sourceforge.net/mail/?group_id=599}
 
+\end_inset 
 
-\family typewriter 
-iTemp = a->b[i]; 
-\newline 
-iTemp.c = 10; 
-\newline 
-iTemp.d = 11;
-\layout Standard
 
-The compiler will try to keep these temporary variables in registers.
-\layout Subsection
+\begin_inset Foot
+collapsed false
 
-Dead-Code Elimination
-\begin_inset LatexCommand \index{Dead-code elimination}
+\layout Standard
 
+Traffic on sdcc-devel and sdcc-user is about 100 mails/month each not counting
+ automated messages (mid 2003)
 \end_inset 
 
+ and the 
+\begin_inset LatexCommand \url[Forums]{http://sourceforge.net/forum/?group_id=599}
 
-\layout Verse
+\end_inset 
 
+, lists
+\begin_inset LatexCommand \index{Mailing list(s)}
 
-\family typewriter 
-int global;
-\newline 
+\end_inset 
 
-\newline 
-void f () { 
-\newline 
-\SpecialChar ~
-\SpecialChar ~
-int i; 
-\newline 
-\SpecialChar ~
-\SpecialChar ~
-i = 1; \SpecialChar ~
-\SpecialChar ~
-\SpecialChar ~
-\SpecialChar ~
-\SpecialChar ~
-/* dead store */ 
-\newline 
-\SpecialChar ~
-\SpecialChar ~
-global = 1;\SpecialChar ~
-/* dead store */ 
-\newline 
-\SpecialChar ~
-\SpecialChar ~
-global = 2; 
-\newline 
-\SpecialChar ~
-\SpecialChar ~
-return; 
-\newline 
-\SpecialChar ~
-\SpecialChar ~
-global = 3;\SpecialChar ~
-/* unreachable */ 
-\newline 
-}
-\layout Standard
-
-will be changed to
-\layout Verse
+ and forums are archived and searchable so if you are lucky someone already
+ had a similar problem.
+ While mails to the lists themselves are delivered promptly their web front
+ end on sourceforge sometimes shows a severe time lag (up to several weeks),
+ if you're seriously using SDCC please consider subscribing to the lists.
+\layout Section
 
+ChangeLog
+\layout Standard
 
-\family typewriter 
-int global;
-\newline 
+You can follow the status of the Subversion version
+\begin_inset LatexCommand \index{version}
 
-\newline 
-void f () {
-\newline 
-\SpecialChar ~
-\SpecialChar ~
-global = 2; 
-\newline 
-}
-\layout Subsection
+\end_inset 
 
-Copy-Propagation
-\begin_inset LatexCommand \index{Copy propagation}
+ of SDCC by watching the Changelog
+\begin_inset LatexCommand \index{Changelog}
 
 \end_inset 
 
+ in the Subversion repository
+\size footnotesize 
+\begin_inset LatexCommand \htmlurl{http://svn.sourceforge.net/viewcvs.cgi/*checkout*/sdcc/trunk/sdcc/ChangeLog}
 
-\layout Verse
+\end_inset 
 
+.
+\layout Section
 
-\family typewriter 
-int f() { 
-\newline 
-\SpecialChar ~
-\SpecialChar ~
-int i, j; 
-\newline 
-\SpecialChar ~
-\SpecialChar ~
-i = 10; 
-\newline 
-\SpecialChar ~
-\SpecialChar ~
-j = i; 
-\newline 
-\SpecialChar ~
-\SpecialChar ~
-return j; 
-\newline 
-}
+Subversion Source Code Repository
 \layout Standard
 
-will be changed to 
-\layout Verse
+The output of 
+\family sans 
+\series bold 
+sdcc --version
+\family default 
+\series default 
+ or the filenames of the snapshot versions of SDCC include date and its
+ Subversion
+\begin_inset LatexCommand \index{Subversion code repository}
 
+\end_inset 
 
-\family typewriter 
-int f() { 
-\newline 
-\SpecialChar ~
-\SpecialChar ~
-int i, j; 
-\newline 
-\SpecialChar ~
-\SpecialChar ~
-i = 10; 
-\newline 
-\SpecialChar ~
-\SpecialChar ~
-j = 10; 
-\newline 
-\SpecialChar ~
-\SpecialChar ~
-return 10; 
-\newline 
-}
-\layout Standard
+ number.
+ Subversion allows to download the source of recent or previous versions
+\begin_inset LatexCommand \url{http://sourceforge.net/svn/?group_id=599}
 
-Note: the dead stores created by this copy propagation will be eliminated
- by dead-code elimination.
-\layout Subsection
+\end_inset 
 
-Loop Optimizations
-\begin_inset LatexCommand \index{Loop optimization}
+ (by number or by date).
+ An on-line source code browser and detailled instructions are also available
+ there.
+ SDCC versions starting from 1999 up to now are available (currently the
+ versions prior to the conversion from cvs
+\begin_inset LatexCommand \index{cvs|see{Subversion}}
 
 \end_inset 
 
+ to Subversion (April 2006) are either by accessible by Subversion or by
+ cvs).
+\layout Section
 
-\begin_inset LatexCommand \label{sub:Loop-Optimizations}
+Release policy
+\begin_inset LatexCommand \index{Release policy}
 
 \end_inset 
 
 
 \layout Standard
 
-Two types of loop optimizations are done by SDCC 
-\emph on 
-loop invariant
-\emph default 
- lifting and
-\emph on 
- strength reduction
-\emph default 
- of loop induction variables.
- In addition to the strength reduction the optimizer marks the induction
- variables and the register allocator tries to keep the induction variables
- in registers for the duration of the loop.
- Because of this preference of the register allocator
-\begin_inset LatexCommand \index{Register allocation}
+Historically there often were long delays between official releases and
+ the sourceforge download area tends to get not updated at all.
+ Excuses in the past might have referred to problems with live range analysis,
+ but as this was fixed a while ago, the current problem is that another
+ excuse has to be found.
+ Kidding aside, we have to get better there! On the other hand there are
+ daily snapshots available at 
+\begin_inset LatexCommand \htmlurl[snap]{http://sdcc.sourceforge.net/snap.php}
 
 \end_inset 
 
-, loop induction optimization causes an increase in register pressure, which
- may cause unwanted spilling of other temporary variables into the stack
-\begin_inset LatexCommand \index{stack}
+, and you can always build the very last version (hopefully with many bugs
+ fixed, and features added) from the source code available at 
+\begin_inset LatexCommand \htmlurl[Source]{http://sdcc.sourceforge.net/snap.php#Source}
 
 \end_inset 
 
- / data space.
- The compiler will generate a warning message when it is forced to allocate
- extra space either on the stack or data space.
- If this extra space allocation is undesirable then induction optimization
- can be eliminated either for the entire source file (with -
-\begin_inset ERT
-status Collapsed
-
-\layout Standard
+.
+ A release wiki
+\begin_inset LatexCommand \index{wiki}
 
-\backslash 
-/
 \end_inset 
 
--noinduction option) or for a given function only using #pragma\SpecialChar ~
-noinduction
-\begin_inset LatexCommand \index{\#pragma noinduction}
+
+\begin_inset LatexCommand \index{Release wiki}
 
 \end_inset 
 
-.
-\newline 
+ at 
+\begin_inset LatexCommand \url{http://sdcc.sf.net/release_wiki/}
 
-\newline 
-Loop Invariant:
-\layout Verse
+\end_inset 
 
+ also holds some information about past and future releases.
+\layout Section
 
-\family typewriter 
-for (i = 0 ; i < 100 ; i ++) 
-\newline 
-\SpecialChar ~
-\SpecialChar ~
-\SpecialChar ~
-\SpecialChar ~
-f += k + l;
-\layout Standard
+Examples
+\begin_inset LatexCommand \index{Examples}
 
-changed to
-\layout Verse
+\end_inset 
 
 
-\family typewriter 
-itemp = k + l; 
-\newline 
-for (i = 0; i < 100; i++) 
-\newline 
-\SpecialChar ~
-\SpecialChar ~
-\SpecialChar ~
-\SpecialChar ~
-f += itemp;
 \layout Standard
 
-As mentioned previously some loop invariants are not as apparent, all static
- address computations are also moved out of the loop.
-\newline 
-
-\newline 
-Strength Reduction
-\begin_inset LatexCommand \index{Strength reduction}
+You'll find some small examples in the directory 
+\emph on 
+sdcc/device/examples/.
+\emph default 
+More examples and libraries are available at
+\emph on 
+ The SDCC Open Knowledge Resource 
+\begin_inset LatexCommand \url{http://sdccokr.dl9sec.de/}
 
 \end_inset 
 
-, this optimization substitutes an expression by a cheaper expression:
-\layout Verse
+\emph default 
+web site or at 
+\begin_inset LatexCommand \url{http://www.pjrc.com/tech/8051/}
 
+\end_inset 
 
-\family typewriter 
-for (i=0;i < 100; i++)
-\newline 
-\SpecialChar ~
-\SpecialChar ~
-\SpecialChar ~
-\SpecialChar ~
-ar[i*5] = i*3;
-\layout Standard
+.
+\layout Comment
 
-changed to
-\layout Verse
+I did insert a reference to Paul's web site here although it seems rather
+ dedicated to a specific 8032 board (I think it's okay because it f.e.
+ shows LCD/Harddisc interface and has a free 8051 monitor.
+ Independent 8032 board vendors face hard competition of heavily subsidized
+ development boards anyway).
+\layout Comment
 
+Maybe we should include some links to real world applications.
+ Preferably pointer to pointers (one for each architecture) so this stays
+ manageable here?
+\layout Section
 
-\family typewriter 
-itemp1 = 0; 
-\newline 
-itemp2 = 0; 
-\newline 
-for (i=0;i< 100;i++) { 
-\newline 
-\SpecialChar ~
-\SpecialChar ~
-\SpecialChar ~
-\SpecialChar ~
-ar[itemp1] = itemp2; 
-\newline 
-\SpecialChar ~
-\SpecialChar ~
-\SpecialChar ~
-\SpecialChar ~
-itemp1 += 5; 
-\newline 
-\SpecialChar ~
-\SpecialChar ~
-\SpecialChar ~
-\SpecialChar ~
-itemp2 += 3; 
-\newline 
-}
-\layout Standard
-
-The more expensive multiplication
-\begin_inset LatexCommand \index{Multiplication}
+Quality control
+\begin_inset LatexCommand \label{sec:Quality-control}
 
 \end_inset 
 
- is changed to a less expensive addition.
-\layout Subsection
 
-Loop Reversing
-\begin_inset LatexCommand \index{Loop reversing}
+\begin_inset LatexCommand \index{Quality control}
 
 \end_inset 
 
 
 \layout Standard
 
-This optimization is done to reduce the overhead of checking loop boundaries
- for every iteration.
- Some simple loops can be reversed and implemented using a 
-\begin_inset Quotes eld
+The compiler is passed through nightly compile and build checks.
+ The so called 
+\shape italic 
+regression tests
+\shape default 
+
+\begin_inset LatexCommand \index{Regression test}
+
 \end_inset 
 
-decrement and jump if not zero
-\begin_inset Quotes erd
+ 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
+ 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
+ more than 500 test cases which include more than 4500 tests.
+ The results of these tests are published daily on SDCC's snapshot page
+ (click on the red or green symbols on the right side of 
+\begin_inset LatexCommand \url{http://sdcc.sourceforge.net/snap.php}
+
 \end_inset 
 
- instruction.
- SDCC checks for the following criterion to determine if a loop is reversible
- (note: more sophisticated compilers use data-dependency analysis to make
- this determination, SDCC uses a more simple minded analysis).
-\layout Itemize
+).
+\layout Standard
 
-The 'for' loop is of the form 
-\newline 
+There is a separate document 
+\shape italic 
+test_suite.pdf 
+\begin_inset LatexCommand \index{Test suite}
 
-\newline 
+\end_inset 
 
-\family typewriter 
-for(<symbol> = <expression>; <sym> [< | <=] <expression>; [<sym>++ | <sym>
- += 1])
-\newline 
-\SpecialChar ~
-\SpecialChar ~
-\SpecialChar ~
-\SpecialChar ~
-<for body>
-\layout Itemize
 
-The <for body> does not contain 
-\begin_inset Quotes eld
+\shape default 
+\begin_inset LatexCommand \url{http://sdcc.sourceforge.net/doc/test_suite_spec.pdf}
+
 \end_inset 
 
-continue
-\begin_inset Quotes erd
+ about the regression test suite.
+\layout Standard
+
+You'll find the test code in the directory 
+\shape italic 
+sdcc/support/regression
+\shape default 
+.
+ You can run these tests manually by running 
+\family sans 
+make
+\family default 
+ in this directory (or f.e.
+\family sans 
+\series bold 
+
+\begin_inset Quotes sld
 \end_inset 
 
- or 'break
-\begin_inset Quotes erd
+make test-mcs51
+\begin_inset Quotes srd
+\end_inset 
+
+
+\family default 
+\series default 
+ if you don't want to run the complete tests).
+ The test code might also be interesting if you want to look for examples
+\begin_inset LatexCommand \index{Examples}
+
+\end_inset 
+
+ checking corner cases of SDCC or if you plan to submit patches
+\begin_inset LatexCommand \index{Patch submission}
+
 \end_inset 
 
 .
-\layout Itemize
+\layout Standard
 
-All goto's are contained within the loop.
-\layout Itemize
+The 14bit pic port uses a different set of regression tests 
+\begin_inset LatexCommand \index{Regression test (PIC14)}
 
-No function calls within the loop.
-\layout Itemize
+\end_inset 
 
-The loop control variable <sym> is not assigned any value within the loop
-\layout Itemize
+, you'll find them in the directory 
+\shape italic 
+sdcc/src/regression
+\shape default 
+.
+\layout Section
 
-The loop control variable does NOT participate in any arithmetic operation
- within the loop.
-\layout Itemize
+Use of SDCC in Education
+\layout Standard
 
-There are NO switch statements in the loop.
-\layout Subsection
+In short: 
+\emph on 
+highly
+\emph default 
+ encouraged
+\begin_inset Foot
+collapsed false
 
-Algebraic Simplifications
 \layout Standard
 
-SDCC does numerous algebraic simplifications, the following is a small sub-set
- of these optimizations.
-\layout Verse
+the phrase "use in education" might evoke the association "
+\emph on 
+only
+\emph default 
+ fit for use in education".
+ This connotation is not intended but nevertheless risked as the licensing
+ of SDCC makes it difficult to offer educational discounts
+\end_inset 
 
+.
+ If your rationales are to:
+\layout Enumerate
 
-\family typewriter 
-i = j + 0;\SpecialChar ~
-\SpecialChar ~
-\SpecialChar ~
-\SpecialChar ~
- /* changed to: */\SpecialChar ~
-\SpecialChar ~
-\SpecialChar ~
-\SpecialChar ~
- i = j; 
-\newline 
-i /= 2;\SpecialChar ~
-\SpecialChar ~
-\SpecialChar ~
-\SpecialChar ~
-\SpecialChar ~
-\SpecialChar ~
-\SpecialChar ~
- /* changed to: */\SpecialChar ~
-\SpecialChar ~
-\SpecialChar ~
-\SpecialChar ~
- i >>= 1; 
-\newline 
-i = j - j;\SpecialChar ~
-\SpecialChar ~
-\SpecialChar ~
-\SpecialChar ~
- /* changed to: */\SpecialChar ~
-\SpecialChar ~
-\SpecialChar ~
-\SpecialChar ~
- i = 0; 
-\newline 
-i = j / 1;\SpecialChar ~
-\SpecialChar ~
-\SpecialChar ~
-\SpecialChar ~
- /* changed to: */\SpecialChar ~
-\SpecialChar ~
-\SpecialChar ~
-\SpecialChar ~
- i = j;
-\layout Standard
+give students a chance to understand the 
+\emph on 
+complete
+\emph default 
+ steps of code generation
+\layout Enumerate
 
-Note the subexpressions
-\begin_inset LatexCommand \index{Subexpression}
+have a curriculum that can be extended for years.
+ Then you could use an fpga board as target and your curriculum will seamlessly
+ extend from logic synthesis (
+\begin_inset LatexCommand \url[http://www.opencores.org]{opencores.org}
 
 \end_inset 
 
- given above are generally introduced by macro expansions or as a result
- of copy/constant propagation.
-\layout Subsection
+, 
+\begin_inset LatexCommand \url[Oregano]{http://www.oregano.at/ip/ip01.htm}
 
-'switch' Statements
-\begin_inset LatexCommand \label{sub:'switch'-Statements}
+\end_inset 
+
+), over assembly programming, to C to FPGA compilers (
+\begin_inset LatexCommand \url[FPGAC]{http://sf.net/projects/fpgac}
 
 \end_inset 
 
+) and to C.
+\layout Enumerate
 
-\begin_inset LatexCommand \index{switch statement}
+be able to insert excursions about skills like using a revision control
+ system, submitting/applying patches, using a type-setting (as opposed to
+ word-processing) engine LyX/LaTeX, using 
+\begin_inset LatexCommand \url[SourceForge]{http://www.sf.net}
 
 \end_inset 
 
+, following some 
+\begin_inset LatexCommand \url[netiquette]{http://en.wikipedia.org/wiki/Netiquette}
 
-\layout Standard
+\end_inset 
 
-SDCC can optimize switch statements to jump tables
-\begin_inset LatexCommand \index{jump tables}
+, understanding BSD/LGPL/GPL/Proprietary licensing, growth models of Open
+ Source Software, CPU simulation, compiler regression tests
+\begin_inset LatexCommand \index{Regression test}
 
 \end_inset 
 
 .
- It makes the decision based on an estimate of the generated code size.
- SDCC is quite liberal in the requirements for jump table generation: 
-\layout Itemize
+\newline 
+And if there should be a shortage of ideas then you can always point students
+ to the ever-growing feature request list 
+\begin_inset LatexCommand \htmlurl{http://sourceforge.net/tracker/?group_id=599&atid=350599}
 
-The labels need not be in order, and the starting number need not be one
- or zero, the case labels are in numerical sequence or not too many case
- labels are missing.
-\begin_deeper 
-\layout Verse
+\end_inset 
+
+.
+\layout Enumerate
+
+not tie students to a specific host platform and instead allow them to use
+ a host platform of 
+\emph on 
+their
+\emph default 
+ choice (among them Alpha, i386, i386_64, MacOs, Mips, Sparc, Windows and
+ eventually 
+\begin_inset LatexCommand \url[OLPC]{http://www.laptop.org}
+
+\end_inset 
+
+)
+\layout Enumerate
+
+not encourage students to use illegal copies of educational software
+\layout Enumerate
+
+be immune to licensing/availability/price changes of the chosen tool chain
+\layout Enumerate
+
+be able to change to a new target platform without having to adopt a new
+ tool chain
+\layout Enumerate
+
+have complete control over and insight into the tool chain
+\layout Enumerate
+
+make your students aware about the pros and cons of open source software
+ development
+\layout Enumerate
+
+give back to the public as you are probably at least partially publically
+ funded
+\layout Enumerate
+
+give students a chance to publically prove their skills and to possibly
+ see a world wide impact
+\layout Standard
+
+then SDCC is probably among the first choices.
+ Well, probably SDCC might be the only choice.
+\layout Chapter
+\pagebreak_top 
+SDCC Technical Data
+\layout Section
+
+Optimizations
+\begin_inset LatexCommand \index{Optimizations}
+
+\end_inset 
+
+
+\layout Standard
+
+SDCC performs a host of standard optimizations in addition to some MCU specific
+ optimizations.
+\layout Subsection
+
+Sub-expression Elimination
+\begin_inset LatexCommand \index{Subexpression elimination}
+
+\end_inset 
+
+
+\layout Standard
+
+The compiler does local and 
+\emph on 
+g
+\emph default 
+lobal 
+\emph on 
+c
+\emph default 
+ommon 
+\emph on 
+s
+\emph default 
+ubexpression 
+\emph on 
+e
+\emph default 
+limination, e.g.: 
+\layout Verse
 
 
 \family typewriter 
-switch(i) {\SpecialChar ~
-\SpecialChar ~
-\SpecialChar ~
-\SpecialChar ~
-\SpecialChar ~
-\SpecialChar ~
-\SpecialChar ~
-\SpecialChar ~
-\SpecialChar ~
-\SpecialChar ~
-\SpecialChar ~
-\SpecialChar ~
-\SpecialChar ~
-\SpecialChar ~
-\SpecialChar ~
-\SpecialChar ~
-\SpecialChar ~
-\SpecialChar ~
-\SpecialChar ~
-\SpecialChar ~
-\SpecialChar ~
-\SpecialChar ~
-\SpecialChar ~
-\SpecialChar ~
-\SpecialChar ~
-\SpecialChar ~
-switch (i) { 
+i = x + y + 1; 
+\newline 
+j = x + y;
+\layout Standard
+
+will be translated to
+\layout Verse
+
+
+\family typewriter 
+iTemp = x + y; 
+\newline 
+i = iTemp + 1; 
+\newline 
+j = iTemp;
+\layout Standard
+
+Some subexpressions are not as obvious as the above example, e.g.:
+\layout Verse
+
+
+\family typewriter 
+a->b[i].c = 10; 
+\newline 
+a->b[i].d = 11;
+\layout Standard
+
+In this case the address arithmetic a->b[i] will be computed only once;
+ the equivalent code in C would be.
+\layout Verse
+
+
+\family typewriter 
+iTemp = a->b[i]; 
+\newline 
+iTemp.c = 10; 
+\newline 
+iTemp.d = 11;
+\layout Standard
+
+The compiler will try to keep these temporary variables in registers.
+\layout Subsection
+
+Dead-Code Elimination
+\begin_inset LatexCommand \index{Dead-code elimination}
+
+\end_inset 
+
+
+\layout Verse
+
+
+\family typewriter 
+int global;
+\newline 
+
+\newline 
+void f () { 
 \newline 
 \SpecialChar ~
 \SpecialChar ~
-\SpecialChar ~
-case 4: ...\SpecialChar ~
-\SpecialChar ~
-\SpecialChar ~
-\SpecialChar ~
-\SpecialChar ~
-\SpecialChar ~
-\SpecialChar ~
-\SpecialChar ~
+int i; 
+\newline 
 \SpecialChar ~
 \SpecialChar ~
+i = 1; \SpecialChar ~
 \SpecialChar ~
 \SpecialChar ~
 \SpecialChar ~
 \SpecialChar ~
+/* dead store */ 
+\newline 
 \SpecialChar ~
 \SpecialChar ~
+global = 1;\SpecialChar ~
+/* dead store */ 
+\newline 
 \SpecialChar ~
 \SpecialChar ~
+global = 2; 
+\newline 
 \SpecialChar ~
 \SpecialChar ~
+return; 
+\newline 
 \SpecialChar ~
 \SpecialChar ~
+global = 3;\SpecialChar ~
+/* unreachable */ 
+\newline 
+}
+\layout Standard
+
+will be changed to
+\layout Verse
+
+
+\family typewriter 
+int global;
+\newline 
+
+\newline 
+void f () {
+\newline 
 \SpecialChar ~
 \SpecialChar ~
+global = 2; 
+\newline 
+}
+\layout Subsection
+
+Copy-Propagation
+\begin_inset LatexCommand \index{Copy propagation}
+
+\end_inset 
+
+
+\layout Verse
+
+
+\family typewriter 
+int f() { 
+\newline 
 \SpecialChar ~
 \SpecialChar ~
-case 0: ...
+int i, j; 
 \newline 
 \SpecialChar ~
 \SpecialChar ~
-\SpecialChar ~
-case 5: ...\SpecialChar ~
+i = 10; 
+\newline 
 \SpecialChar ~
 \SpecialChar ~
+j = i; 
+\newline 
 \SpecialChar ~
 \SpecialChar ~
+return j; 
+\newline 
+}
+\layout Standard
+
+will be changed to 
+\layout Verse
+
+
+\family typewriter 
+int f() { 
+\newline 
 \SpecialChar ~
 \SpecialChar ~
+int i, j; 
+\newline 
 \SpecialChar ~
 \SpecialChar ~
+i = 10; 
+\newline 
 \SpecialChar ~
 \SpecialChar ~
+j = 10; 
+\newline 
 \SpecialChar ~
 \SpecialChar ~
-\SpecialChar ~
-\SpecialChar ~
-\SpecialChar ~
-\SpecialChar ~
-\SpecialChar ~
-\SpecialChar ~
-\SpecialChar ~
-\SpecialChar ~
-\SpecialChar ~
-\SpecialChar ~
-\SpecialChar ~
-\SpecialChar ~
-\SpecialChar ~
-case 1: ...
+return 10; 
+\newline 
+}
+\layout Standard
+
+Note: the dead stores created by this copy propagation will be eliminated
+ by dead-code elimination.
+\layout Subsection
+
+Loop Optimizations
+\begin_inset LatexCommand \index{Loop optimization}
+
+\end_inset 
+
+
+\begin_inset LatexCommand \label{sub:Loop-Optimizations}
+
+\end_inset 
+
+
+\layout Standard
+
+Two types of loop optimizations are done by SDCC 
+\emph on 
+loop invariant
+\emph default 
+ lifting and
+\emph on 
+ strength reduction
+\emph default 
+ of loop induction variables.
+ In addition to the strength reduction the optimizer marks the induction
+ variables and the register allocator tries to keep the induction variables
+ in registers for the duration of the loop.
+ Because of this preference of the register allocator
+\begin_inset LatexCommand \index{Register allocation}
+
+\end_inset 
+
+, loop induction optimization causes an increase in register pressure, which
+ may cause unwanted spilling of other temporary variables into the stack
+\begin_inset LatexCommand \index{stack}
+
+\end_inset 
+
+ / data space.
+ The compiler will generate a warning message when it is forced to allocate
+ extra space either on the stack or data space.
+ If this extra space allocation is undesirable then induction optimization
+ can be eliminated either for the entire source file (with -
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash 
+/
+\end_inset 
+
+-noinduction option) or for a given function only using #pragma\SpecialChar ~
+noinduction
+\begin_inset LatexCommand \index{\#pragma noinduction}
+
+\end_inset 
+
+.
+\newline 
+
+\newline 
+Loop Invariant:
+\layout Verse
+
+
+\family typewriter 
+for (i = 0 ; i < 100 ; i ++) 
 \newline 
-\SpecialChar ~
-\SpecialChar ~
-\SpecialChar ~
-case 3: ...\SpecialChar ~
-\SpecialChar ~
 \SpecialChar ~
 \SpecialChar ~
 \SpecialChar ~
 \SpecialChar ~
+f += k + l;
+\layout Standard
+
+changed to
+\layout Verse
+
+
+\family typewriter 
+itemp = k + l; 
+\newline 
+for (i = 0; i < 100; i++) 
+\newline 
 \SpecialChar ~
 \SpecialChar ~
 \SpecialChar ~
 \SpecialChar ~
+f += itemp;
+\layout Standard
+
+As mentioned previously some loop invariants are not as apparent, all static
+ address computations are also moved out of the loop.
+\newline 
+
+\newline 
+Strength Reduction
+\begin_inset LatexCommand \index{Strength reduction}
+
+\end_inset 
+
+, this optimization substitutes an expression by a cheaper expression:
+\layout Verse
+
+
+\family typewriter 
+for (i=0;i < 100; i++)
+\newline 
 \SpecialChar ~
 \SpecialChar ~
 \SpecialChar ~
 \SpecialChar ~
+ar[i*5] = i*3;
+\layout Standard
+
+changed to
+\layout Verse
+
+
+\family typewriter 
+itemp1 = 0; 
+\newline 
+itemp2 = 0; 
+\newline 
+for (i=0;i< 100;i++) { 
+\newline 
 \SpecialChar ~
 \SpecialChar ~
 \SpecialChar ~
 \SpecialChar ~
+ar[itemp1] = itemp2; 
+\newline 
 \SpecialChar ~
 \SpecialChar ~
 \SpecialChar ~
 \SpecialChar ~
+itemp1 += 5; 
+\newline 
 \SpecialChar ~
 \SpecialChar ~
 \SpecialChar ~
 \SpecialChar ~
+itemp2 += 3; 
+\newline 
+}
+\layout Standard
+
+The more expensive multiplication
+\begin_inset LatexCommand \index{Multiplication}
+
+\end_inset 
+
+ is changed to a less expensive addition.
+\layout Subsection
+
+Loop Reversing
+\begin_inset LatexCommand \index{Loop reversing}
 
+\end_inset 
+
+
+\layout Standard
+
+This optimization is done to reduce the overhead of checking loop boundaries
+ for every iteration.
+ Some simple loops can be reversed and implemented using a 
+\begin_inset Quotes eld
+\end_inset 
+
+decrement and jump if not zero
+\begin_inset Quotes erd
+\end_inset 
+
+ instruction.
+ SDCC checks for the following criterion to determine if a loop is reversible
+ (note: more sophisticated compilers use data-dependency analysis to make
+ this determination, SDCC uses a more simple minded analysis).
+\layout Itemize
+
+The 'for' loop is of the form 
+\newline 
+
+\newline 
+
+\family typewriter 
+for(<symbol> = <expression>; <sym> [< | <=] <expression>; [<sym>++ | <sym>
+ += 1])
 \newline 
-\SpecialChar ~
-\SpecialChar ~
-\SpecialChar ~
-case 6: ...\SpecialChar ~
 \SpecialChar ~
 \SpecialChar ~
 \SpecialChar ~
 \SpecialChar ~
+<for body>
+\layout Itemize
+
+The <for body> does not contain 
+\begin_inset Quotes eld
+\end_inset 
+
+continue
+\begin_inset Quotes erd
+\end_inset 
+
+ or 'break
+\begin_inset Quotes erd
+\end_inset 
+
+.
+\layout Itemize
+
+All goto's are contained within the loop.
+\layout Itemize
+
+No function calls within the loop.
+\layout Itemize
+
+The loop control variable <sym> is not assigned any value within the loop
+\layout Itemize
+
+The loop control variable does NOT participate in any arithmetic operation
+ within the loop.
+\layout Itemize
+
+There are NO switch statements in the loop.
+\layout Subsection
+
+Algebraic Simplifications
+\layout Standard
+
+SDCC does numerous algebraic simplifications, the following is a small sub-set
+ of these optimizations.
+\layout Verse
+
+
+\family typewriter 
+i = j + 0;\SpecialChar ~
 \SpecialChar ~
 \SpecialChar ~
 \SpecialChar ~
+ /* changed to: */\SpecialChar ~
 \SpecialChar ~
 \SpecialChar ~
 \SpecialChar ~
+ i = j; 
+\newline 
+i /= 2;\SpecialChar ~
 \SpecialChar ~
 \SpecialChar ~
 \SpecialChar ~
 \SpecialChar ~
 \SpecialChar ~
 \SpecialChar ~
+ /* changed to: */\SpecialChar ~
 \SpecialChar ~
 \SpecialChar ~
 \SpecialChar ~
+ i >>= 1; 
+\newline 
+i = j - j;\SpecialChar ~
 \SpecialChar ~
 \SpecialChar ~
 \SpecialChar ~
+ /* changed to: */\SpecialChar ~
 \SpecialChar ~
 \SpecialChar ~
 \SpecialChar ~
-case 3: ...
+ i = 0; 
 \newline 
+i = j / 1;\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+ /* changed to: */\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+ i = j;
+\layout Standard
+
+Note the subexpressions
+\begin_inset LatexCommand \index{Subexpression}
+
+\end_inset 
+
+ given above are generally introduced by macro expansions or as a result
+ of copy/constant propagation.
+\layout Subsection
+
+'switch' Statements
+\begin_inset LatexCommand \label{sub:'switch'-Statements}
+
+\end_inset 
+
+
+\begin_inset LatexCommand \index{switch statement}
+
+\end_inset 
+
+
+\layout Standard
+
+SDCC can optimize switch statements to jump tables
+\begin_inset LatexCommand \index{jump tables}
+
+\end_inset 
+
+.
+ It makes the decision based on an estimate of the generated code size.
+ SDCC is quite liberal in the requirements for jump table generation: 
+\layout Itemize
+
+The labels need not be in order, and the starting number need not be one
+ or zero, the case labels are in numerical sequence or not too many case
+ labels are missing.
+\begin_deeper 
+\layout Verse
+
+
+\family typewriter 
+switch(i) {\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+switch (i) { 
+\newline 
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+case 4: ...\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+case 0: ...
+\newline 
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+case 5: ...\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+case 1: ...
+\newline 
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+case 3: ...\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+
+\newline 
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+case 6: ...\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+case 3: ...
+\newline 
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+case 7: ...\SpecialChar ~
+\SpecialChar ~
 \SpecialChar ~
 \SpecialChar ~
 \SpecialChar ~
-case 7: ...\SpecialChar ~
-\SpecialChar ~
-\SpecialChar ~
-\SpecialChar ~
-\SpecialChar ~
 \SpecialChar ~
 \SpecialChar ~
 \SpecialChar ~
@@ -26781,680 +29407,2430 @@ push %1 } by {
 }
 \layout Standard
 
-Note that the replace pattern cannot be a blank, but can be a comment line.
- Without the 'restart' option only the innermost 'pop' 'push' pair would
- be eliminated, i.e.:
-\layout Verse
+Note that the replace pattern cannot be a blank, but can be a comment line.
+ Without the 'restart' option only the innermost 'pop' 'push' pair would
+ be eliminated, i.e.:
+\layout Verse
+
+
+\family typewriter 
+pop ar1 
+\newline 
+pop ar2 
+\newline 
+push ar2 
+\newline 
+push ar1
+\layout Standard
+
+would result in:
+\layout Verse
+
+
+\family typewriter 
+pop ar1 
+\newline 
+; nop 
+\newline 
+push ar1
+\layout Standard
+
+
+\emph on 
+with
+\emph default 
+ the restart option the rule will be applied again to the resulting code
+ and then all the pop-push pairs will be eliminated to yield:
+\layout Verse
+
+
+\family typewriter 
+; nop 
+\newline 
+; nop
+\layout Standard
+
+A conditional function can be attached to a rule.
+ Attaching rules are somewhat more involved, let me illustrate this with
+ an example.
+\layout Verse
+
+
+\family typewriter 
+replace { 
+\newline 
+\SpecialChar ~
+ \SpecialChar ~
+ \SpecialChar ~
+ljmp %5 
+\newline 
+%2:
+\newline 
+} by { 
+\newline 
+\SpecialChar ~
+ \SpecialChar ~
+ \SpecialChar ~
+sjmp %5 
+\newline 
+%2:
+\newline 
+} if labelInRange
+\layout Standard
+
+The optimizer does a look-up of a function name table defined in function
+\emph on 
+callFuncByName
+\emph default 
+ in the source file SDCCpeeph.c, with the name 
+\emph on 
+labelInRange
+\emph default 
+.
+ If it finds a corresponding entry the function is called.
+ Note there can be no parameters specified for these functions, in this
+ case the use of 
+\emph on 
+%5
+\emph default 
+ is crucial, since the function 
+\emph on 
+labelInRange
+\emph default 
+ expects to find the label in that particular variable (the hash table containin
+g the variable bindings is passed as a parameter).
+ If you want to code more such functions, take a close look at the function
+ labelInRange and the calling mechanism in source file SDCCpeeph.c.
+ Currently implemented are 
+\emph on 
+labelInRange, labelRefCount, labelIsReturnOnly, operandsNotSame, xramMovcOption,
+ 24bitMode, portIsDS390, 24bitModeAndPortDS390 
+\emph default 
+and
+\emph on 
+ notVolatile
+\emph default 
+.
+\layout Standard
+
+I know this whole thing is a little kludgey, but maybe some day we will
+ have some better means.
+ If you are looking at this file, you will see the default rules that are
+ compiled into the compiler, you can add your own rules in the default set
+ there if you get tired of specifying the -
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash 
+/
+\end_inset 
+
+-peep-file option.
+\layout Section
+
+ANSI-Compliance
+\begin_inset LatexCommand \index{ANSI-compliance}
+
+\end_inset 
+
+
+\begin_inset LatexCommand \label{sub:ANSI-Compliance}
+
+\end_inset 
+
+
+\layout Standard
+
+The latest publically available version of the standard 
+\emph on 
+ISO/IEC 9899 - Programming languages - C
+\emph default 
+ should be available at: 
+\begin_inset LatexCommand \url{http://www.open-std.org/jtc1/sc22/wg14/www/standards.html#9899}
+
+\end_inset 
+
+.
+\newline 
+
+\layout Standard
+
+Deviations from the compliance:
+\layout Itemize
+
+functions are not reentrant
+\begin_inset LatexCommand \index{reentrant}
+
+\end_inset 
+
+ unless explicitly declared as such or the 
+\series bold 
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash 
+/
+\end_inset 
+
+-stack-auto
+\begin_inset LatexCommand \index{-\/-stack-auto}
+
+\end_inset 
+
+
+\series default 
+ command line option is specified.
+\layout Itemize
+
+structures
+\begin_inset LatexCommand \index{struct}
+
+\end_inset 
+
+ and unions
+\begin_inset LatexCommand \index{union}
+
+\end_inset 
+
+ cannot be assigned values directly, cannot be passed as function parameters
+ or assigned to each other and cannot be a return value
+\begin_inset LatexCommand \index{return value}
+
+\end_inset 
+
+ from a function, e.g.:
+\begin_deeper 
+\layout Verse
+
+
+\family typewriter 
+struct s { ...
+ }; 
+\newline 
+struct s s1, s2; 
+\newline 
+foo() 
+\newline 
+{ 
+\newline 
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+...
+\newline 
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+s1 = s2 ; /* is invalid in SDCC although allowed in ANSI */ 
+\newline 
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+...
+\newline 
+}
+\newline 
+
+\series bold 
+struct
+\series default 
+ s foo1 (
+\series bold 
+struct
+\series default 
+ s parms) /* invalid in SDCC although allowed in ANSI */
+\newline 
+{ 
+\newline 
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+struct s rets; 
+\newline 
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+...
+\newline 
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+return rets; /* is invalid in SDCC although allowed in ANSI */ 
+\newline 
+}
+\end_deeper 
+\layout Itemize
+
+initialization of structure arrays must be fully braced.
+\begin_deeper 
+\layout Verse
+
+
+\family typewriter 
+struct s { char x } a[] = {1, 2};\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+/* invalid in SDCC */
+\newline 
+struct s { char x } a[] = {{1}, {2}}; /* OK */
+\end_deeper 
+\layout Itemize
+
+'long long
+\begin_inset LatexCommand \index{long long (not supported)}
+
+\end_inset 
+
+' (64 bit integers
+\begin_inset LatexCommand \index{int (64 bit) (not supported)}
+
+\end_inset 
+
+) not supported.
+\layout Itemize
+
+'double
+\begin_inset LatexCommand \index{double (not supported)}
+
+\end_inset 
+
+' precision floating point 
+\begin_inset LatexCommand \index{Floating point support}
+
+\end_inset 
+
+not supported.
+\layout Itemize
+
+Old K&R style
+\begin_inset LatexCommand \index{K\&R style}
+
+\end_inset 
+
+ function declarations are NOT allowed.
+\begin_deeper 
+\layout Verse
+
+
+\family typewriter 
+foo(i,j) /* this old style of function declarations */ 
+\newline 
+int i,j; /* are valid in ANSI but not valid in SDCC */ 
+\newline 
+{ 
+\newline 
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+...
+\newline 
+}
+\end_deeper 
+\layout Itemize
+
+Most enhancements in C99 are not supported, f.e.:
+\begin_deeper 
+\layout Verse
+
+
+\family typewriter 
+\series bold 
+inline
+\begin_inset LatexCommand \index{inline (not supported)}
+
+\end_inset 
+
+
+\series default 
+ int increment (int a) { return a+1; } /* is invalid in SDCC although allowed
+ in C99.
+ An empty define 
+\emph on 
+#define inline
+\emph default 
+ can be used as a work around */
+\newline 
+
+\newline 
+for (
+\series bold 
+int
+\series default 
+ i=0; i<10; i++) /* is invalid in SDCC although allowed in C99 */
+\end_deeper 
+\layout Itemize
+
+Certain words that are valid identifiers in the standard may be reserved
+ words in SDCC unless the 
+\series bold 
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash 
+/
+\end_inset 
+
+-std-c89
+\begin_inset LatexCommand \index{-\/-std-c89}
+
+\end_inset 
+
+ or -
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash 
+/
+\end_inset 
+
+-std-c99
+\begin_inset LatexCommand \index{-\/-std-c99}
+
+\end_inset 
+
+
+\series default 
+ command line options are used.
+ These may include (depending on the selected processor): 'at', 'banked',
+ 'bit', 'code', 'critical', 'data', 'eeprom', 'far', 'flash', 'idata', 'interrup
+t', 'near', 'nonbanked', 'pdata', 'reentrant', 'sbit', 'sfr', 'shadowregs',
+ 'sram', 'using', 'wparam', 'xdata', '_overlay', '_asm', '_endasm', and
+ '_naked'.
+ Compliant equivalents of these keywords are always available in a form
+ that begin with two underscores
+\begin_inset LatexCommand \index{\_\_ (prefix for extended keywords)}
+
+\end_inset 
+
+, f.e.
+ '__data' instead of 'data'.
+\layout Section
+
+Cyclomatic Complexity
+\begin_inset LatexCommand \index{Cyclomatic complexity}
+
+\end_inset 
+
+
+\layout Standard
+
+Cyclomatic complexity of a function is defined as the number of independent
+ paths the program can take during execution of the function.
+ This is an important number since it defines the number test cases you
+ have to generate to validate the function.
+ The accepted industry standard for complexity number is 10, if the cyclomatic
+ complexity reported by SDCC exceeds 10 you should think about simplification
+ of the function logic.
+ Note that the complexity level is not related to the number of lines of
+ code in a function.
+ Large functions can have low complexity, and small functions can have large
+ complexity levels.
+\newline 
+
+\newline 
+SDCC uses the following formula to compute the complexity:
+\newline 
+
+\layout Standard
+
+complexity = (number of edges in control flow graph) - (number of nodes
+ in control flow graph) + 2;
+\newline 
+
+\newline 
+Having said that the industry standard is 10, you should be aware that in
+ some cases it be may unavoidable to have a complexity level of less than
+ 10.
+ For example if you have switch statement with more than 10 case labels,
+ each case label adds one to the complexity level.
+ The complexity level is by no means an absolute measure of the algorithmic
+ complexity of the function, it does however provide a good starting point
+ for which functions you might look at for further optimization.
+\layout Section
+
+Retargetting for other Processors
+\layout Standard
+
+The issues for retargetting the compiler are far too numerous to be covered
+ by this document.
+ What follows is a brief description of each of the seven phases of the
+ compiler and its MCU dependency.
+\layout Itemize
+
+Parsing the source and building the annotated parse tree.
+ This phase is largely MCU independent (except for the language extensions).
+ Syntax & semantic checks are also done in this phase, along with some initial
+ optimizations like back patching labels and the pattern matching optimizations
+ like bit-rotation etc.
+\layout Itemize
+
+The second phase involves generating an intermediate code which can be easy
+ manipulated during the later phases.
+ This phase is entirely MCU independent.
+ The intermediate code generation assumes the target machine has unlimited
+ number of registers, and designates them with the name iTemp.
+ The compiler can be made to dump a human readable form of the code generated
+ by using the -
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash 
+/
+\end_inset 
+
+-dumpraw option.
+\layout Itemize
+
+This phase does the bulk of the standard optimizations and is also MCU independe
+nt.
+ This phase can be broken down into several sub-phases:
+\newline 
+
+\newline 
+Break down intermediate code (iCode) into basic blocks.
+\newline 
+Do control flow & data flow analysis on the basic blocks.
+\newline 
+Do local common subexpression elimination, then global subexpression elimination
+\newline 
+Dead code elimination
+\newline 
+Loop optimizations
+\newline 
+If loop optimizations caused any changes then do 'global subexpression eliminati
+on' and 'dead code elimination' again.
+\layout Itemize
+
+This phase determines the live-ranges; by live range I mean those iTemp
+ variables defined by the compiler that still survive after all the optimization
+s.
+ Live range analysis
+\begin_inset LatexCommand \index{Live range analysis}
+
+\end_inset 
+
+ is essential for register allocation, since these computation determines
+ which of these iTemps will be assigned to registers, and for how long.
+\layout Itemize
+
+Phase five is register allocation.
+ There are two parts to this process.
+\newline 
+
+\newline 
+The first part I call 'register packing' (for lack of a better term).
+ In this case several MCU specific expression folding is done to reduce
+ register pressure.
+\newline 
+
+\newline 
+The second part is more MCU independent and deals with allocating registers
+ to the remaining live ranges.
+ A lot of MCU specific code does creep into this phase because of the limited
+ number of index registers available in the 8051.
+\layout Itemize
+
+The Code generation phase is (unhappily), entirely MCU dependent and very
+ little (if any at all) of this code can be reused for other MCU.
+ However the scheme for allocating a homogenized assembler operand for each
+ iCode operand may be reused.
+\layout Itemize
+
+As mentioned in the optimization section the peep-hole optimizer is rule
+ based system, which can reprogrammed for other MCUs.
+\layout Standard
+
+More information is available in a wiki
+\begin_inset LatexCommand \index{wiki}
+
+\end_inset 
+
+ (preliminary link 
+\begin_inset LatexCommand \url{http://sdcc.sourceforge.net/release_wiki/index.php?page=SDCC+internals+and+porting}
+
+\end_inset 
+
+) and in the thread 
+\begin_inset LatexCommand \url{http://sf.net/mailarchive/message.php?msg_id=13954144}
+
+\end_inset 
+
+ .
+\layout Chapter
+
+Compiler internals
+\begin_inset LatexCommand \index{Compiler internals}
+
+\end_inset 
+
+
+\layout Section
+
+The anatomy of the compiler
+\begin_inset LatexCommand \label{sub:The-anatomy-of}
+
+\end_inset 
+
+
+\layout Standard
+
+
+\shape italic 
+This is an excerpt from an article published in Circuit Cellar Magazine
+ in 
+\series bold 
+August 2000
+\series default 
+.
+ It's a little outdated (the compiler is much more efficient now and user/develo
+per friendly), but pretty well exposes the guts of it all.
+\shape default 
+
+\newline 
+
+\newline 
+The current version of SDCC can generate code for Intel 8051 and Z80 MCU.
+ It is fairly easy to retarget for other 8-bit MCU.
+ Here we take a look at some of the internals of the compiler.
+\layout Paragraph*
+
+Parsing
+\begin_inset LatexCommand \index{Parsing}
+
+\end_inset 
+
+\layout Standard
+
+Parsing the input source file and creating an AST (Annotated Syntax Tree
+\begin_inset LatexCommand \index{Annotated syntax tree}
+
+\end_inset 
+
+).
+ This phase also involves propagating types (annotating each node of the
+ parse tree with type information) and semantic analysis.
+ There are some MCU specific parsing rules.
+ For example the storage classes, the extended storage classes are MCU specific
+ while there may be a xdata storage class for 8051 there is no such storage
+ class for z80 or Atmel AVR.
+ SDCC allows MCU specific storage class extensions, i.e.
+ xdata will be treated as a storage class specifier when parsing 8051 C
+ code but will be treated as a C identifier when parsing z80 or ATMEL AVR
+ C code.
+\layout Paragraph*
+
+Generating iCode
+\begin_inset LatexCommand \index{iCode}
+
+\end_inset 
+
+
+\layout Standard
+
+Intermediate code generation.
+ In this phase the AST is broken down into three-operand form (iCode).
+ These three operand forms are represented as doubly linked lists.
+ ICode is the term given to the intermediate form generated by the compiler.
+ ICode example section shows some examples of iCode generated for some simple
+ C source functions.
+\layout Paragraph*
+
+Optimizations
+\begin_inset LatexCommand \index{Optimizations}
+
+\end_inset 
+
+.
+\layout Standard
+
+Bulk of the target independent optimizations is performed in this phase.
+ The optimizations include constant propagation, common sub-expression eliminati
+on, loop invariant code movement, strength reduction of loop induction variables
+ and dead-code elimination.
+\layout Paragraph*
+
+Live range analysis
+\begin_inset LatexCommand \index{Live range analysis}
+
+\end_inset 
+
+
+\layout Standard
+
+During intermediate code generation phase, the compiler assumes the target
+ machine has infinite number of registers and generates a lot of temporary
+ variables.
+ The live range computation determines the lifetime of each of these compiler-ge
+nerated temporaries.
+ A picture speaks a thousand words.
+ ICode example sections show the live range annotations for each of the
+ operand.
+ It is important to note here, each iCode is assigned a number in the order
+ of its execution in the function.
+ The live ranges are computed in terms of these numbers.
+ The from number is the number of the iCode which first defines the operand
+ and the to number signifies the iCode which uses this operand last.
+\layout Paragraph*
+
+Register Allocation
+\begin_inset LatexCommand \index{Register allocation}
+
+\end_inset 
+
+
+\layout Standard
+
+The register allocation determines the type and number of registers needed
+ by each operand.
+ In most MCUs only a few registers can be used for indirect addressing.
+ In case of 8051 for example the registers R0 & R1 can be used to indirectly
+ address the internal ram and DPTR to indirectly address the external ram.
+ The compiler will try to allocate the appropriate register to pointer variables
+ if it can.
+ ICode example section shows the operands annotated with the registers assigned
+ to them.
+ The compiler will try to keep operands in registers as much as possible;
+ there are several schemes the compiler uses to do achieve this.
+ When the compiler runs out of registers the compiler will check to see
+ if there are any live operands which is not used or defined in the current
+ basic block being processed, if there are any found then it will push that
+ operand and use the registers in this block, the operand will then be popped
+ at the end of the basic block.
+\layout Standard
+
+There are other MCU specific considerations in this phase.
+ Some MCUs have an accumulator; very short-lived operands could be assigned
+ to the accumulator instead of a general-purpose register.
+\layout Paragraph*
+
+Code generation
+\layout Standard
+
+Figure II gives a table of iCode
+\begin_inset LatexCommand \index{iCode}
+
+\end_inset 
+
+ operations supported by the compiler.
+ The code generation involves translating these operations into corresponding
+ assembly code for the processor.
+ This sounds overly simple but that is the essence of code generation.
+ Some of the iCode operations are generated on a MCU specific manner for
+ example, the z80 port does not use registers to pass parameters so the
+ SEND and RECV iCode operations will not be generated, and it also does
+ not support JUMPTABLES.
+\newline 
+
+\layout Standard
+
+
+\size footnotesize 
+Figure II 
+\begin_inset  Tabular
+<lyxtabular version="3" rows="39" columns="4">
+<features islongtable="true" headBottomDL="true">
+<column alignment="block" valignment="top" leftline="true" width="13col%">
+<column alignment="left" valignment="top" leftline="true" width="13col%">
+<column alignment="block" valignment="top" leftline="true" width="22col%">
+<column alignment="block" valignment="top" leftline="true" rightline="true" width="40col%">
+<row topline="true" bottomline="true" endhead="true">
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+
+\series bold 
+iCode
+\series default 
+
+\begin_inset LatexCommand \index{iCode}
+
+\end_inset 
+
+
+\end_inset 
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+
+\series bold 
+Operands
+\end_inset 
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+
+\series bold 
+Description
+\end_inset 
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+
+\series bold 
+C Equivalent
+\end_inset 
+</cell>
+</row>
+<row topline="true">
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+
+\size footnotesize 
+'!'
+\end_inset 
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+
+\size footnotesize 
+IC_LEFT() IC_RESULT()
+\end_inset 
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+
+\size footnotesize 
+NOT operation 
+\end_inset 
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+
+\size footnotesize 
+IC_RESULT = ! IC_LEFT;
+\end_inset 
+</cell>
+</row>
+<row topline="true">
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+
+\size footnotesize 
+'~'
+\end_inset 
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+
+\size footnotesize 
+IC_LEFT() IC_RESULT()
+\end_inset 
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+
+\size footnotesize 
+Bitwise complement of 
+\end_inset 
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+
+\size footnotesize 
+IC_RESULT = ~IC_LEFT;
+\end_inset 
+</cell>
+</row>
+<row topline="true">
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+
+\size footnotesize 
+RRC
+\end_inset 
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+
+\size footnotesize 
+IC_LEFT() IC_RESULT()
+\end_inset 
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+
+\size footnotesize 
+Rotate right with carry
+\end_inset 
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+
+\size footnotesize 
+IC_RESULT = (IC_LEFT << 1) | (IC_LEFT >> (sizeof(IC_LEFT)*8-1));
+\end_inset 
+</cell>
+</row>
+<row topline="true">
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+
+\size footnotesize 
+RLC
+\end_inset 
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+
+\size footnotesize 
+IC_LEFT() IC_RESULT()
+\end_inset 
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+
+\size footnotesize 
+Rotate left with carry
+\end_inset 
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+
+\size footnotesize 
+IC_RESULT = (IC_LEFT << (sizeof(LC_LEFT)*8-1) ) | (IC_LEFT >> 1);
+\end_inset 
+</cell>
+</row>
+<row topline="true">
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+
+\size footnotesize 
+GETHBIT
+\end_inset 
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+
+\size footnotesize 
+IC_LEFT() IC_RESULT()
+\end_inset 
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+
+\size footnotesize 
+Get the highest order bit of IC_LEFT
+\end_inset 
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+
+\size footnotesize 
+IC_RESULT = (IC_LEFT >> (sizeof(IC_LEFT)*8 -1));
+\end_inset 
+</cell>
+</row>
+<row topline="true">
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+
+\size footnotesize 
+UNARYMINUS
+\end_inset 
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+
+\size footnotesize 
+IC_LEFT() IC_RESULT()
+\end_inset 
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+
+\size footnotesize 
+Unary minus
+\end_inset 
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+
+\size footnotesize 
+IC_RESULT = - IC_LEFT;
+\end_inset 
+</cell>
+</row>
+<row topline="true">
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+
+\size footnotesize 
+IPUSH
+\end_inset 
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+
+\size footnotesize 
+IC_LEFT()
+\end_inset 
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+
+\size footnotesize 
+Push the operand into stack
+\end_inset 
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+
+\size footnotesize 
+NONE
+\end_inset 
+</cell>
+</row>
+<row topline="true">
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+
+\size footnotesize 
+IPOP
+\end_inset 
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+
+\size footnotesize 
+IC_LEFT()
+\end_inset 
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+
+\size footnotesize 
+Pop the operand from the stack 
+\end_inset 
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+
+\size footnotesize 
+NONE
+\end_inset 
+</cell>
+</row>
+<row topline="true">
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+
+\size footnotesize 
+CALL
+\end_inset 
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+
+\size footnotesize 
+IC_LEFT() IC_RESULT()
+\end_inset 
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+
+\size footnotesize 
+Call the function represented by IC_LEFT 
+\end_inset 
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+
+\size footnotesize 
+IC_RESULT = IC_LEFT();
+\end_inset 
+</cell>
+</row>
+<row topline="true">
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+
+\size footnotesize 
+PCALL
+\end_inset 
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+
+\size footnotesize 
+IC_LEFT() IC_RESULT()
+\end_inset 
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+
+\size footnotesize 
+Call via function pointer
+\end_inset 
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+
+\size footnotesize 
+IC_RESULT = (*IC_LEFT)();
+\end_inset 
+</cell>
+</row>
+<row topline="true">
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+
+\size footnotesize 
+RETURN
+\end_inset 
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+
+\size footnotesize 
+IC_LEFT()
+\end_inset 
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+
+\size footnotesize 
+Return the value in operand IC_LEFT 
+\end_inset 
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+
+\size footnotesize 
+return IC_LEFT;
+\end_inset 
+</cell>
+</row>
+<row topline="true">
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+
+\size footnotesize 
+LABEL
+\end_inset 
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+
+\size footnotesize 
+IC_LABEL() 
+\end_inset 
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+
+\size footnotesize 
+Label
+\end_inset 
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+
+\size footnotesize 
+IC_LABEL:
+\end_inset 
+</cell>
+</row>
+<row topline="true">
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+
+\size footnotesize 
+GOTO
+\end_inset 
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+
+\size footnotesize 
+IC_LABEL() 
+\end_inset 
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+
+\size footnotesize 
+Goto label
+\end_inset 
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+
+\size footnotesize 
+goto IC_LABEL();
+\end_inset 
+</cell>
+</row>
+<row topline="true">
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+
+\size footnotesize 
+'+'
+\end_inset 
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+
+\size footnotesize 
+IC_LEFT() IC_RIGHT() IC_RESULT()
+\end_inset 
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+
+\size footnotesize 
+Addition
+\end_inset 
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+
+\size footnotesize 
+IC_RESULT = IC_LEFT + IC_RIGHT
+\end_inset 
+</cell>
+</row>
+<row topline="true">
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+
+\size footnotesize 
+'-'
+\end_inset 
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+
+\size footnotesize 
+IC_LEFT() IC_RIGHT() IC_RESULT()
+\end_inset 
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+
+\size footnotesize 
+Subtraction
+\end_inset 
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+
+\size footnotesize 
+IC_RESULT = IC_LEFT - IC_RIGHT 
+\end_inset 
+</cell>
+</row>
+<row topline="true">
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+
+\size footnotesize 
+'*'
+\end_inset 
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+
+\size footnotesize 
+IC_LEFT() IC_RIGHT() IC_RESULT()
+\end_inset 
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+
+\size footnotesize 
+Multiplication 
+\end_inset 
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+
+\size footnotesize 
+IC_RESULT = IC_LEFT * IC_RIGHT;
+\end_inset 
+</cell>
+</row>
+<row topline="true">
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+
+\size footnotesize 
+'/'
+\end_inset 
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+
+\size footnotesize 
+IC_LEFT() IC_RIGHT() IC_RESULT()
+\end_inset 
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+
+\size footnotesize 
+Division
+\end_inset 
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+
+\size footnotesize 
+IC_RESULT = IC_LEFT / IC_RIGHT;
+\end_inset 
+</cell>
+</row>
+<row topline="true">
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+
+\size footnotesize 
+'%'
+\end_inset 
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+
+\size footnotesize 
+IC_LEFT() IC_RIGHT() IC_RESULT()
+\end_inset 
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+
+\size footnotesize 
+Modulus
+\end_inset 
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+
+\size footnotesize 
+IC_RESULT = IC_LEFT % IC_RIGHT;
+\end_inset 
+</cell>
+</row>
+<row topline="true">
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+
+\size footnotesize 
+'<'
+\end_inset 
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+
+\size footnotesize 
+IC_LEFT() IC_RIGHT() IC_RESULT()
+\end_inset 
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+
+\size footnotesize 
+Less than
+\end_inset 
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+
+\size footnotesize 
+IC_RESULT = IC_LEFT < IC_RIGHT;
+\end_inset 
+</cell>
+</row>
+<row topline="true">
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+
+\size footnotesize 
+'>'
+\end_inset 
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+
+\size footnotesize 
+IC_LEFT() IC_RIGHT() IC_RESULT()
+\end_inset 
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+
+\size footnotesize 
+Greater than 
+\end_inset 
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+
+\size footnotesize 
+IC_RESULT = IC_LEFT > IC_RIGHT;
+\end_inset 
+</cell>
+</row>
+<row topline="true">
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+
+\size footnotesize 
+EQ_OP
+\end_inset 
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+
+\size footnotesize 
+IC_LEFT() IC_RIGHT() IC_RESULT()
+\end_inset 
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+
+\size footnotesize 
+Equal to 
+\end_inset 
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+
+\size footnotesize 
+IC_RESULT = IC_LEFT == IC_RIGHT;
+\end_inset 
+</cell>
+</row>
+<row topline="true">
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+
+\size footnotesize 
+AND_OP
+\end_inset 
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+
+\size footnotesize 
+IC_LEFT() IC_RIGHT() IC_RESULT() 
+\end_inset 
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+
+\size footnotesize 
+Logical and operation
+\end_inset 
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+
+\size footnotesize 
+IC_RESULT = IC_LEFT && IC_RIGHT; 
+\end_inset 
+</cell>
+</row>
+<row topline="true">
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+
+\size footnotesize 
+OR_OP
+\end_inset 
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+
+\size footnotesize 
+IC_LEFT() IC_RIGHT() IC_RESULT() 
+\end_inset 
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+
+\size footnotesize 
+Logical or operation 
+\end_inset 
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+
+\size footnotesize 
+IC_RESULT = IC_LEFT || IC_RIGHT; 
+\end_inset 
+</cell>
+</row>
+<row topline="true">
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+
+\size footnotesize 
+'^'
+\end_inset 
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+
+\size footnotesize 
+IC_LEFT() IC_RIGHT() IC_RESULT() 
+\end_inset 
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+
+\size footnotesize 
+Exclusive OR
+\end_inset 
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+
+\size footnotesize 
+IC_RESULT = IC_LEFT ^ IC_RIGHT;
+\end_inset 
+</cell>
+</row>
+<row topline="true">
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+
+\size footnotesize 
+'|'
+\end_inset 
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+
+\size footnotesize 
+IC_LEFT() IC_RIGHT() IC_RESULT() 
+\end_inset 
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+
+\size footnotesize 
+Bitwise OR 
+\end_inset 
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+
+\size footnotesize 
+IC_RESULT = IC_LEFT | IC_RIGHT;
+\end_inset 
+</cell>
+</row>
+<row topline="true">
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+
+\size footnotesize 
+BITWISEAND
+\end_inset 
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+
+\size footnotesize 
+IC_LEFT() IC_RIGHT() IC_RESULT()
+\end_inset 
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+
+\size footnotesize 
+Bitwise AND 
+\end_inset 
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+
+\size footnotesize 
+IC_RESULT = IC_LEFT & IC_RIGHT;
+\end_inset 
+</cell>
+</row>
+<row topline="true">
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+
+\size footnotesize 
+LEFT_OP
+\end_inset 
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+
+\size footnotesize 
+IC_LEFT() IC_RIGHT() IC_RESULT()
+\end_inset 
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+
+\size footnotesize 
+Left shift 
+\end_inset 
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+
+\size footnotesize 
+IC_RESULT = IC_LEFT << IC_RIGHT 
+\end_inset 
+</cell>
+</row>
+<row topline="true">
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+
+\size footnotesize 
+RIGHT_OP
+\end_inset 
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
 
+\size footnotesize 
+IC_LEFT() IC_RIGHT() IC_RESULT()
+\end_inset 
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
 
-\family typewriter 
-pop ar1 
-\newline 
-pop ar2 
-\newline 
-push ar2 
-\newline 
-push ar1
 \layout Standard
 
-would result in:
-\layout Verse
 
+\size footnotesize 
+Right shift
+\end_inset 
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
 
-\family typewriter 
-pop ar1 
-\newline 
-; nop 
-\newline 
-push ar1
 \layout Standard
 
 
-\emph on 
-with
-\emph default 
- the restart option the rule will be applied again to the resulting code
- and then all the pop-push pairs will be eliminated to yield:
-\layout Verse
-
+\size footnotesize 
+IC_RESULT = IC_LEFT >> IC_RIGHT 
+\end_inset 
+</cell>
+</row>
+<row topline="true">
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
 
-\family typewriter 
-; nop 
-\newline 
-; nop
 \layout Standard
 
-A conditional function can be attached to a rule.
- Attaching rules are somewhat more involved, let me illustrate this with
- an example.
-\layout Verse
 
-
-\family typewriter 
-replace { 
-\newline 
-\SpecialChar ~
- \SpecialChar ~
- \SpecialChar ~
-ljmp %5 
-\newline 
-%2:
-\newline 
-} by { 
-\newline 
-\SpecialChar ~
- \SpecialChar ~
- \SpecialChar ~
-sjmp %5 
-\newline 
-%2:
+\size footnotesize 
+GET_VALUE_
 \newline 
-} if labelInRange
-\layout Standard
+AT_ ADDRESS
+\end_inset 
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
 
-The optimizer does a look-up of a function name table defined in function
-\emph on 
-callFuncByName
-\emph default 
- in the source file SDCCpeeph.c, with the name 
-\emph on 
-labelInRange
-\emph default 
-.
- If it finds a corresponding entry the function is called.
- Note there can be no parameters specified for these functions, in this
- case the use of 
-\emph on 
-%5
-\emph default 
- is crucial, since the function 
-\emph on 
-labelInRange
-\emph default 
- expects to find the label in that particular variable (the hash table containin
-g the variable bindings is passed as a parameter).
- If you want to code more such functions, take a close look at the function
- labelInRange and the calling mechanism in source file SDCCpeeph.c.
- Currently implemented are 
-\emph on 
-labelInRange, labelRefCount, labelIsReturnOnly, operandsNotSame, xramMovcOption,
- 24bitMode, portIsDS390, 24bitModeAndPortDS390 
-\emph default 
-and
-\emph on 
- notVolatile
-\emph default 
-.
 \layout Standard
 
-I know this whole thing is a little kludgey, but maybe some day we will
- have some better means.
- If you are looking at this file, you will see the default rules that are
- compiled into the compiler, you can add your own rules in the default set
- there if you get tired of specifying the -
-\begin_inset ERT
-status Collapsed
-
-\layout Standard
 
-\backslash 
-/
+\size footnotesize 
+IC_LEFT() IC_RESULT()
 \end_inset 
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
 
--peep-file option.
-\layout Section
+\layout Standard
 
-ANSI-Compliance
-\begin_inset LatexCommand \index{ANSI-compliance}
 
+\size footnotesize 
+Indirect fetch 
 \end_inset 
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
 
+\layout Standard
 
-\begin_inset LatexCommand \label{sub:ANSI-Compliance}
 
+\size footnotesize 
+IC_RESULT = (*IC_LEFT);
 \end_inset 
-
+</cell>
+</row>
+<row topline="true">
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
 
 \layout Standard
 
-Deviations from the compliance:
-\layout Itemize
-
-functions are not reentrant
-\begin_inset LatexCommand \index{reentrant}
 
+\size footnotesize 
+POINTER_SET
 \end_inset 
-
- unless explicitly declared as such or the 
-\series bold 
--
-\begin_inset ERT
-status Collapsed
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
 
 \layout Standard
 
-\backslash 
-/
+
+\size footnotesize 
+IC_RIGHT() IC_RESULT() 
 \end_inset 
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
 
--stack-auto
-\begin_inset LatexCommand \index{-\/-stack-auto}
+\layout Standard
 
+
+\size footnotesize 
+Indirect set
 \end_inset 
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
 
+\layout Standard
 
-\series default 
- command line option is specified.
-\layout Itemize
 
-structures and unions cannot be assigned values directly, cannot be passed
- as function parameters or assigned to each other and cannot be a return
- value from a function, e.g.:
-\begin_deeper 
-\layout Verse
+\size footnotesize 
+(*IC_RESULT) = IC_RIGHT;
+\end_inset 
+</cell>
+</row>
+<row topline="true">
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
 
+\layout Standard
 
-\family typewriter 
-struct s { ...
- }; 
-\newline 
-struct s s1, s2; 
-\newline 
-foo() 
-\newline 
-{ 
-\newline 
-\SpecialChar ~
-\SpecialChar ~
-\SpecialChar ~
-\SpecialChar ~
-...
-\newline 
-\SpecialChar ~
-\SpecialChar ~
-\SpecialChar ~
-\SpecialChar ~
-s1 = s2 ; /* is invalid in SDCC although allowed in ANSI */ 
-\newline 
-\SpecialChar ~
-\SpecialChar ~
-\SpecialChar ~
-\SpecialChar ~
-...
-\newline 
-}
-\newline 
-struct s foo1 (struct s parms) /* invalid in SDCC although allowed in ANSI
- */
-\newline 
-{ 
-\newline 
-\SpecialChar ~
-\SpecialChar ~
-\SpecialChar ~
-\SpecialChar ~
-struct s rets; 
-\newline 
-\SpecialChar ~
-\SpecialChar ~
-\SpecialChar ~
-\SpecialChar ~
-...
-\newline 
-\SpecialChar ~
-\SpecialChar ~
-\SpecialChar ~
-\SpecialChar ~
-return rets;/* is invalid in SDCC although allowed in ANSI */ 
-\newline 
-}
-\end_deeper 
-\layout Itemize
 
-initialization of structure arrays must be fully braced.
-\begin_deeper 
-\layout Verse
+\size footnotesize 
+'='
+\end_inset 
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
 
 
-\family typewriter 
-struct s { char x } a[] = {1, 2}; /* invalid in SDCC */
-\newline 
-struct s { char x } a[] = {{1}, {2}}; /* OK */
-\end_deeper 
-\layout Itemize
+\size footnotesize 
+IC_RIGHT() IC_RESULT()
+\end_inset 
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
 
-'long long
-\begin_inset LatexCommand \index{long long (not supported)}
 
+\size footnotesize 
+Assignment
 \end_inset 
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
 
-' (64 bit integers
-\begin_inset LatexCommand \index{int (64 bit) (not supported)}
 
+\size footnotesize 
+IC_RESULT = IC_RIGHT;
 \end_inset 
+</cell>
+</row>
+<row topline="true">
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
 
-) not supported.
-\layout Itemize
+\layout Standard
 
-'double
-\begin_inset LatexCommand \index{double (not supported)}
 
+\size footnotesize 
+IFX
 \end_inset 
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
 
-' precision floating point 
-\begin_inset LatexCommand \index{Floating point support}
+\layout Standard
 
+
+\size footnotesize 
+IC_COND IC_TRUE IC_LABEL
 \end_inset 
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
 
-not supported.
-\layout Itemize
+\layout Standard
 
-Old K&R style
-\begin_inset LatexCommand \index{K\&R style}
 
+\size footnotesize 
+Conditional jump.
+ If true label is present then jump to true label if condition is true else
+ jump to false label if condition is false 
 \end_inset 
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
 
- function declarations are NOT allowed.
-\begin_deeper 
-\layout Verse
+\layout Standard
 
 
-\family typewriter 
-foo(i,j) /* this old style of function declarations */ 
-\newline 
-int i,j; /* are valid in ANSI but not valid in SDCC */ 
-\newline 
-{ 
+\size footnotesize 
+if (IC_COND) goto IC_TRUE; 
 \newline 
 \SpecialChar ~
 \SpecialChar ~
-\SpecialChar ~
-\SpecialChar ~
-...
+Or 
 \newline 
-}
-\end_deeper 
-\layout Itemize
-
-Most enhancements in C99 are not supported, f.e.:
-\begin_deeper 
-\layout Verse
+If (!IC_COND) goto IC_FALSE;
+\end_inset 
+</cell>
+</row>
+<row topline="true">
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
 
+\layout Standard
 
-\family typewriter 
-\series bold 
-inline
-\series default 
- int increment (int a) { return a+1; } /* is invalid in SDCC although allowed
- in C99 */
-\newline 
-for (
-\series bold 
-int
-\series default 
- i=0; i<10; i++) /* is invalid in SDCC although allowed in C99 */
-\end_deeper 
-\layout Itemize
 
-Certain words that are valid identifiers in the standard may be reserved
- words in SDCC unless the 
-\series bold 
--
-\begin_inset ERT
-status Collapsed
+\size footnotesize 
+ADDRESS_OF
+\end_inset 
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
 
 \layout Standard
 
-\backslash 
-/
-\end_inset 
-
--std-c89
-\begin_inset LatexCommand \index{-\/-std-c89}
 
+\size footnotesize 
+IC_LEFT() IC_RESULT()
 \end_inset 
-
- or -
-\begin_inset ERT
-status Collapsed
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
 
 \layout Standard
 
-\backslash 
-/
-\end_inset 
-
--std-c99
-\begin_inset LatexCommand \index{-\/-std-c99}
 
+\size footnotesize 
+Address of 
 \end_inset 
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
 
+\layout Standard
 
-\series default 
- command line options are used.
- These may include (depending on the selected processor): 'at', 'banked',
- 'bit', 'code', 'critical', 'data', 'eeprom', 'far', 'flash', 'idata', 'interrup
-t', 'near', 'nonbanked', 'pdata', 'reentrant', 'sbit', 'sfr', 'shadowregs',
- 'sram', 'using', 'wparam', 'xdata', '_overlay', '_asm', '_endasm', and
- '_naked'.
- Compliant equivalents of these keywords are always available in a form
- that begin with two underscores
-\begin_inset LatexCommand \index{\_\_ (prefix for extended keywords)}
 
+\size footnotesize 
+IC_RESULT = &IC_LEFT();
 \end_inset 
+</cell>
+</row>
+<row topline="true">
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
 
-, f.e.
- '__data' instead of 'data'.
-\layout Section
+\layout Standard
 
-Cyclomatic Complexity
-\begin_inset LatexCommand \index{Cyclomatic complexity}
 
+\size footnotesize 
+JUMPTABLE
 \end_inset 
-
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
 
 \layout Standard
 
-Cyclomatic complexity of a function is defined as the number of independent
- paths the program can take during execution of the function.
- This is an important number since it defines the number test cases you
- have to generate to validate the function.
- The accepted industry standard for complexity number is 10, if the cyclomatic
- complexity reported by SDCC exceeds 10 you should think about simplification
- of the function logic.
- Note that the complexity level is not related to the number of lines of
- code in a function.
- Large functions can have low complexity, and small functions can have large
- complexity levels.
-\newline 
 
-\newline 
-SDCC uses the following formula to compute the complexity:
-\newline 
+\size footnotesize 
+IC_JTCOND IC_JTLABELS
+\end_inset 
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
 
 \layout Standard
 
-complexity = (number of edges in control flow graph) - (number of nodes
- in control flow graph) + 2;
-\newline 
 
-\newline 
-Having said that the industry standard is 10, you should be aware that in
- some cases it be may unavoidable to have a complexity level of less than
- 10.
- For example if you have switch statement with more than 10 case labels,
- each case label adds one to the complexity level.
- The complexity level is by no means an absolute measure of the algorithmic
- complexity of the function, it does however provide a good starting point
- for which functions you might look at for further optimization.
-\layout Section
+\size footnotesize 
+Jump to list of labels depending on the value of JTCOND
+\end_inset 
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
 
-Retargetting for other Processors
 \layout Standard
 
-The issues for retargetting the compiler are far too numerous to be covered
- by this document.
- What follows is a brief description of each of the seven phases of the
- compiler and its MCU dependency.
-\layout Itemize
-
-Parsing the source and building the annotated parse tree.
- This phase is largely MCU independent (except for the language extensions).
- Syntax & semantic checks are also done in this phase, along with some initial
- optimizations like back patching labels and the pattern matching optimizations
- like bit-rotation etc.
-\layout Itemize
 
-The second phase involves generating an intermediate code which can be easy
- manipulated during the later phases.
- This phase is entirely MCU independent.
- The intermediate code generation assumes the target machine has unlimited
- number of registers, and designates them with the name iTemp.
- The compiler can be made to dump a human readable form of the code generated
- by using the -
-\begin_inset ERT
-status Collapsed
+\size footnotesize 
+Switch statement
+\end_inset 
+</cell>
+</row>
+<row topline="true">
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
 
 \layout Standard
 
-\backslash 
-/
-\end_inset 
-
--dumpraw option.
-\layout Itemize
 
-This phase does the bulk of the standard optimizations and is also MCU independe
-nt.
- This phase can be broken down into several sub-phases:
-\newline 
+\size footnotesize 
+CAST
+\end_inset 
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
 
-\newline 
-Break down intermediate code (iCode) into basic blocks.
-\newline 
-Do control flow & data flow analysis on the basic blocks.
-\newline 
-Do local common subexpression elimination, then global subexpression elimination
-\newline 
-Dead code elimination
-\newline 
-Loop optimizations
-\newline 
-If loop optimizations caused any changes then do 'global subexpression eliminati
-on' and 'dead code elimination' again.
-\layout Itemize
+\layout Standard
 
-This phase determines the live-ranges; by live range I mean those iTemp
- variables defined by the compiler that still survive after all the optimization
-s.
- Live range analysis
-\begin_inset LatexCommand \index{Live range analysis}
 
+\size footnotesize 
+IC_RIGHT() IC_LEFT() IC_RESULT()
 \end_inset 
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
 
- is essential for register allocation, since these computation determines
- which of these iTemps will be assigned to registers, and for how long.
-\layout Itemize
+\layout Standard
 
-Phase five is register allocation.
- There are two parts to this process.
-\newline 
 
-\newline 
-The first part I call 'register packing' (for lack of a better term).
- In this case several MCU specific expression folding is done to reduce
- register pressure.
-\newline 
+\size footnotesize 
+Cast types 
+\end_inset 
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
 
-\newline 
-The second part is more MCU independent and deals with allocating registers
- to the remaining live ranges.
- A lot of MCU specific code does creep into this phase because of the limited
- number of index registers available in the 8051.
-\layout Itemize
+\layout Standard
 
-The Code generation phase is (unhappily), entirely MCU dependent and very
- little (if any at all) of this code can be reused for other MCU.
- However the scheme for allocating a homogenized assembler operand for each
- iCode operand may be reused.
-\layout Itemize
 
-As mentioned in the optimization section the peep-hole optimizer is rule
- based system, which can reprogrammed for other MCUs.
-\layout Chapter
+\size footnotesize 
+IC_RESULT = (typeof IC_LEFT) IC_RIGHT;
+\end_inset 
+</cell>
+</row>
+<row topline="true">
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
 
-Compiler internals
-\begin_inset LatexCommand \index{Compiler internals}
+\layout Standard
 
-\end_inset 
 
+\size footnotesize 
+SEND
+\end_inset 
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
 
-\layout Section
+\layout Standard
 
-The anatomy of the compiler
-\begin_inset LatexCommand \label{sub:The-anatomy-of}
 
+\size footnotesize 
+IC_LEFT()
 \end_inset 
-
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
 
 \layout Standard
 
 
-\shape italic 
-This is an excerpt from an article published in Circuit Cellar Magazine
- in 
-\series bold 
-August 2000
-\series default 
-.
- It's a little outdated (the compiler is much more efficient now and user/develo
-per friendly), but pretty well exposes the guts of it all.
-\shape default 
-
+\size footnotesize 
+This is used for passing parameters in registers; 
 \newline 
+move IC_LEFT to the next available parameter register.
+\end_inset 
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
 
-\newline 
-The current version of SDCC can generate code for Intel 8051 and Z80 MCU.
- It is fairly easy to retarget for other 8-bit MCU.
- Here we take a look at some of the internals of the compiler.
-\layout Paragraph*
+\layout Standard
 
-Parsing
-\begin_inset LatexCommand \index{Parsing}
 
+\size footnotesize 
+None
 \end_inset 
+</cell>
+</row>
+<row topline="true">
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
 
 \layout Standard
 
-Parsing the input source file and creating an AST (Annotated Syntax Tree
-\begin_inset LatexCommand \index{Annotated syntax tree}
 
+\size footnotesize 
+RECV
 \end_inset 
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
 
-).
- This phase also involves propagating types (annotating each node of the
- parse tree with type information) and semantic analysis.
- There are some MCU specific parsing rules.
- For example the storage classes, the extended storage classes are MCU specific
- while there may be a xdata storage class for 8051 there is no such storage
- class for z80 or Atmel AVR.
- SDCC allows MCU specific storage class extensions, i.e.
- xdata will be treated as a storage class specifier when parsing 8051 C
- code but will be treated as a C identifier when parsing z80 or ATMEL AVR
- C code.
-\layout Paragraph*
+\layout Standard
 
-Generating iCode
-\begin_inset LatexCommand \index{iCode}
 
+\size footnotesize 
+IC_RESULT()
 \end_inset 
-
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
 
 \layout Standard
 
-Intermediate code generation.
- In this phase the AST is broken down into three-operand form (iCode).
- These three operand forms are represented as doubly linked lists.
- ICode is the term given to the intermediate form generated by the compiler.
- ICode example section shows some examples of iCode generated for some simple
- C source functions.
-\layout Paragraph*
-
-Optimizations
-\begin_inset LatexCommand \index{Optimizations}
 
+\size footnotesize 
+This is used for receiving parameters passed in registers;
+\newline 
+Move the values in the next parameter register to IC_RESULT 
 \end_inset 
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
 
-.
 \layout Standard
 
-Bulk of the target independent optimizations is performed in this phase.
- The optimizations include constant propagation, common sub-expression eliminati
-on, loop invariant code movement, strength reduction of loop induction variables
- and dead-code elimination.
-\layout Paragraph*
-
-Live range analysis
-\begin_inset LatexCommand \index{Live range analysis}
 
+\size footnotesize 
+None
 \end_inset 
-
+</cell>
+</row>
+<row topline="true" bottomline="true">
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
 
 \layout Standard
 
-During intermediate code generation phase, the compiler assumes the target
- machine has infinite number of registers and generates a lot of temporary
- variables.
- The live range computation determines the lifetime of each of these compiler-ge
-nerated temporaries.
- A picture speaks a thousand words.
- ICode example sections show the live range annotations for each of the
- operand.
- It is important to note here, each iCode is assigned a number in the order
- of its execution in the function.
- The live ranges are computed in terms of these numbers.
- The from number is the number of the iCode which first defines the operand
- and the to number signifies the iCode which uses this operand last.
-\layout Paragraph*
-
-Register Allocation
-\begin_inset LatexCommand \index{Register allocation}
 
+\shape slanted 
+\size footnotesize 
+(some more have been added)
 \end_inset 
-
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
 
 \layout Standard
 
-The register allocation determines the type and number of registers needed
- by each operand.
- In most MCUs only a few registers can be used for indirect addressing.
- In case of 8051 for example the registers R0 & R1 can be used to indirectly
- address the internal ram and DPTR to indirectly address the external ram.
- The compiler will try to allocate the appropriate register to pointer variables
- if it can.
- ICode example section shows the operands annotated with the registers assigned
- to them.
- The compiler will try to keep operands in registers as much as possible;
- there are several schemes the compiler uses to do achieve this.
- When the compiler runs out of registers the compiler will check to see
- if there are any live operands which is not used or defined in the current
- basic block being processed, if there are any found then it will push that
- operand and use the registers in this block, the operand will then be popped
- at the end of the basic block.
+\end_inset 
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
 \layout Standard
 
-There are other MCU specific considerations in this phase.
- Some MCUs have an accumulator; very short-lived operands could be assigned
- to the accumulator instead of a general-purpose register.
-\layout Paragraph*
+\end_inset 
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
 
-Code generation
 \layout Standard
 
-Figure II gives a table of iCode operations supported by the compiler.
- The code generation involves translating these operations into corresponding
- assembly code for the processor.
- This sounds overly simple but that is the essence of code generation.
- Some of the iCode operations are generated on a MCU specific manner for
- example, the z80 port does not use registers to pass parameters so the
- SEND and RECV iCode operations will not be generated, and it also does
- not support JUMPTABLES.
+
+\shape slanted 
+\size footnotesize 
+see f.e.
  
-\newline 
+\family typewriter 
+gen51Code()
+\family default 
+ in 
+\family typewriter 
+src/mcs51/gen.c
+\end_inset 
+</cell>
+</row>
+</lyxtabular>
+
+\end_inset 
+
 
-\series bold 
-\shape italic 
-\color red
-<Where is Figure II?>
 \layout Comment
 
 In the original article Figure II was announced to be downloadable on 
@@ -27462,8 +31838,7 @@ In the original article Figure II was announced to be downloadable on
 Circuit Cellar
 \shape default 
 's web site.
- Unfortunately it never seemed to have shown up there, so: where is Figure
- II?
+ ftp://ftp.circuitcellar.com/pub/Circuit_Cellar/2000/121/dutta.ZIP
 \layout Paragraph*
 
 ICode Example
@@ -28730,6 +33105,38 @@ Thanks to all the other volunteer developers who have helped with coding,
 
 \newline 
 
+\newline 
+
+\emph on 
+Also 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
+
+\layout Standard
+$10^{13}$
+\end_inset 
+
+CPU cycles per day.
+\newline 
+\begin_inset Note
+collapsed false
+
+\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_inset 
+
+
 \layout Standard
 
 This document was initially written by Sandeep Dutta