* doc/sdccman.lyx: updated documentation for sdcdb updated and added chapter tips
[fw/sdcc] / doc / sdccman.lyx
index dea758df57606401215c4d91adb87601acc0aa66..e453ebccc25a27f1371365fd317078ca2db51d57 100644 (file)
@@ -1,13 +1,13 @@
 #LyX 1.3 created this file. For more info see http://www.lyx.org/
 \lyxformat 221
-\textclass article
+\textclass book
 \begin_preamble
 \usepackage[
   pdftitle={SDCC Compiler User Guide},
   pdfauthor={SDCC development team},
   pdfsubject={installation, user manual},
   pdfkeywords={8032, 8051, ansi, c, compiler, CPU, DS390, 
-               embedded, GPL, manual, mcs51, PIC, small, Z80},
+               embedded, GPL, HC08, manual, mcs51, PIC, Z80},
   colorlinks=true,
   linkcolor=blue] {hyperref}
 \date{}
@@ -26,9 +26,9 @@
 \use_numerical_citations 0
 \paperorientation portrait
 \leftmargin 30mm
-\topmargin 10mm
+\topmargin 20mm
 \rightmargin 25mm
-\bottommargin 15mm
+\bottommargin 20mm
 \secnumdepth 3
 \tocdepth 3
 \paragraph_separation indent
@@ -72,19 +72,20 @@ a 8051 centered document)
 \layout Title
 
 SDCC Compiler User Guide
-\layout Comment
+\layout Date
 
-The strings enclosed in $ are automatically updated by cvs:
-\layout Standard
-\align center 
 
+\size normal 
+2.3.6
 \size footnotesize 
-$Date$
-\layout Standard
-\align center 
 
-\size footnotesize 
+\newline 
+$Date$ 
+\newline 
 $Revision$
+\layout Comment
+
+The above strings enclosed in $ are automatically updated by cvs
 \layout Standard
 
 
@@ -93,10 +94,10 @@ $Revision$
 \end_inset 
 
 
-\layout Section
-\pagebreak_top 
+\layout Chapter
+
 Introduction
-\layout Subsection
+\layout Section
 
 About SDCC
 \layout Standard
@@ -112,11 +113,11 @@ Sandeep Dutta
  designed for 8 bit Microprocessors.
  The current version targets Intel MCS51 based Microprocessors (8031, 8032,
  8051, 8052
-\begin_inset LatexCommand \index{8031, 8032, 8051, 8052 CPU}
+\begin_inset LatexCommand \index{8031, 8032, 8051, 8052, mcs51 CPU}
 
 \end_inset 
 
-, etc), Zilog Z80 based MCUs, and the Dallas DS80C390 variant.
+, etc.), Dallas DS80C390 variants, Motorola HC08 and Zilog Z80 based MCUs.
  It can be retargetted for other microprocessors, support for Microchip
  PIC, Atmel AVR is under development.
  The entire source code for the compiler is distributed under GPL.
@@ -244,7 +245,7 @@ Obviously this has pros and cons
 \end_inset 
 
 .
-\layout Subsection
+\layout Section
 
 Open Source
 \layout Standard
@@ -284,7 +285,7 @@ This program is free software; you can redistribute it and/or modify it
  You are forbidden to forbid anyone else to use, share and improve what
  you give them.
  Help stamp out software-hoarding! 
-\layout Subsection
+\layout Section
 
 Typographic conventions
 \begin_inset LatexCommand \index{Typographic conventions}
@@ -311,7 +312,7 @@ typewriter font.
  Interesting items and new terms are printed in 
 \emph on 
 italic.
-\layout Subsection
+\layout Section
 
 Compatibility with previous versions
 \layout Standard
@@ -405,7 +406,7 @@ status Collapsed
 
 \emph on 
 <pending: more incompatibilities?>
-\layout Subsection
+\layout Section
 
 System Requirements
 \layout Standard
@@ -417,7 +418,7 @@ What do you need before you start installation of SDCC? A computer, and
  For Windows some pre-compiled binary distributions are available for your
  convenience.
  You should have some experience with command line tools and compiler use.
-\layout Subsection
+\layout Section
 
 Other Resources
 \layout Standard
@@ -437,7 +438,7 @@ The SDCC home page at
  their own documentation and can be found in the source distribution.
  If you want the latest unreleased software, the complete source package
  is available directly by anonymous CVS on cvs.sdcc.sourceforge.net.
-\layout Subsection
+\layout Section
 
 Wishes for the future
 \layout Standard
@@ -486,8 +487,8 @@ If you can think of some more, please see the chapter
 .
 \newline 
 
-\layout Section
-\pagebreak_top 
+\layout Chapter
+
 Installing SDCC
 \begin_inset LatexCommand \index{Installation}
 
@@ -508,7 +509,7 @@ For most users it is sufficient to skip to either section
 
 .
  More detailled instructions follow below.
-\layout Subsection
+\layout Section
 
 Configure Options
 \begin_inset LatexCommand \index{Options SDCC configuration}
@@ -640,7 +641,7 @@ status Collapsed
 /
 \end_inset 
 
--z80-port Excludes the z80 port
+-disable-z80-port Excludes the z80 port
 \layout List
 \labelwidthstring 00.00.0000
 
@@ -682,6 +683,20 @@ status Collapsed
 /
 \end_inset 
 
+-disable-hc08-port Excludes the HC08 port
+\layout List
+\labelwidthstring 00.00.0000
+
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash 
+/
+\end_inset 
+
 -disable-pic-port Excludes the PIC port
 \layout List
 \labelwidthstring 00.00.0000
@@ -776,7 +791,7 @@ The names of the standard libraries STD_LIB, STD_INT_LIB, STD_LONG_LIB,
  STD_FP_LIB, STD_DS390_LIB, STD_XA51_LIB and the environment variables SDCC_DIR_
 NAME, SDCC_INCLUDE_NAME, SDCC_LIB_NAME are defined by `configure` too.
  At the moment it's not possible to change the default settings (it was
- simply never required.
+ simply never required).
 \newline 
 
 \newline 
@@ -1663,7 +1678,7 @@ status Collapsed
 -C' turns on caching, which gives a little bit extra speed.
  However if options are changed, it can be necessary to delete the config.cache
  file.
-\layout Subsection
+\layout Section
 
 Install paths
 \begin_inset LatexCommand \label{sub:Install-paths}
@@ -1914,7 +1929,7 @@ make install prefix=$(HOME)/local/sdcc
 \layout Standard
 
 Of course this doesn't change the search paths compiled into the binaries.
-\layout Subsection
+\layout Section
 
 Search Paths
 \begin_inset LatexCommand \label{sub:Search-Paths}
@@ -2772,7 +2787,7 @@ status Collapsed
 \end_inset 
 
 -nostdlib disables the last two search paths.
-\layout Subsection
+\layout Section
 
 Building SDCC
 \begin_inset LatexCommand \index{Building SDCC}
@@ -2780,7 +2795,7 @@ Building SDCC
 \end_inset 
 
 
-\layout Subsubsection
+\layout Subsection
 
 Building SDCC on Linux
 \begin_inset LatexCommand \label{sub:Building-SDCC-on-Linux}
@@ -2881,7 +2896,7 @@ Type
 \series default 
  This copies the binary executables, the include files, the libraries and
  the documentation to the install directories.
-\layout Subsubsection
+\layout Subsection
 
 Building SDCC on OSX 2.x
 \layout Standard
@@ -2897,14 +2912,14 @@ On OSX 2.x it was reported, that the default gcc (version 3.1 20020420 (prerelea
 \layout LyX-Code
 
 ./configure CC=gcc2 CXX=g++2
-\layout Subsubsection
+\layout Subsection
 
 Cross compiling SDCC on Linux for Windows
 \layout Standard
 
 With the Mingw32 gcc cross compiler it's easy to compile SDCC for Win32.
  See section 'Configure Options'.
-\layout Subsubsection
+\layout Subsection
 
 Building SDCC on Windows 
 \layout Standard
@@ -2912,7 +2927,7 @@ Building SDCC on Windows
 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 Subsubsection
+\layout Subsection
 
 Building SDCC using Cygwin and Mingw32
 \layout Standard
@@ -3081,7 +3096,7 @@ SDCC sources use the unix line ending LF.
  And use an editor which can handle LF-only line endings.
  Make sure not to commit files with windows line endings.
  The tabulator spacing used in the project is 8.
-\layout Subsubsection
+\layout Subsection
 
 Building SDCC Using Microsoft Visual C++ 6.0/NET (MSVC)
 \layout Standard
@@ -3260,7 +3275,7 @@ That is it.
 bin_vc to sdcc
 \backslash 
 bin, and you can compile using SDCC.
-\layout Subsubsection
+\layout Subsection
 
 Building SDCC Using Borland
 \layout Enumerate
@@ -3306,7 +3321,7 @@ del /s *.obj *.lib *.rul
 \family default 
 \series default 
  from the sdcc directory.
-\layout Subsubsection
+\layout Subsection
 
 Windows Install Using a Binary Package
 \begin_inset LatexCommand \label{sub:Windows-Install}
@@ -3341,13 +3356,13 @@ lib for the include and libraries.
 
 Adjust your environment variable PATH to include the location of the bin
  directory or start sdcc using the full path.
-\layout Subsection
+\layout Section
 
 Building the Documentation
 \layout Standard
 
-If the necessary tools are installed it is as easy as changing into the
- doc directory and typing 
+If the necessary tools (LyX, LaTeX, latex2html) are installed it is as easy
as changing into the doc directory and typing 
 \family sans 
 \series bold 
 
@@ -3364,7 +3379,7 @@ make
  there.
  If you want to avoid installing the tools you will have some success with
  a bootable Knoppix CD 
-\begin_inset LatexCommand \url{http://www.knopper.net}
+\begin_inset LatexCommand \url{http://www.knoppix.net}
 
 \end_inset 
 
@@ -3375,7 +3390,7 @@ make
 \end_inset 
 
 .
-\layout Subsection
+\layout Section
 
 Reading the Documentation
 \layout Standard
@@ -3390,9 +3405,14 @@ This documentation is in some aspects different from a commercial documentation:
 
 It tries to document SDCC for several processor architectures in one document
  (commercially these probably would be separate documents/products).
- This document currently matches SDCC for mcs51 and DS390 best and does
- give too few information about f.e.
- Z80 and PIC.
+ This document
+\begin_inset LatexCommand \index{Status of documentation}
+
+\end_inset 
+
+ currently matches SDCC for mcs51 and DS390 best and does give too few informati
+on about f.e.
+ Z80, PIC and HC08.
 \layout Itemize
 
 There are many references pointing away from this documentation.
@@ -3407,9 +3427,24 @@ There are many references pointing away from this documentation.
 \begin_inset Quotes sld
 \end_inset 
 
-some processors which are targetted by SDCC can be implemented in a field
- programmable array
-\begin_inset LatexCommand \index{fpga (field programmable array)}
+some processors which are targetted by SDCC can be implemented in a 
+\emph on 
+f
+\emph default 
+ield 
+\emph on 
+p
+\emph default 
+rogrammable 
+\emph on 
+g
+\emph default 
+ate 
+\emph on 
+a
+\emph default 
+rray
+\begin_inset LatexCommand \index{fpga (field programmable gate array)}
 
 \end_inset 
 
@@ -3430,7 +3465,7 @@ The installation section and the section about the debugger is intimidating.
 
 There are still lots of typos and there are more different writing styles
  than pictures.
-\layout Subsection
+\layout Section
 
 Testing the SDCC Compiler
 \layout Standard
@@ -3677,7 +3712,7 @@ status Collapsed
 \end_inset 
 
  to find exactly where SDCC is looking for the include and lib files.
-\layout Subsection
+\layout Section
 
 Install Trouble-shooting
 \begin_inset LatexCommand \label{sub:Install-Trouble-shooting}
@@ -3690,7 +3725,7 @@ Install Trouble-shooting
 \end_inset 
 
 
-\layout Subsubsection
+\layout Subsection
 
 SDCC does not build correctly.
 \layout Standard
@@ -3728,7 +3763,7 @@ make 2>&1 | tee make.log
 If anything goes wrong, you can review the log files to locate the problem.
  Or a relevant part of this can be attached to an email that could be helpful
  when requesting help from the mailing list.
-\layout Subsubsection
+\layout Subsection
 
 What the 
 \begin_inset Quotes sld
@@ -3753,7 +3788,7 @@ The
  to ensure the source package compiles on your system.
  It will take a few minutes to run, and will compile a few tests to determine
  what compiler features are installed.
-\layout Subsubsection
+\layout Subsection
 
 What the 
 \begin_inset Quotes sld
@@ -3768,7 +3803,7 @@ make
 
 This runs the GNU make tool, which automatically compiles all the source
  packages into the final installed binary executables.
-\layout Subsubsection
+\layout Subsection
 
 What the 
 \begin_inset Quotes sld
@@ -3798,7 +3833,7 @@ This will install the compiler, other executables libraries and include
 about install and search paths.
 \newline 
 On most systems you will need super-user privileges to do this.
-\layout Subsection
+\layout Section
 
 Components of SDCC
 \layout Standard
@@ -3877,14 +3912,14 @@ the documentation
 
 As development for other processors proceeds, this list will expand to include
  executables to support processors like AVR, PIC, etc.
-\layout Subsubsection
+\layout Subsection
 
 sdcc - The Compiler
 \layout Standard
 
 This is the actual compiler, it in turn uses the c-preprocessor and invokes
  the assembler and linkage editor.
-\layout Subsubsection
+\layout Subsection
 
 sdcpp
 \begin_inset LatexCommand \index{sdcpp}
@@ -3897,7 +3932,7 @@ sdcpp
 The preprocessor is a modified version of the GNU preprocessor.
  The C preprocessor is used to pull in #include sources, process #ifdef
  statements, #defines and so on.
-\layout Subsubsection
+\layout Subsection
 
 asx8051, as-z80, as-gbz80, aslink, link-z80, link-gbz80 - The Assemblers
  and Linkage Editors
@@ -3907,7 +3942,7 @@ This is retargettable assembler & linkage editor, it was developed by Alan
  Baldwin.
  John Hartman created the version for 8051, and I (Sandeep) have made some
  enhancements and bug fixes for it to work properly with SDCC.
-\layout Subsubsection
+\layout Subsection
 
 s51 - The Simulator
 \begin_inset LatexCommand \index{s51}
@@ -3932,7 +3967,7 @@ S51 is a freeware, opensource simulator developed by Daniel Drotos (
 .
  It currently supports the core mcs51, the Dallas DS80C390 and the Phillips
  XA51 family.
-\layout Subsubsection
+\layout Subsection
 
 sdcdb
 \begin_inset LatexCommand \index{sdcdb}
@@ -3949,13 +3984,13 @@ Sdcdb is the companion source level debugger.
 \end_inset 
 
 , but can be easily changed to use other simulators.
-\layout Section
-\pagebreak_top 
+\layout Chapter
+
 Using SDCC
-\layout Subsection
+\layout Section
 
 Compiling
-\layout Subsubsection
+\layout Subsection
 
 Single Source File Projects
 \layout Standard
@@ -3973,7 +4008,7 @@ For single source file 8051 projects the process is very simple.
 \layout Itemize
 
 sourcefile.asm
-\begin_inset LatexCommand \index{.asm}
+\begin_inset LatexCommand \index{<file>.asm}
 
 \end_inset 
 
@@ -3986,7 +4021,7 @@ sourcefile.asm
 \layout Itemize
 
 sourcefile.lst
-\begin_inset LatexCommand \index{.lst}
+\begin_inset LatexCommand \index{<file>.lst}
 
 \end_inset 
 
@@ -3999,7 +4034,7 @@ sourcefile.lst
 \layout Itemize
 
 sourcefile.rst
-\begin_inset LatexCommand \index{.rst}
+\begin_inset LatexCommand \index{<file>.rst}
 
 \end_inset 
 
@@ -4012,7 +4047,7 @@ sourcefile.rst
 \layout Itemize
 
 sourcefile.sym
-\begin_inset LatexCommand \index{.sym}
+\begin_inset LatexCommand \index{<file>.sym}
 
 \end_inset 
 
@@ -4025,7 +4060,7 @@ sourcefile.sym
 \layout Itemize
 
 sourcefile.rel
-\begin_inset LatexCommand \index{.rel}
+\begin_inset LatexCommand \index{<file>.rel}
 
 \end_inset 
 
@@ -4038,7 +4073,7 @@ sourcefile.rel
 \layout Itemize
 
 sourcefile.map
-\begin_inset LatexCommand \index{.map}
+\begin_inset LatexCommand \index{<file>.map}
 
 \end_inset 
 
@@ -4051,7 +4086,7 @@ sourcefile.map
 \layout Itemize
 
 sourcefile.mem
-\begin_inset LatexCommand \index{.mem}
+\begin_inset LatexCommand \index{<file>.mem}
 
 \end_inset 
 
@@ -4059,7 +4094,7 @@ sourcefile.mem
 \layout Itemize
 
 sourcefile.ihx
-\begin_inset LatexCommand \index{.ihx}
+\begin_inset LatexCommand \index{<file>.ihx}
 
 \end_inset 
 
@@ -4139,7 +4174,7 @@ status Collapsed
 \layout Itemize
 
 sourcefile.cdb
-\begin_inset LatexCommand \index{.cdb}
+\begin_inset LatexCommand \index{<file>.cdb}
 
 \end_inset 
 
@@ -4158,7 +4193,7 @@ status Collapsed
 
 sourcefile.
  - (no extension)
-\begin_inset LatexCommand \index{. (no extension)}
+\begin_inset LatexCommand \index{<file> (no extension)}
 
 \end_inset 
 
@@ -4187,7 +4222,7 @@ status Collapsed
 \layout Itemize
 
 sourcefile.dump*
-\begin_inset LatexCommand \index{.dump*}
+\begin_inset LatexCommand \index{<file>.dump*}
 
 \end_inset 
 
@@ -4222,7 +4257,7 @@ Anatomy of the compiler
 \end_inset 
 
 ).
-\layout Subsubsection
+\layout Subsection
 
 Projects with Multiple Source Files
 \layout Standard
@@ -4355,7 +4390,7 @@ first
 .
  You can view this file to troubleshoot linking problems such as those arising
  from missing libraries.
-\layout Subsubsection
+\layout Subsection
 
 Projects with Additional Libraries
 \begin_inset LatexCommand \index{Libraries}
@@ -4427,7 +4462,7 @@ The most efficient way to use libraries is to keep separate modules in separate
 libsdcc.lib
 \emph default 
  in the directory <installdir>/share/lib/small.
-\layout Subsection
+\layout Section
 
 Command Line Options
 \begin_inset LatexCommand \index{Command Line Options}
@@ -4435,7 +4470,7 @@ Command Line Options
 \end_inset 
 
 
-\layout Subsubsection
+\layout Subsection
 
 Processor Selection Options
 \begin_inset LatexCommand \index{Options processor selection}
@@ -4507,6 +4542,24 @@ Processor Selection Options
 \labelwidthstring 00.00.0000
 
 
+\series bold 
+-mhc08
+\begin_inset LatexCommand \index{-mhc08}
+
+\end_inset 
+
+
+\series default 
+ Generate code for the Motorola HC08
+\begin_inset LatexCommand \index{HC08}
+
+\end_inset 
+
+ family of processors (added Oct 2003).
+\layout List
+\labelwidthstring 00.00.0000
+
+
 \series bold 
 -mz80
 \begin_inset LatexCommand \index{-mz80}
@@ -4534,7 +4587,7 @@ Processor Selection Options
 
 \series default 
  Generate code for the GameBoy Z80
-\begin_inset LatexCommand \index{GameBoy Z80}
+\begin_inset LatexCommand \index{gbz80 (GameBoy Z80)}
 
 \end_inset 
 
@@ -4638,7 +4691,7 @@ p16f627 p16f628 p16f84 p16f873 p16f877?
 \end_inset 
 
  processor (In development, not complete).
-\layout Subsubsection
+\layout Subsection
 
 Preprocessor Options
 \begin_inset LatexCommand \index{Options preprocessor}
@@ -4831,7 +4884,22 @@ file"'.
 \bar default 
 Like `-dD' except that the macro arguments and contents are omitted.
  Only `#define name' is included in the output.
-\layout Subsubsection
+\layout List
+\labelwidthstring 00.00.0000
+
+
+\series bold 
+-Wp\SpecialChar ~
+preprocessorOption[,preprocessorOption]
+\series default 
+
+\begin_inset LatexCommand \index{-Wp preprocessorOption[,preprocessorOption]}
+
+\end_inset 
+
+...
+ Pass the preprocessorOption to the preprocessor.
+\layout Subsection
 
 Linker Options
 \begin_inset LatexCommand \index{Options linker}
@@ -4865,7 +4933,7 @@ status Collapsed
 
 \series bold 
 -lib-path
-\begin_inset LatexCommand \index{-\/-lib-path}
+\begin_inset LatexCommand \index{-\/-lib-path <path>}
 
 \end_inset 
 
@@ -4875,10 +4943,8 @@ status Collapsed
 \end_inset 
 
 
-\bar under 
 \series default 
-\bar default 
+\SpecialChar ~
 <absolute path to additional libraries> This option is passed to the linkage
  editor's additional libraries
 \begin_inset LatexCommand \index{Libraries}
@@ -4907,10 +4973,11 @@ status Collapsed
 -xram-loc
 \series default 
 
-\begin_inset LatexCommand \index{-\/-xram-loc}
+\begin_inset LatexCommand \index{-\/-xram-loc <Value>}
 
 \end_inset 
 
+\SpecialChar ~
 <Value> The start location of the external ram
 \begin_inset LatexCommand \index{xdata}
 
@@ -4956,10 +5023,11 @@ status Collapsed
 -code-loc
 \series default 
 
-\begin_inset LatexCommand \index{-\/-code-loc}
+\begin_inset LatexCommand \index{-\/-code-loc <Value>}
 
 \end_inset 
 
+\SpecialChar ~
 <Value> The start location of the code
 \begin_inset LatexCommand \index{code}
 
@@ -5007,10 +5075,11 @@ status Collapsed
 -stack-loc
 \series default 
 
-\begin_inset LatexCommand \index{-\/-stack-loc}
+\begin_inset LatexCommand \index{-\/-stack-loc <Value>}
 
 \end_inset 
 
+\SpecialChar ~
 <Value> By default the stack
 \begin_inset LatexCommand \index{stack}
 
@@ -5064,10 +5133,11 @@ status Collapsed
 -data-loc
 \series default 
 
-\begin_inset LatexCommand \index{-\/-data-loc}
+\begin_inset LatexCommand \index{-\/-data-loc <Value>}
 
 \end_inset 
 
+\SpecialChar ~
 <Value> The start location of the internal ram data
 \begin_inset LatexCommand \index{data}
 
@@ -5129,16 +5199,17 @@ status Collapsed
 -idata-loc
 \series default 
 
-\begin_inset LatexCommand \index{-\/-idata-loc}
+\begin_inset LatexCommand \index{-\/-idata-loc <Value>}
 
 \end_inset 
 
+\SpecialChar ~
 <Value> The start location of the indirectly addressable internal ram
 \begin_inset LatexCommand \index{idata}
 
 \end_inset 
 
-, default value is 0x80.
+ of the 8051, default value is 0x80.
  The value entered can be in Hexadecimal or Decimal format, eg.
  -
 \begin_inset ERT
@@ -5165,6 +5236,37 @@ status Collapsed
 \labelwidthstring 00.00.0000
 
 
+\series bold 
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash 
+/
+\end_inset 
+
+-bit-loc
+\series default 
+\SpecialChar ~
+<Value> The start location of the bit
+\begin_inset LatexCommand \index{bit}
+
+\end_inset 
+
+ addressable internal ram of the 8051.
+ This is 
+\emph on 
+not
+\emph default 
+ implemented yet.
+ Instead an option can be passed directly to the linker: -Wl\SpecialChar ~
+-bBSEG=<Value>.
+\layout List
+\labelwidthstring 00.00.0000
+
+
 \series bold 
 -
 \begin_inset ERT
@@ -5223,7 +5325,22 @@ The linker output (final object code) is in Motorola S19 format
 \end_inset 
 
 .
-\layout Subsubsection
+\layout List
+\labelwidthstring 00.00.0000
+
+
+\series bold 
+-Wl\SpecialChar ~
+linkOption[,linkOption]
+\series default 
+
+\begin_inset LatexCommand \index{-Wl linkOption[,linkOption]}
+
+\end_inset 
+
+...
+ Pass the linkOption to the linker.
+\layout Subsection
 
 MCS51 Options
 \begin_inset LatexCommand \index{Options MCS51}
@@ -5340,8 +5457,9 @@ status Collapsed
 
 -iram-size
 \series default 
+\SpecialChar ~
 <Value>
-\begin_inset LatexCommand \index{-\/-iram-size<Value>}
+\begin_inset LatexCommand \index{-\/-iram-size <Value>}
 
 \end_inset 
 
@@ -5364,8 +5482,9 @@ status Collapsed
 
 -xram-size
 \series default 
+\SpecialChar ~
 <Value>
-\begin_inset LatexCommand \index{-\/-xram-size<Value>}
+\begin_inset LatexCommand \index{-\/-xram-size <Value>}
 
 \end_inset 
 
@@ -5388,14 +5507,15 @@ status Collapsed
 
 -code-size
 \series default 
+\SpecialChar ~
 <Value>
-\begin_inset LatexCommand \index{-\/-data-loc}
+\begin_inset LatexCommand \index{-\/-code-size <Value>}
 
 \end_inset 
 
  Causes the linker to check if the code memory usage is within limits of
  the given value.
-\layout Subsubsection
+\layout Subsection
 
 DS390 Options
 \begin_inset LatexCommand \index{Options DS390}
@@ -5448,6 +5568,29 @@ Generate 24-bit flat mode code.
 \labelwidthstring 00.00.0000
 
 
+\series bold 
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash 
+/
+\end_inset 
+
+-protect-sp-update
+\begin_inset LatexCommand \index{-\/-protect-sp-update}
+
+\end_inset 
+
+
+\series default 
+ disable interrupts during ESP:SP updates
+\layout List
+\labelwidthstring 00.00.0000
+
+
 \series bold 
 -
 \begin_inset ERT
@@ -5541,19 +5684,29 @@ status Collapsed
 -model-flat24 option
 \emph default 
 ).
-\layout Subsubsection
+\layout List
+\labelwidthstring 00.00.0000
 
-Z80 Options
-\begin_inset LatexCommand \index{Options Z80}
 
-\end_inset 
+\series bold 
+-
+\begin_inset ERT
+status Collapsed
 
+\layout Standard
 
-\begin_inset LatexCommand \index{Z80 options}
+\backslash 
+/
+\end_inset 
+
+-stack-probe
+\begin_inset LatexCommand \index{-\/-stack-probe}
 
 \end_inset 
 
 
+\series default 
+ insert call to function __stack_probe at each function prologue 
 \layout List
 \labelwidthstring 00.00.0000
 
@@ -5569,20 +5722,79 @@ status Collapsed
 /
 \end_inset 
 
--callee-saves-bc
-\series default 
-
-\begin_inset LatexCommand \index{-\/-callee-saves-bc}
+-tini-libid
+\begin_inset LatexCommand \index{-\/-tini-libid}
 
 \end_inset 
 
 
-\size large 
-\emph on 
-\size default 
-\emph default 
-Force a called function to always save BC.
+\series default 
+ <nnnn> LibraryID used in -mTININative 
+\layout List
+\labelwidthstring 00.00.0000
+
+
+\series bold 
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash 
+/
+\end_inset 
+
+-use-accelerator
+\begin_inset LatexCommand \index{-\/-use-accelerator}
+
+\end_inset 
+
+
+\series default 
+ generate code for DS390 Arithmetic Accelerator 
+\layout Subsection
+
+Z80 Options
+\begin_inset LatexCommand \index{Options Z80}
+
+\end_inset 
+
+
+\begin_inset LatexCommand \index{Z80 options}
+
+\end_inset 
+
+
+\layout List
+\labelwidthstring 00.00.0000
+
+
+\series bold 
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash 
+/
+\end_inset 
+
+-callee-saves-bc
+\series default 
+
+\begin_inset LatexCommand \index{-\/-callee-saves-bc}
+
+\end_inset 
+
+
+\size large 
+\emph on 
+\size default 
+\emph default 
+Force a called function to always save BC.
 \layout List
 \labelwidthstring 00.00.0000
 
@@ -5608,7 +5820,7 @@ status Collapsed
  When linking, skip the standard crt0.o object file.
  You must provide your own crt0.o for your system when linking.
  
-\layout Subsubsection
+\layout Subsection
 
 Optimization Options
 \begin_inset LatexCommand \index{Options optimization}
@@ -5849,7 +6061,7 @@ status Collapsed
 \series default 
  Will not memcpy initialized data from code space into xdata space.
  This saves a few bytes in code space if you don't have initialized data.
-\layout Subsubsection
+\layout Subsection
 
 Other Options
 \begin_inset LatexCommand \index{Options other}
@@ -6120,34 +6332,6 @@ Stop after the stage of compilation proper; do not assemble.
 \labelwidthstring 00.00.0000
 
 
-\series bold 
--Wa_asmOption[,asmOption]
-\series default 
-
-\begin_inset LatexCommand \index{-Wa\_asmOption[,asmOption]}
-
-\end_inset 
-
-...
- Pass the asmOption to the assembler.
-\layout List
-\labelwidthstring 00.00.0000
-
-
-\series bold 
--Wl_linkOption[,linkOption]
-\series default 
-
-\begin_inset LatexCommand \index{-Wl\_linkOption[,linkOption]}
-
-\end_inset 
-
-...
- Pass the linkOption to the linker.
-\layout List
-\labelwidthstring 00.00.0000
-
-
 \series bold 
 -
 \begin_inset ERT
@@ -6326,6 +6510,7 @@ status Collapsed
 
 \end_inset 
 
+\SpecialChar ~
 <filename> This option can be used to use additional rules to be used by
  the peep hole optimizer.
  See section 
@@ -6357,7 +6542,7 @@ status Collapsed
 
 
 \series default 
 Disable peep-hole optimization.
+ Disable peep-hole optimization.
 \layout List
 \labelwidthstring 00.00.0000
 
@@ -6630,7 +6815,22 @@ status Collapsed
 
 \series default 
  Send errors and warnings to stdout instead of stderr.
-\layout Subsubsection
+\layout List
+\labelwidthstring 00.00.0000
+
+
+\series bold 
+-Wa\SpecialChar ~
+asmOption[,asmOption]
+\series default 
+
+\begin_inset LatexCommand \index{-Wa asmOption[,asmOption]}
+
+\end_inset 
+
+...
+ Pass the asmOption to the assembler.
+\layout Subsection
 
 Intermediate Dump Options
 \begin_inset LatexCommand \label{sub:Intermediate-Dump-Options}
@@ -6934,7 +7134,7 @@ status Collapsed
 \size default 
 \bar default 
 Will cause all the above mentioned dumps to be created.
-\layout Subsubsection
+\layout Subsection
 
 Redirecting output on Windows Shells
 \layout Standard
@@ -7049,7 +7249,7 @@ status Collapsed
 \series bold 
 \emph default 
 -model-large -c $(InputPath)
-\layout Subsection
+\layout Section
 
 Environment variables
 \begin_inset LatexCommand \index{Environment variables}
@@ -7185,6 +7385,9 @@ Search Paths
 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.
+\layout Section
+
+Storage Class Language Extensions
 \layout Subsection
 
 MCS51/DS390 Storage Class
@@ -7196,7 +7399,7 @@ MCS51/DS390 Storage Class
 \layout Standard
 
 In addition to the ANSI storage classes SDCC allows the following MCS51
- specific storage classes.
+ specific storage classes:
 \layout Subsubsection
 
 data
@@ -7335,7 +7538,19 @@ r0,#_test_idata
 \SpecialChar ~
 mov\SpecialChar ~
 \SpecialChar ~
-@r0,#0x01 
+@r0,#0x01
+\layout Standard
+
+Please note, the first 128 byte of idata physically access the same RAM
+ as the data memory.
+ The original 8051 had 128 byte idata memory, nowadays most devices have
+ 256 byte idata memory.
+ The stack
+\begin_inset LatexCommand \index{stack}
+
+\end_inset 
+
+ is located in idata memory.
 \layout Subsubsection
 
 pdata
@@ -7351,7 +7566,12 @@ Paged xdata access is currently not as straightforward as using the other
  The following example writes 0x01 to the address pointed to.
  Please note, pdata access physically accesses xdata memory.
  The high byte of the address is determined by port P2 (or in case of some
- 8051 variants by a separate Special Function Register).
+ 8051 variants by a separate Special Function Register, see section
+\begin_inset LatexCommand \ref{sub:MCS51-variants}
+
+\end_inset 
+
+).
 \layout Verse
 
 
@@ -7486,6 +7706,54 @@ clr a
 \SpecialChar ~
 \SpecialChar ~
 movc a,@a+dptr 
+\layout Standard
+
+
+\family typewriter 
+char
+\family default 
+ indexed arrays of characters in code memory can be accessed efficiently:
+\layout Verse
+
+
+\family typewriter 
+code char test_array[] = {'c','h','e','a','p'}; 
+\layout Standard
+
+Read access to this array using an 8-bit index generates the assembly code:
+\layout Verse
+
+
+\family typewriter 
+E5*00\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+mov a,_index 
+\layout Verse
+
+
+\family typewriter 
+90s00r41\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+mov dptr,#_test_array
+\layout Verse
+
+
+\family typewriter 
+93\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+movc a,@a+dptr 
 \layout Subsubsection
 
 bit
@@ -7520,6 +7788,30 @@ D2*00\SpecialChar ~
 \SpecialChar ~
 setb\SpecialChar ~
 _test_bit
+\layout Standard
+
+The bit addressable memory consists of 128 bits which are located from 0x20
+ to 0x2f in data memory.
+\layout Standard
+
+Apart from this 8051 specific storage class most architectures support ANSI-C
+ bitfields
+\begin_inset LatexCommand \index{bitfields}
+
+\end_inset 
+
+\begin_inset Foot
+collapsed false
+
+\layout Standard
+
+Not really meant as examples, but nevertheless showing what bitfields are
+ about: device/include/mc68hc908qy.h and support/regression/tests/bitfields.c
+\end_inset 
+
+.
 \layout Subsubsection
 
 sfr
@@ -7540,7 +7832,27 @@ Like the bit keyword,
 sfr / sbit 
 \emph default 
 signifies both a data-type and storage class, they are used to describe
- the special function registers and special bit variables of a 8051, eg:
+ the 
+\emph on 
+s
+\emph default 
+pecial 
+\emph on 
+f
+\emph default 
+unction 
+\emph on 
+r
+\emph default 
+egisters and 
+\emph on 
+s
+\emph default 
+pecial 
+\emph on 
+bit
+\emph default 
+ variables of a 8051, eg:
 \layout Verse
 
 
@@ -7564,6 +7876,14 @@ sbit at 0xd7 CY; /* CY (Carry Flag
 \end_inset 
 
 ) */
+\layout Standard
+
+Special function registers which are located on an address dividable by
+ 8 are bit-addressable, an
+\emph on 
+ sbit
+\emph default 
+ addresses a specific bit within these sfr.
 \layout Subsubsection
 
 Pointers
@@ -7662,6 +7982,168 @@ generic
  code.
 \layout Subsection
 
+Z80/Z180 Storage Class
+\begin_inset LatexCommand \index{Storage class}
+
+\end_inset 
+
+ Language Extensions
+\layout Subsubsection
+
+sfr
+\begin_inset LatexCommand \index{sfr}
+
+\end_inset 
+
+ (in/out to 8-bit addresses)
+\layout Standard
+
+The Z80
+\begin_inset LatexCommand \index{Z80}
+
+\end_inset 
+
+ family has separate address spaces for memory and 
+\emph on 
+i
+\emph default 
+nput/
+\emph on 
+o
+\emph default 
+utput memory.
+ I/O memory
+\begin_inset LatexCommand \index{I/O memory (Z80/Z180)}
+
+\end_inset 
+
+ is accessed with special instructions, e.g.:
+\layout Verse
+
+
+\family typewriter 
+sfr at 0x78 IoPort;\SpecialChar ~
+\SpecialChar ~
+/* define a var in I/O space at 78h called IoPort */
+\layout Standard
+
+Writing 0x01 to this variable generates the assembly code:
+\layout Verse
+
+
+\family typewriter 
+3E 01\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+ld a,#0x01
+\newline 
+D3 78\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+out (_IoPort),a 
+\layout Subsubsection
+
+banked sfr
+\begin_inset LatexCommand \index{sfr}
+
+\end_inset 
+
+ (in/out to 16-bit addresses)
+\layout Standard
+
+The keyword 
+\emph on 
+banked
+\emph default 
+ is used to support 16 bit addresses in I/O memory e.g.:
+\layout Verse
+
+
+\family typewriter 
+sfr banked at 0x123 IoPort; 
+\layout Standard
+
+Writing 0x01 to this variable generates the assembly code:
+\layout Verse
+
+
+\family typewriter 
+01 23 01\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+ld bc,#_IoPort
+\newline 
+3E 01\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+ld a,#0x01 
+\newline 
+ED 79\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+out (c),a 
+\layout Subsubsection
+
+sfr
+\begin_inset LatexCommand \index{sfr}
+
+\end_inset 
+
+ (in0/out0 to 8 bit addresses on Z180
+\begin_inset LatexCommand \index{Z180}
+
+\end_inset 
+
+/HD64180
+\begin_inset LatexCommand \index{HD64180}
+
+\end_inset 
+
+)
+\layout Standard
+
+The compiler option -
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash 
+/
+\end_inset 
+
+-portmode=180 (80) and a compiler #pragma\SpecialChar ~
+portmode
+\begin_inset LatexCommand \index{\#pragma portmode}
+
+\end_inset 
+
+=z180 (z80) is used to turn on (off) the Z180/HD64180 port addressing instructio
+ns 
+\family typewriter 
+in0/out0
+\family default 
+ instead of 
+\family typewriter 
+in/out
+\family default 
+.
+ If you include the file z180.h this will be set automatically.
+\layout Section
+
 Absolute Addressing
 \begin_inset LatexCommand \index{Absolute addressing}
 
@@ -7699,26 +8181,35 @@ xdata
 
 In the above example the variable chksum will located at 0x7ffe and 0x7fff
  of the external ram.
- The compiler does not actually reserve any space for variables declared
- in this way (they are implemented with an equate in the assembler).
+ 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).
  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
-\begin_inset LatexCommand \index{.lst}
+\begin_inset LatexCommand \index{<file>.lst}
 
 \end_inset 
 
 ) and the linker output files (.rst
-\begin_inset LatexCommand \index{.rst}
+\begin_inset LatexCommand \index{<file>.rst}
 
 \end_inset 
 
 ) and (.map
-\begin_inset LatexCommand \index{.map}
+\begin_inset LatexCommand \index{<file>.map}
 
 \end_inset 
 
 ) are good places to look for such overlaps.
+ Variables with an absolute address are 
+\emph on 
+not
+\emph default 
+ initialized.
 \layout Standard
 
 In case of memory mapped I/O devices the keyword 
@@ -7907,7 +8398,12 @@ bit at 0x91 SCLK;\SpecialChar ~
 \SpecialChar ~
 /* I/O port 1, bit 1 */
 \newline 
-bit CPOL;\SpecialChar ~
+bit
+\begin_inset LatexCommand \index{bit}
+
+\end_inset 
+
+ CPOL;\SpecialChar ~
 \SpecialChar ~
 \SpecialChar ~
 \SpecialChar ~
@@ -7925,11 +8421,16 @@ 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
  specified in the whole project.
-\layout Subsection
+\layout Section
 
 Parameters
 \begin_inset LatexCommand \index{Parameters}
 
+\end_inset 
+
+
+\begin_inset LatexCommand \index{function parameter}
+
 \end_inset 
 
  & Local Variables
@@ -8119,10 +8620,19 @@ reentrant
  this should only be done for static variables.
 \layout Standard
 
-Parameters however are not allowed any storage class, (storage classes for
- parameters will be ignored), their allocation is governed by the memory
- model in use, and the reentrancy options.
-\layout Subsection
+Parameters
+\begin_inset LatexCommand \index{function parameter}
+
+\end_inset 
+
+ however are not allowed any storage class
+\begin_inset LatexCommand \index{storage class}
+
+\end_inset 
+
+, (storage classes for parameters will be ignored), their allocation is
+ governed by the memory model in use, and the reentrancy options.
+\layout Section
 
 Overlaying
 \begin_inset LatexCommand \label{sub:Overlaying}
@@ -8176,19 +8686,15 @@ NOOVERLAY
  if they are not reentrant.
 \layout Standard
 
-Also note that the compiler does not do any processing of inline
-\begin_inset LatexCommand \index{inline}
-
-\end_inset 
-
- assembler code, so the compiler might incorrectly assign local variables
- and parameters of a function into the overlay segment if the inline assembler
- code calls other c-functions that might use the overlay.
+Also note that the compiler does not do any processing of inline assembler
+ code, so the compiler might incorrectly assign local variables and parameters
+ of a function into the overlay segment if the inline assembler code calls
+ other c-functions that might use the overlay.
  In that case the #pragma\SpecialChar ~
 NOOVERLAY should be used.
 \layout Standard
 
-Parameters and Local variables of functions that contain 16 or 32 bit multiplica
+Parameters and local variables of functions that contain 16 or 32 bit multiplica
 tion
 \begin_inset LatexCommand \index{Multiplication}
 
@@ -8276,7 +8782,7 @@ NOOVERLAY was
  The #pragma\SpecialChar ~
 NOOVERLAY ensures that the parameters and local variables for
  the function are NOT overlayed.
-\layout Subsection
+\layout Section
 
 Interrupt Service Routines
 \begin_inset LatexCommand \label{sub:Interrupt-Service-Routines}
@@ -8716,10 +9222,10 @@ status Collapsed
 /
 \end_inset 
 
--int-long-ren
+-int-long-reent
 \emph default 
-t
-\begin_inset LatexCommand \index{-\/-int-long-rent}
+
+\begin_inset LatexCommand \index{-\/-int-long-reent}
 
 \end_inset 
 
@@ -8755,11 +9261,12 @@ about Overlaying and section
 
 \SpecialChar ~
 about Functions using private banks.
-\newline 
+\layout Section
 
+Enabling and Disabling Interrupts
 \layout Subsection
 
-Critical Functions
+Critical Functions and Critical Statements
 \layout Standard
 
 A special keyword may be associated with a function declaring it as 
@@ -8774,47 +9281,190 @@ critical
 
  upon entry to a critical function and restore the interrupt enable to the
  previous state before returning.
- Note that nesting critical functions will need one additional byte on the
- stack
+ Nesting critical functions will need one additional byte on the stack
 \begin_inset LatexCommand \index{stack}
 
 \end_inset 
 
- for each call.
-\layout Verse
+ for each call.
+\layout Verse
+
+
+\family typewriter 
+int foo () critical
+\begin_inset LatexCommand \index{critical}
+
+\end_inset 
+
+\newline 
+{ 
+\newline 
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+...
+\newline 
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+...
+\newline 
+}
+\layout Standard
+
+The critical attribute maybe used with other attributes like 
+\emph on 
+reentrant.
+\emph default 
+
+\newline 
+The keyword 
+\emph on 
+critical
+\emph default 
+ may also be used to disable interrupts more locally:
+\layout Verse
+
+
+\family typewriter 
+critical{ i++; }
+\layout Standard
+
+More than one statement could have been included in the block.
+\layout Subsection
+
+Enabling and Disabling Interrupts directly
+\layout Standard
+
+Interrupts
+\begin_inset LatexCommand \index{interrupt}
+
+\end_inset 
+
+ can also be disabled and enabled directly (8051):
+\layout Verse
+
+
+\family typewriter 
+EA = 0;
+\layout Verse
+
+
+\family typewriter 
+...
+\layout Verse
+
+
+\family typewriter 
+EA = 1;
+\layout Standard
+
+On other architectures which have seperate opcodes for enabling and disabling
+ interrupts you might want to make use of defines with inline assembly
+\begin_inset LatexCommand \index{Assembler routines}
+
+\end_inset 
+
+ (HC08):
+\layout Verse
+
+
+\family typewriter 
+#define CLI _asm
+\begin_inset LatexCommand \index{\_asm}
+
+\end_inset 
+
+\SpecialChar ~
+\SpecialChar ~
+cli\SpecialChar ~
+\SpecialChar ~
+_endasm
+\begin_inset LatexCommand \index{\_endasm}
+
+\end_inset 
+
+; 
+\layout Verse
+
+
+\family typewriter 
+#define SEI _asm\SpecialChar ~
+\SpecialChar ~
+sei\SpecialChar ~
+\SpecialChar ~
+_endasm; 
+\layout Verse
+
+
+\family typewriter 
+...
+\layout Standard
+
+Note: it is sometimes sufficient to disable only a specific interrupt source
+ like f.e.
+ a timer or serial interrupt by manipulating an 
+\emph on 
+interrupt mask
+\begin_inset LatexCommand \index{interrupt mask}
+
+\end_inset 
+
+
+\emph default 
+ register.
+ Usually the time during which interrupts are disabled should be kept as
+ short as possible.
+ This minimizes both 
+\emph on 
+interrupt latency
+\emph default 
+
+\begin_inset LatexCommand \index{interrupt latency}
+
+\end_inset 
+
+ (the time between the occurrence of the interrupt and the execution of
+ the first code in the interrupt routine) and 
+\emph on 
+interrupt jitter
+\emph default 
+
+\begin_inset LatexCommand \index{interrupt jitter}
+
+\end_inset 
+
+ (the difference between the shortest and the longest interrupt latency).
+ These really are something different, f.e.
+ a serial interrupt has to be served before its buffer overruns so it cares
+ for the maximum interrupt latency, whereas it does not care about jitter.
+ On a loudspeaker driven via a digital to analog converter which is fed
+ by an interrupt a latency of a few milliseconds might be tolerable, whereas
+ a much smaller jitter will be very audible.
+\layout Standard
 
+You can reenable interrupts within an interrupt routine and on some architecture
+s you can make use of two (or more) levels of 
+\emph on 
+interrupt priorities
+\emph default 
 
-\family typewriter 
-int foo () critical
-\begin_inset LatexCommand \index{critical}
+\begin_inset LatexCommand \index{interrupt priority}
 
 \end_inset 
 
+.
+ On architectures which don't support interrupt priorities these can be
+ implemented by manipulating the interrupt mask and reenabling interrupts
+ within the interrupt routine.
+ Don't add complexity unless you have to.
  
-\newline 
-{ 
-\newline 
-\SpecialChar ~
-\SpecialChar ~
-\SpecialChar ~
-\SpecialChar ~
-...
-\newline 
-\SpecialChar ~
-\SpecialChar ~
-\SpecialChar ~
-\SpecialChar ~
-...
-\newline 
-}
-\layout Standard
-
-The critical attribute maybe used with other attributes like 
-\emph on 
-reentrant.
-\layout Subsection
+\layout Section
 
 Functions using private banks
 \begin_inset LatexCommand \label{sub:Functions-using-private-banks}
@@ -8923,7 +9573,7 @@ It is most efficient if your ISR calls no other functions.
  It is very inefficient to call a function using a different, non-zero bank
  from an ISR.
  
-\layout Subsection
+\layout Section
 
 Startup Code
 \begin_inset LatexCommand \label{sub:Startup-Code}
@@ -8936,7 +9586,7 @@ Startup Code
 \end_inset 
 
 
-\layout Subsubsection
+\layout Subsection
 
 MCS51/DS390 Startup Code
 \layout Standard
@@ -8972,6 +9622,8 @@ _sdcc_external_startup()
  routine to your program to override the default if you need to setup hardware
  or perform some other critical operation prior to static & global variable
  initialization.
+ On some mcs51 variants xdata has to be explicitly enabled before it can
+ be accessed, this is the place to do it.
  See also the compiler option 
 \emph on 
 -
@@ -9002,7 +9654,13 @@ opt
 
 \SpecialChar ~
 about MCS51-variants.
-\layout Subsubsection
+\layout Subsection
+
+HC08 Startup Code
+\layout Standard
+
+The HC08 startup code follows the same scheme as the MCS51 startup code.
+\layout Subsection
 
 Z80 Startup Code
 \layout Standard
@@ -9036,7 +9694,7 @@ status Collapsed
 
  and provide your own crt0.o.
  
-\layout Subsection
+\layout Section
 
 Inline Assembler Code
 \begin_inset LatexCommand \index{Assembler routines}
@@ -9044,7 +9702,7 @@ Inline Assembler Code
 \end_inset 
 
 
-\layout Subsubsection
+\layout Subsection
 
 A Step by Step Introduction
 \layout Standard
@@ -9298,7 +9956,7 @@ unsigned char xdata at 0x7f00 buf[0x100];
 \newline 
 unsigned char head,tail;
 \newline 
-#define USE_ASSEMBLY (1)
+#define USE_ASSEMBLY
 \newline 
 
 \newline 
@@ -9418,7 +10076,7 @@ xrl\SpecialChar ~
 \SpecialChar ~
 \SpecialChar ~
 \SpecialChar ~
-; we could do an ANL a,#0x0f here to use a smaller buffer
+; we could do an ANL a,#0x0f here to use a smaller buffer (see below)
 \newline 
 \SpecialChar ~
 \SpecialChar ~
@@ -9516,7 +10174,7 @@ _head
 \SpecialChar ~
 \SpecialChar ~
 \SpecialChar ~
-;
+; we could do an ANL _head,#0x0f here to use a smaller buffer (see above)
 \newline 
 t_b_end$:
 \newline 
@@ -9608,7 +10266,7 @@ peep-asm
 SDCCpeeph.def
 \emph default 
  carefully before using this option.
-\layout Subsubsection
+\layout Subsection
 
 Naked Functions
 \begin_inset LatexCommand \label{sub:Naked-Functions}
@@ -9930,7 +10588,7 @@ The #pragma directive EXCLUDE
 While there is nothing preventing you from writing C code inside a _naked
  function, there are many ways to shoot yourself in the foot doing this,
  and it is recommended that you stick to inline assembler.
-\layout Subsubsection
+\layout Subsection
 
 Use of Labels within Inline Assembler
 \layout Standard
@@ -10086,7 +10744,7 @@ In other words inline assembly code can access labels defined in inline
  assembly within the scope of the function.
  The same goes the other way, ie.
  labels defines in inline assembly can not be accessed by C statements.
-\layout Subsection
+\layout Section
 
 Interfacing with Assembler Code
 \begin_inset LatexCommand \index{Assembler routines}
@@ -10094,7 +10752,7 @@ Interfacing with Assembler Code
 \end_inset 
 
 
-\layout Subsubsection
+\layout Subsection
 
 Global Registers used for Parameter Passing
 \begin_inset LatexCommand \index{Parameter passing}
@@ -10111,6 +10769,11 @@ DPL, DPH
 
 \end_inset 
 
+
+\begin_inset LatexCommand \index{DPTR}
+
+\end_inset 
+
 , B
 \begin_inset LatexCommand \index{B (register)}
 
@@ -10142,7 +10805,7 @@ status Collapsed
 -stack-auto is used) or in data / xdata memory (depending on the memory
  model).
  
-\layout Subsubsection
+\layout Subsection
 
 Assembler Routine(non-reentrant
 \begin_inset LatexCommand \index{reentrant}
@@ -10158,7 +10821,12 @@ Assembler Routine(non-reentrant
 \layout Standard
 
 In the following example the function c_func calls an assembler routine
- asm_func, which takes two parameters.
+ asm_func, which takes two parameters
+\begin_inset LatexCommand \index{function parameter}
+
+\end_inset 
+
+.
 \layout Verse
 
 
@@ -10231,7 +10899,7 @@ _asm_func_PARM_2:
 \SpecialChar ~
 \SpecialChar ~
 \SpecialChar ~
-.ds     
+.ds    1 
 \newline 
 \SpecialChar ~
 \SpecialChar ~
@@ -10305,8 +10973,13 @@ dph
 ret
 \layout Standard
 
-Note here that the return values are placed in 'dpl' - One byte return value,
- 'dpl' LSB & 'dph' MSB for two byte values.
+Note here that the return values
+\begin_inset LatexCommand \index{return value}
+
+\end_inset 
+
+ are placed in 'dpl' - One byte return value, 'dpl' LSB & 'dph' MSB for
+ two byte values.
  'dpl', 'dph' and 'b' for three byte values (generic pointers) and 'dpl','dph','
 b' & 'acc' for four byte values.
 \layout Standard
@@ -10373,7 +11046,7 @@ Then compile and link the assembler routine to the C source file with the
 \family sans 
 \series bold 
 sdcc cfunc.c asmfunc.rel
-\layout Subsubsection
+\layout Subsection
 
 Assembler Routine(reentrant
 \begin_inset LatexCommand \index{reentrant}
@@ -10388,8 +11061,13 @@ Assembler Routine(reentrant
 
 \layout Standard
 
-In this case the second parameter onwards will be passed on the stack, the
- parameters are pushed from right to left i.e.
+In this case the second parameter
+\begin_inset LatexCommand \index{function parameter}
+
+\end_inset 
+
+ onwards will be passed on the stack, the parameters are pushed from right
+ to left i.e.
  after the call the left most parameter will be on the top of the stack.
  Here is an example:
 \layout Verse
@@ -10537,7 +11215,7 @@ 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
  and local variables.
-\layout Subsection
+\layout Section
 
 int (16 bit)
 \begin_inset LatexCommand \index{int (16 bit)}
@@ -10827,8 +11505,8 @@ status Collapsed
 /
 \end_inset 
 
--int-long-rent
-\begin_inset LatexCommand \index{-\/-int-long-rent}
+-int-long-reent
+\begin_inset LatexCommand \index{-\/-int-long-reent}
 
 \end_inset 
 
@@ -10838,7 +11516,7 @@ status Collapsed
  Notice that you don't have to call this routines directly.
  The compiler will use them automatically every time an integer operation
  is required.
-\layout Subsection
+\layout Section
 
 Floating Point Support
 \begin_inset LatexCommand \index{Floating point support}
@@ -11491,7 +12169,7 @@ Note if all these routines are used simultaneously the data space might
  Also notice that you don't have to call this routines directly.
  The compiler will use them automatically every time a floating point operation
  is required.
-\layout Subsection
+\layout Section
 
 MCS51 Memory Models
 \begin_inset LatexCommand \index{Memory model}
@@ -11549,7 +12227,7 @@ Judicious usage of the processor specific storage classes
  Several optimizations are disabled when the program is compiled using the
  large model, it is therefore strongly recommended that the small model
  be used unless absolutely required.
-\layout Subsection
+\layout Section
 
 DS390 Memory Models
 \begin_inset LatexCommand \index{Memory model}
@@ -11638,7 +12316,7 @@ status Collapsed
 \emph default 
  on the SDCC command line.
  However, currently the linker can not handle code segments > 64k.
-\layout Subsection
+\layout Section
 
 Pragmas
 \begin_inset LatexCommand \index{Pragmas}
@@ -11819,6 +12497,15 @@ CALLEE-SAVES
 \end_inset 
 
  is appended to the list of functions specified in the command line.
+\layout Itemize
+
+preproc_asm
+\begin_inset LatexCommand \index{\#pragma preproc\_asm}
+
+\end_inset 
+
+ (+ | -) - switch _asm _endasm block preprocessing on / off.
+ Default is on.
 \layout Standard
 
 The pragma's are intended to be used to turn-on or off certain optimizations
@@ -11897,7 +12584,7 @@ int foo ()
 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 Subsection
+\layout Section
 
 Defines Created by the Compiler
 \begin_inset LatexCommand \index{Defines created by the compiler}
@@ -12012,12 +12699,17 @@ __mcs51
 
 \end_inset 
 
- or __ds390
+, __ds390
 \begin_inset LatexCommand \index{\_\_ds390}
 
 \end_inset 
 
- or __z80
+, __hc08
+\begin_inset LatexCommand \index{\_\_hc08}
+
+\end_inset 
+
+, __z80
 \begin_inset LatexCommand \index{\_\_z80}
 
 \end_inset 
@@ -12244,8 +12936,8 @@ when
 
 \newline 
 
-\layout Section
-\pagebreak_top 
+\layout Chapter
+
 Debugging with SDCDB
 \begin_inset LatexCommand \index{sdcdb}
 
@@ -12273,7 +12965,7 @@ on, which also builds and installs the debugger in the target directory
  The debugger allows you debug BOTH at the C source and at the ASM source
  level.
  Sdcdb is available on Unix platforms only.
-\layout Subsection
+\layout Section
 
 Compiling for Debugging
 \layout Standard
@@ -12285,7 +12977,7 @@ debug option must be specified for all files for which debug information
  The complier generates a .adb file for each of these files.
  The linker creates the .cdb file from the .adb files and the address information.
  This .cdb is used by the debugger.
-\layout Subsection
+\layout Section
 
 How the Debugger Works
 \layout Standard
@@ -12311,7 +13003,7 @@ status Collapsed
  execution is controlled by the debugger.
  When a command is issued for the debugger, it translates it into appropriate
  commands for the simulator.
-\layout Subsection
+\layout Section
 
 Starting the Debugger
 \layout Standard
@@ -12346,7 +13038,7 @@ foo.ihx - the Intel hex format
 \end_inset 
 
  object file.
-\layout Subsection
+\layout Section
 
 Command Line Options.
 \layout Itemize
@@ -12410,7 +13102,10 @@ status Collapsed
 \layout Itemize
 
 -S <serial in,out> passed to simulator see the simulator docs for details.
-\layout Subsection
+\layout Itemize
+
+-k <port number> passed to simulator see the simulator docs for details.
+\layout Section
 
 Debugger Commands.
 \layout Standard
@@ -12560,7 +13255,7 @@ quit.
 "Watch me now.
  Iam going Down.
  My name is Bobby Brown"
-\layout Subsection
+\layout Section
 
 Interfacing with XEmacs
 \begin_inset LatexCommand \index{XEmacs}
@@ -13369,7 +14064,7 @@ Toggle Sdcdbsrc mode
 ;; 
 \newline 
 
-\layout Section
+\layout Chapter
 \pagebreak_top 
 TIPS
 \layout Standard
@@ -13382,6 +14077,92 @@ Here are a few guidelines that will help the compiler generate more efficient
 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.
+ This promotion can be omitted, if the result is the same.
+ The effect of the promotion rules together with the sign-extension is often
+ supprising:
+\begin_deeper 
+\layout Verse
+
+
+\family typewriter 
+unsigned char uc = 0xfe;
+\newline 
+if (uc * uc < 0) /* this is true! */
+\newline 
+{
+\newline 
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+....
+\newline 
+}
+\layout Standard
+
+
+\family typewriter 
+uc * uc
+\family default 
+ is evaluated as 
+\family typewriter 
+(int) uc * (int) uc = (int) 0xfe * (int) 0xfe = (int) 0xfc04 = -1024
+\family default 
+.
+\newline 
+Another one:
+\layout Verse
+
+
+\family typewriter 
+(unsigned char) -12 / (signed char) -3 = ...
+\layout Standard
+
+No, the result is not 4:
+\layout Verse
+
+
+\family typewriter 
+(int) (unsigned char) -12 / (int) (signed char) -3 =
+\newline 
+(int) (unsigned char) 0xf4 / (int) (signed char) 0xfd =
+\newline 
+(int) 0x00f4 / (int) 0xfffd =
+\newline 
+(int) 0x00f4 / (int) 0xfffd =
+\newline 
+(int) 244 / (int) -3 =
+\newline 
+(int) -81 = (int) 0xffaf;
+\layout Standard
+
+Don't complain, that gcc gives you a different result.
+ gcc uses 32 bit ints, while SDCC uses 16 bit ints.
+ Therefore the results are different.
+\newline 
+From 
+\begin_inset Quotes sld
+\end_inset 
+
+comp.lang.c FAQ
+\begin_inset Quotes srd
+\end_inset 
+
+:
+\layout Quote
+
+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.
+ (Beware when mixing signed and unsigned values in expressions, though.)
+\newline 
+Although character types (especially unsigned char) can be used as "tiny"
+ integers, doing so is sometimes more trouble than it's worth, due to unpredicta
+ble sign extension and increased code size.
+\end_deeper 
 \layout Itemize
 
 Use unsigned when it is known in advance that the value is not going to
@@ -13416,7 +14197,7 @@ foobar(unsigned int p1, unsigned char ch)
 \SpecialChar ~
 \SpecialChar ~
 \SpecialChar ~
-unsigned char ch1 = p1 % ch ;
+unsigned char ch1 = p1 * ch ;
 \newline 
 \SpecialChar ~
 \SpecialChar ~
@@ -13427,10 +14208,9 @@ unsigned char ch1 = p1 % ch ;
 }
 \layout Standard
 
-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.
+For the multiplication the variable ch will be promoted to int first then
+ the modulus operation will be performed (this will lead to a call to support
+ routine _mulint()), and the result will be casted to a char.
  If the code is changed to 
 \layout Verse
 
@@ -13444,7 +14224,7 @@ foobar(unsigned int p1, unsigned char ch)
 \SpecialChar ~
 \SpecialChar ~
 \SpecialChar ~
-unsigned char ch1 = (unsigned char)p1 % ch ;
+unsigned char ch1 = (unsigned char)p1 * ch ;
 \newline 
 \SpecialChar ~
 \SpecialChar ~
@@ -13455,7 +14235,7 @@ unsigned char ch1 = (unsigned char)p1 % ch ;
 }
 \layout Standard
 
-It would substantially reduce the code generated (future versions of the
+it would substantially reduce the code generated (future versions of the
  compiler will be smart enough to detect such optimization opportunities).
 \end_deeper 
 \layout Itemize
@@ -13469,7 +14249,7 @@ feeling
 \end_inset 
 
  for the code generation.
-\layout Subsection
+\layout Section
 
 Notes on MCS51 memory
 \begin_inset LatexCommand \index{MCS51 memory}
@@ -13535,7 +14315,14 @@ data
 xdata
 \emph default 
  memory has to be activated before using it (you can probably find this
- information on the datasheet of the microcontroller your are using).
+ information on the datasheet of the microcontroller your are using, see
+ also section 
+\begin_inset LatexCommand \ref{sub:Startup-Code}
+
+\end_inset 
+
+\SpecialChar ~
+Startup-Code).
 \layout Standard
 
 Normally SDCC will only use the first bank
@@ -13719,7 +14506,7 @@ The 8051 linker generates two files with memory allocation information.
  allocation, take a look at either the .map or .mem files to find out what
  the problem is.
  The .mem file may even suggest a solution to the problem.
-\layout Subsection
+\layout Section
 
 Tools
 \begin_inset LatexCommand \index{Tools}
@@ -14127,7 +14914,7 @@ sdcc/bin
 
 \newline 
 
-\layout Subsection
+\layout Section
 
 Related open source tools
 \begin_inset LatexCommand \index{Related tools}
@@ -14139,7 +14926,7 @@ Related open source tools
 \align center 
 
 \begin_inset  Tabular
-<lyxtabular version="3" rows="8" columns="3">
+<lyxtabular version="3" rows="9" columns="3">
 <features>
 <column alignment="center" valignment="top" leftline="true" width="0pt">
 <column alignment="block" valignment="top" leftline="true" width="30line%">
@@ -14234,6 +15021,42 @@ 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
+
+indent
+\begin_inset LatexCommand \index{indent}
+
+\end_inset 
+
+
+\end_inset 
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+Formats C source - Master of the white spaces
+\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://home.hccnet.nl/d.ingamells/beautify.html}
+
+\end_inset 
+
+
 \end_inset 
 </cell>
 </row>
@@ -14424,7 +15247,7 @@ Debugger, serves nicely as GUI to sdcdb
 
 \newline 
 
-\layout Subsection
+\layout Section
 
 Related documentation / recommended reading
 \layout Standard
@@ -14468,9 +15291,16 @@ Where to get
 
 \layout Standard
 
-S.
- S.
- Muchnick
+
+\family roman 
+\series medium 
+\shape up 
+\size normal 
+\emph off 
+\bar no 
+\noun off 
+\color none
+c-refcard.pdf
 \end_inset 
 </cell>
 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
 
 \layout Standard
 
-Advanced Compiler Design and Implementation
+C Reference Card
+\begin_inset LatexCommand \index{C Reference card}
+
+\end_inset 
+
+, 2 pages
 \end_inset 
 </cell>
 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
@@ -14486,7 +15321,12 @@ Advanced Compiler Design and Implementation
 
 \layout Standard
 
-bookstore
+
+\begin_inset LatexCommand \url{http://www.refcards.com/about/c.html}
+
+\end_inset 
+
+
 \end_inset 
 </cell>
 </row>
@@ -14494,18 +15334,11 @@ bookstore
 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
 \begin_inset Text
 
-\layout Standard
-
-
-\family roman 
-\series medium 
-\shape up 
-\size normal 
-\emph off 
-\bar no 
-\noun off 
-\color none
-c-refcard.pdf
+\layout Standard
+
+S.
+ S.
+ Muchnick
 \end_inset 
 </cell>
 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
@@ -14513,12 +15346,7 @@ c-refcard.pdf
 
 \layout Standard
 
-C Reference Card
-\begin_inset LatexCommand \index{C Reference card}
-
-\end_inset 
-
-, 2 pages
+Advanced Compiler Design and Implementation
 \end_inset 
 </cell>
 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
@@ -14526,12 +15354,7 @@ C Reference Card
 
 \layout Standard
 
-
-\begin_inset LatexCommand \url{http://www.refcards.com/about/c.html}
-
-\end_inset 
-
-
+bookstore
 \end_inset 
 </cell>
 </row>
@@ -14617,7 +15440,7 @@ sdcc/doc
 
 \newline 
 
-\layout Section
+\layout Chapter
 \pagebreak_top 
 Support
 \begin_inset LatexCommand \index{Support}
@@ -14669,10 +15492,10 @@ The SDCC project is hosted on the SDCC sourceforge site at
 \end_inset 
 
  there.
-\layout Subsection
+\layout Section
 
 Reporting Bugs
-\begin_inset LatexCommand \index{Bugs}
+\begin_inset LatexCommand \index{Bug reporting}
 
 \end_inset 
 
@@ -14752,7 +15575,7 @@ Please have a short check that you are using a recent version of SDCC and
 \end_inset 
 
 .
-\layout Subsection
+\layout Section
 
 Requesting Features
 \begin_inset LatexCommand \label{sub:Requesting-Features}
@@ -14780,7 +15603,7 @@ Like bug reports feature requests are forwarded to the developer mailing
 \end_inset 
 
 .
-\layout Subsection
+\layout Section
 
 Getting Help
 \layout Standard
@@ -14807,7 +15630,7 @@ Traffic on sdcc-devel and sdcc-user is about 100 mails/month each not counting
 
 , lists and forums are archived so if you are lucky someone already had
  a similar problem.
-\layout Subsection
+\layout Section
 
 ChangeLog
 \begin_inset LatexCommand \index{Changelog}
@@ -14828,7 +15651,7 @@ You can follow the status of the cvs version
 \end_inset 
 
  in the cvs-repository.
-\layout Subsection
+\layout Section
 
 Release policy
 \begin_inset LatexCommand \index{Release policy}
@@ -14856,7 +15679,7 @@ Historically there often were long delays between official releases and
 \end_inset 
 
 .
-\layout Subsection
+\layout Section
 
 Examples
 \begin_inset LatexCommand \index{Examples}
@@ -14898,7 +15721,7 @@ I did insert a reference to Paul's web site here although it seems rather
 Maybe we should include some links to real world applications.
  Preferably pointer to pointers (one for each architecture) so this stays
  manageable here?
-\layout Subsection
+\layout Section
 
 Quality control
 \begin_inset LatexCommand \index{Quality control}
@@ -14967,10 +15790,10 @@ The pic port uses a different set of regression tests, you'll find them
 sdcc/src/regression
 \shape default 
 .
-\layout Section
+\layout Chapter
 \pagebreak_top 
 SDCC Technical Data
-\layout Subsection
+\layout Section
 
 Optimizations
 \begin_inset LatexCommand \index{Optimizations}
@@ -14983,7 +15806,7 @@ Optimizations
 SDCC performs a host of standard optimizations in addition to some MCU specific
  optimizations.
  
-\layout Subsubsection
+\layout Subsection
 
 Sub-expression Elimination
 \begin_inset LatexCommand \index{Subexpression elimination}
@@ -15040,7 +15863,7 @@ iTemp.d = 11;
 \layout Standard
 
 The compiler will try to keep these temporary variables in registers.
-\layout Subsubsection
+\layout Subsection
 
 Dead-Code Elimination
 \begin_inset LatexCommand \index{Dead-code elimination}
@@ -15112,7 +15935,7 @@ global = 2;
 return; 
 \newline 
 }
-\layout Subsubsection
+\layout Subsection
 
 Copy-Propagation
 \begin_inset LatexCommand \index{Copy propagation}
@@ -15173,7 +15996,7 @@ return 10;
 
 Note: the dead stores created by this copy propagation will be eliminated
  by dead-code elimination.
-\layout Subsubsection
+\layout Subsection
 
 Loop Optimizations
 \begin_inset LatexCommand \index{Loop optimization}
@@ -15315,7 +16138,7 @@ The more expensive multiplication
 \end_inset 
 
  is changed to a less expensive addition.
-\layout Subsubsection
+\layout Subsection
 
 Loop Reversing
 \begin_inset LatexCommand \index{Loop reversing}
@@ -15386,7 +16209,7 @@ The loop control variable does NOT participate in any arithmetic operation
 \layout Itemize
 
 There are NO switch statements in the loop.
-\layout Subsubsection
+\layout Subsection
 
 Algebraic Simplifications
 \layout Standard
@@ -15417,7 +16240,7 @@ Note the subexpressions
 
  given above are generally introduced by macro expansions or as a result
  of copy/constant propagation.
-\layout Subsubsection
+\layout Subsection
 
 'switch' Statements
 \begin_inset LatexCommand \label{sub:'switch'-Statements}
@@ -15800,7 +16623,7 @@ aries.
  It has no effect if a default label is supplied.
  Use of this pragma is dangerous: if the switch argument is not matched
  by a case statement the processor will happily jump into Nirvana.
-\layout Subsubsection
+\layout Subsection
 
 Bit-shifting Operations
 \begin_inset LatexCommand \index{Bit shifting}
 mov\SpecialChar ~
 \SpecialChar ~
 _i,a
-\layout Standard
-
-Note that SDCC stores numbers in little-endian
-\begin_inset Foot
-collapsed false
-
-\layout Standard
-
-Usually 8-bit processors don't care much about endianness.
- This is not the case for the standard 8051 which only has an instruction
- to increment its 
-\emph on 
-dptr
-\emph default 
-
-\begin_inset LatexCommand \index{DPTR}
-
-\end_inset 
-
--datapointer
-\emph on 
-\emph default 
-so little-endian is the more efficient byte order.
-\end_inset 
-
-
-\begin_inset LatexCommand \index{little-endian}
-
-\end_inset 
-
-
-\begin_inset LatexCommand \index{Endianness}
-
-\end_inset 
-
- format (i.e.
- lowest order first).
-\layout Subsubsection
+\layout Subsection
 
 Bit-rotation
 \begin_inset LatexCommand \index{Bit rotation}
@@ -15933,13 +16718,33 @@ Bit-rotation
 
 \layout Standard
 
-A special case of the bit-shift operation is bit rotation, SDCC recognizes
- the following expression to be a left bit-rotation:
+A special case of the bit-shift operation is bit rotation
+\begin_inset LatexCommand \index{rotating bits}
+
+\end_inset 
+
+, SDCC recognizes the following expression to be a left bit-rotation:
 \layout Verse
 
 
 \family typewriter 
-unsigned char i; 
+\series bold 
+unsigned
+\series default 
+\SpecialChar ~
+\SpecialChar ~
+char i;\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+/* unsigned is needed for rotation */ 
 \newline 
 ...
  
@@ -15979,7 +16784,116 @@ ns of this case will also be recognized as bit-rotation, i.e.:
 
 \family typewriter 
 i = ((i >> 7) | (i << 1)); /* left-bit rotation */
-\layout Subsubsection
+\layout Subsection
+
+Nibble and Byte Swapping
+\layout Standard
+
+Other special cases of the bit-shift operations are nibble or byte swapping
+\begin_inset LatexCommand \index{swapping nibbles/bytes}
+
+\end_inset 
+
+, SDCC recognizes the following expressions:
+\layout Verse
+
+
+\family typewriter 
+\series bold 
+unsigned
+\series default 
+\SpecialChar ~
+\SpecialChar ~
+char i; 
+\newline 
+
+\series bold 
+unsigned
+\series default 
+\SpecialChar ~
+\SpecialChar ~
+int j; 
+\newline 
+...
+\newline 
+i = ((i << 4) | (i >> 4)); 
+\family default 
+
+\newline 
+
+\family typewriter 
+j = ((j << 8) | (j >> 8)); 
+\layout Standard
+
+and generates a swap instruction for the nibble swapping
+\begin_inset LatexCommand \index{Nibble swapping}
+
+\end_inset 
+
+ or move instructions for the byte swapping
+\begin_inset LatexCommand \index{Byte swapping}
+
+\end_inset 
+
+.
+ The 
+\begin_inset Quotes sld
+\end_inset 
+
+j
+\begin_inset Quotes srd
+\end_inset 
+
+ example can be used to convert from little to big-endian or vice versa.
+ If you want to change the endianness of a 
+\emph on 
+signed
+\emph default 
+ integer you have to cast to 
+\family typewriter 
+(unsigned int)
+\family default 
+ first.
+\layout Standard
+
+Note that SDCC stores numbers in little-endian
+\begin_inset Foot
+collapsed false
+
+\layout Standard
+
+Usually 8-bit processors don't care much about endianness.
+ This is not the case for the standard 8051 which only has an instruction
+ to increment its 
+\emph on 
+dptr
+\emph default 
+
+\begin_inset LatexCommand \index{DPTR}
+
+\end_inset 
+
+-datapointer
+\emph on 
+\emph default 
+so little-endian is the more efficient byte order.
+\end_inset 
+
+
+\begin_inset LatexCommand \index{little-endian}
+
+\end_inset 
+
+
+\begin_inset LatexCommand \index{Endianness}
+
+\end_inset 
+
+ format (i.e.
+ lowest order first).
+\layout Subsection
 
 Highest Order Bit
 \begin_inset LatexCommand \index{Highest Order Bit}
@@ -16187,7 +17101,7 @@ xyz = gint + ((gint >> 15) & 1);
 \layout Standard
 
 will still be recognized.
-\layout Subsubsection
+\layout Subsection
 
 Peephole Optimizer
 \begin_inset LatexCommand \label{sub:Peephole-Optimizer}
@@ -16581,7 +17495,7 @@ status Collapsed
 \end_inset 
 
 -peep-file option.
-\layout Subsection
+\layout Section
 
 Library Routines
 \emph on 
@@ -16638,8 +17552,8 @@ If you have ported some library or want to share experience about some code
 \end_inset 
 
 C, CAN, Ethernet, Profibus, Modbus, USB, SPI, JTAG ...), Media (IDE, Memory
- cards, eeprom, flash...), En-/Decryption, remote debugging, Keyboard, LCD,
- RTC, FPGA, PID then the sdcc-user mailing list 
+ cards, eeprom, flash...), En-/Decryption, Remote debugging, Realtime kernel,
Keyboard, LCD, RTC, FPGA, PID then the sdcc-user mailing list 
 \begin_inset LatexCommand \url{http://sourceforge.net/mail/?group_id=599}
 
 \end_inset 
@@ -16649,7 +17563,7 @@ would certainly like to hear about it.
  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.
-\layout Subsection
+\layout Section
 
 External Stack
 \begin_inset LatexCommand \label{sub:External-Stack}
@@ -16722,7 +17636,7 @@ status Collapsed
 The compiler outputs the higher order address byte of the external ram segment
  into PORT P2, therefore when using the External Stack option, this port
  MAY NOT be used by the application program.
-\layout Subsection
+\layout Section
 
 ANSI-Compliance
 \begin_inset LatexCommand \index{ANSI-compliance}
@@ -16740,7 +17654,12 @@ ANSI-Compliance
 Deviations from the compliance:
 \layout Itemize
 
-functions are not always reentrant.
+functions are not always reentrant
+\begin_inset LatexCommand \index{reentrant}
+
+\end_inset 
+
+.
 \layout Itemize
 
 structures cannot be assigned values directly, cannot be passed as function
@@ -16836,7 +17755,17 @@ return rets;/* is invalid in SDCC although allowed in ANSI */
 not supported.
 \layout Itemize
 
-No support for setjmp and longjmp (for now).
+No support for setjmp
+\begin_inset LatexCommand \index{setjmp (not supported)}
+
+\end_inset 
+
+ and longjmp
+\begin_inset LatexCommand \index{longjmp (not supported)}
+
+\end_inset 
+
+ (for now).
 \layout Itemize
 
 Old K&R style
@@ -16892,7 +17821,7 @@ int (*foo)();
 \newline 
 (*foo)(); /* ANSI standard allows calls to be made like 'foo()' */
 \end_deeper 
-\layout Subsection
+\layout Section
 
 Cyclomatic Complexity
 \begin_inset LatexCommand \index{Cyclomatic complexity}
@@ -16935,10 +17864,10 @@ Having said that the industry standard is 10, you should be aware that in
  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 Subsection
+\layout Section
 
 Other Processors
-\layout Subsubsection
+\layout Subsection
 
 MCS51 variants
 \begin_inset LatexCommand \label{sub:MCS51-variants}
@@ -16960,7 +17889,12 @@ MCS51 processors are available from many vendors and come in many different
  
 \layout Subsubsection*
 
-pdata access by SFR 
+pdata access by SFR
+\begin_inset LatexCommand \index{sfr}
+
+\end_inset 
+
 \layout Standard
 
 With the upcome of devices with internal xdata and flash memory devices
@@ -16999,7 +17933,7 @@ Some MCS51 variants offer features like Double DPTR
  These are currently not used for the MCS51 port.
  If you absolutely need them you can fall back to inline assembly or submit
  a patch to SDCC.
-\layout Subsubsection
+\layout Subsection
 
 The Z80 and gbz80 port
 \layout Standard
@@ -17010,7 +17944,7 @@ SDCC can target both the Zilog
 \end_inset 
 
  and the Nintendo Gameboy's Z80-like gbz80
-\begin_inset LatexCommand \index{GameBoy Z80}
+\begin_inset LatexCommand \index{gbz80 (GameBoy Z80)}
 
 \end_inset 
 
@@ -17026,19 +17960,42 @@ regressions tests
 \emph default 
  as 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 and access to I/O
+ memory.
 \layout Standard
 
 As always, the code is the authoritative reference - see z80/ralloc.c and
  z80/gen.c.
- The stack frame is similar to that generated by the IAR Z80 compiler.
+ The stack
+\begin_inset LatexCommand \index{stack}
+
+\end_inset 
+
+ frame is similar to that generated by the IAR Z80 compiler.
  IX is used as the base pointer, HL is used as a temporary register, and
  BC and DE are available for holding variables.
  IY is currently unused.
- Return values are stored in HL.
+ Return values
+\begin_inset LatexCommand \index{return value}
+
+\end_inset 
+
+ are stored in HL.
  One bad side effect of using IX as the base pointer is that a functions
  stack frame is limited to 127 bytes - this will be fixed in a later version.
 \layout Subsection
 
+The HC08 port
+\layout Standard
+
+The port to the Motorola HC08
+\begin_inset LatexCommand \index{HC08}
+
+\end_inset 
+
+ family has been added in October 2003, thank you Erik!
+\layout Section
+
 Retargetting for other MCUs.
 \layout Standard
 
@@ -17131,15 +18088,15 @@ The Code generation phase is (unhappily), entirely MCU dependent and very
 
 As mentioned in the optimization section the peep-hole optimizer is rule
  based system, which can reprogrammed for other MCUs.
-\layout Section
-\pagebreak_top 
+\layout Chapter
+
 Compiler internals
 \begin_inset LatexCommand \index{Compiler internals}
 
 \end_inset 
 
 
-\layout Subsection
+\layout Section
 
 The anatomy of the compiler
 \begin_inset LatexCommand \label{sub:The-anatomy-of}
@@ -18474,7 +19431,7 @@ mov dpl,a
 ret
 \newline 
 
-\layout Subsection
+\layout Section
 
 A few words about basic block successors, predecessors and dominators
 \layout Standard
@@ -18532,7 +19489,7 @@ b) predList of [BB2] = [BB1], of [BB3] = [BB1], of [BB4] = [BB2,BB3]
 c) domVect of [BB4] = BB1 ...
  here we are not sure if BB2 or BB3 was executed but we are SURE that BB1
  was executed.
-\layout Section
+\layout Chapter
 
 Acknowledgments
 \layout Standard
@@ -18567,7 +19524,7 @@ All product names mentioned herein may be trademarks
 
  of their respective companies.
  
-\layout Section
+\layout Section*
 
 Alphabetical index
 \layout Standard