git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@4106 4a8a32a2...
[fw/sdcc] / doc / sdccman.lyx
index 24dc8aabed3c8eb7fffc6858950c5bddb83e794f..84c8c85a08a2223862584c4cf1fbf49d0ae69973 100644 (file)
@@ -82,7 +82,7 @@ SDCC Compiler User Guide
 
 
 \size normal 
-SDCC 2.5.0
+SDCC 2.5.5
 \size footnotesize 
 
 \newline 
@@ -91,7 +91,7 @@ $Date$
 $Revision$
 \layout Comment
 
-The above strings enclosed in $ are automatically updated by cvs
+The above strings enclosed in $ are automatically updated by Subversion
 \layout Standard
 
 
@@ -245,6 +245,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.
  
 \newline 
 
@@ -536,7 +537,8 @@ The SDCC home page at
  Some of the other tools (simulator and assembler) included with SDCC contain
  their own documentation and can be found in the source distribution.
  If you want the latest unreleased software, the complete source package
- is available directly by anonymous CVS on cvs.sdcc.sourceforge.net.
+ is available directly from Subversion on https://svn.sourceforge.net/svnroot/sdcc
+/trunk/sdcc.
 \layout Section
 
 Wishes for the future
@@ -557,8 +559,8 @@ char KernelFunction3(char p) at 0x340;
 
 
 \family typewriter 
-code banking
-\begin_inset LatexCommand \index{code banking (not supported)}
+better code banking
+\begin_inset LatexCommand \index{code banking (limited support)}
 
 \end_inset 
 
@@ -2923,7 +2925,7 @@ Building SDCC on Linux
 \series medium 
 Download the source package
 \series default 
- either from the SDCC CVS repository or from the nightly snapshots
+ either from the SDCC Subversion repository or from the nightly snapshots
 \series medium 
 , it will be named something like sdcc
 \series default 
@@ -3127,7 +3129,7 @@ less ; not really needed for building SDCC, but you'll miss it sooner or
  later
 \layout Itemize
 
-cvs ; only if you use CVS access
+svn ; only if you use Subversion access
 \layout Standard
 
 If you want to develop something you'll need:
@@ -3235,7 +3237,7 @@ Building SDCC Using Microsoft Visual C++ 6.0/NET (MSVC)
 \series medium 
 Download the source package
 \series default 
- either from the SDCC CVS repository or from the 
+ either from the SDCC Subversion repository or from the 
 \begin_inset LatexCommand \url[nightly snapshots]{http://sdcc.sourceforge.net/snap.php}
 
 \end_inset 
@@ -3268,8 +3270,10 @@ bin before running SDCC.
 \newline 
 WARNING: Visual studio is very picky with line terminations; it expects
  the 0x0d, 0x0a DOS style line endings, not the 0x0a Unix style line endings.
- If you are getting a message such as "This makefile was not generated by
- Developer Studio etc.
+ When using the Subversion repository it's easiest to configure the svn
+ client to convert automatically for you.
+ If however you are getting a message such as "This makefile was not generated
+ by Developer Studio etc.
  etc.
 \begin_inset Quotes srd
 \end_inset 
@@ -3674,11 +3678,30 @@ ate
 a
 \emph default 
 rray
-\begin_inset LatexCommand \index{fpga (field programmable gate array)}
+\begin_inset LatexCommand \index{FPGA (field programmable gate array)}
 
 \end_inset 
 
 
+\begin_inset Quotes srd
+\end_inset 
+
+ or 
+\begin_inset LatexCommand \url{http://sf.net/projects/fpgac}
+
+\end_inset 
+
+
+\begin_inset LatexCommand \index{FpgaC ((subset of) C to FPGA compiler)}
+
+\end_inset 
+
+\begin_inset Quotes sld
+\end_inset 
+
+have you ever heard of an open source compiler that compiles a subset of
+ C for an FPGA?
 \begin_inset Quotes srd
 \end_inset 
 
@@ -4118,9 +4141,11 @@ 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.
@@ -4204,6 +4229,7 @@ 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
@@ -4227,7 +4253,7 @@ Sdcdb
 \end_inset 
 
 , but can be easily changed to use other simulators.
+ Sdcdb is currently not available on Win32 platfors.
 \layout Chapter
 
 Using SDCC
@@ -5735,6 +5761,61 @@ status Collapsed
 \labelwidthstring 00.00.0000
 
 
+\series bold 
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash 
+/
+\end_inset 
+
+-xstack-loc
+\series default 
+
+\begin_inset LatexCommand \index{-\/-xstack-loc <Value>}
+
+\end_inset 
+
+\SpecialChar ~
+<Value> By default the external stack
+\begin_inset LatexCommand \index{xstack}
+
+\end_inset 
+
+ is placed after the pdata 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.
+ -
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash 
+/
+\end_inset 
+
+-xstack-loc 0x8000 or -
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash 
+/
+\end_inset 
+
+-stack-loc 32768.
+ The provided value should not overlap any other memory areas such as the
+ pdata or xdata segment and with enough space for the current application.
+\layout List
+\labelwidthstring 00.00.0000
+
+
 \series bold 
 -
 \begin_inset ERT
@@ -6043,6 +6124,33 @@ Generate code for Small Model programs, see section Memory Models for more
 \labelwidthstring 00.00.0000
 
 
+\series bold 
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash 
+/
+\end_inset 
+
+-model-medium
+\begin_inset LatexCommand \index{-\/-model-medium}
+
+\end_inset 
+
+
+\series default 
+ Generate code for Medium model programs, see section Memory Models for
+ more details.
+ If this option is used all source files in the project have to be compiled
+ with this option.
+ It must also be used when invoking the linker.
+\layout List
+\labelwidthstring 00.00.0000
+
+
 \series bold 
 -
 \begin_inset ERT
@@ -6065,6 +6173,7 @@ status Collapsed
  details.
  If this option is used all source files in the project have to be compiled
  with this option.
+ It must also be used when invoking the linker.
 \layout List
 \labelwidthstring 00.00.0000
 
@@ -7576,13 +7685,6 @@ status Collapsed
 \end_inset 
 
  (jwk burps: please be more specific here, please!).
- If you want rather more than less warnings you should consider using a
- separate tool dedicated to syntax checking like splint 
-\begin_inset LatexCommand \url{http://www.splint.org}
-
-\end_inset 
-
-.
 \layout List
 \labelwidthstring 00.00.0000
 
@@ -7702,7 +7804,7 @@ asmOption[,asmOption]
 \end_inset 
 
 .
- See file sdcc/as/doc/asxhtm.html for assembler options.
+ See file sdcc/as/doc/asxhtm.html for assembler options.cd
 \layout List
 \labelwidthstring 00.00.0000
 
@@ -7799,6 +7901,171 @@ status Collapsed
 \series default 
  Follow the C99 standard and disable SDCC features that conflict with the
  standard (incomplete support).
+\layout List
+\labelwidthstring 00.00.0000
+
+
+\series bold 
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash 
+/
+\end_inset 
+
+-codeseg
+\series default 
+
+\begin_inset LatexCommand \index{-\/-codeseg <Value>}
+
+\end_inset 
+
+\SpecialChar ~
+<Name> The name to be used for the code
+\begin_inset LatexCommand \index{code}
+
+\end_inset 
+
+ segment, default CSEG.
+ This is useful if you need to tell the compiler to put the code in a special
+ segment so you can later on tell the linker to put this segment in a special
+ place in memory.
+ Can be used for instance when using bank switching to put the code in a
+ bank.
+\layout List
+\labelwidthstring 00.00.0000
+
+
+\series bold 
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash 
+/
+\end_inset 
+
+-constseg
+\series default 
+
+\begin_inset LatexCommand \index{-\/-constseg <Value>}
+
+\end_inset 
+
+\SpecialChar ~
+<Name> The name to be used for the const
+\begin_inset LatexCommand \index{code}
+
+\end_inset 
+
+ segment, default CONST.
+ This is useful if you need to tell the compiler to put the const data in
+ a special segment so you can later on tell the linker to put this segment
+ in a special place in memory.
+ Can be used for instance when using bank switching to put the const data
+ in a bank.
+\layout List
+\labelwidthstring 00.00.0000
+
+
+\series bold 
+more-pedantic
+\series default 
+ Actually this is 
+\series bold 
+\emph on 
+not
+\series default 
+\emph default 
+ a SDCC compiler option but if you want 
+\emph on 
+more
+\emph default 
+ warnings you can use a separate tool dedicated to syntax checking like
+ splint
+\begin_inset LatexCommand \label{lyx:more-pedantic-SPLINT}
+
+\end_inset 
+
+
+\begin_inset LatexCommand \index{lint (syntax checking tool)}
+
+\end_inset 
+
+\begin_inset LatexCommand \url{http://www.splint.org}
+
+\end_inset 
+
+.
+ To make your source files parseable by splint you will have to include
+\family sans 
+lint.h
+\family default 
+
+\begin_inset LatexCommand \index{splint (syntax checking tool)}
+
+\end_inset 
+
+ in your source file and add brackets around extended keywords (like 
+\family sans 
+
+\begin_inset Quotes sld
+\end_inset 
+
+__at\SpecialChar ~
+
+\series bold 
+(
+\series default 
+0xab
+\series bold 
+)
+\series default 
+
+\begin_inset Quotes srd
+\end_inset 
+
+
+\family default 
+ and 
+\family sans 
+
+\begin_inset Quotes sld
+\end_inset 
+
+__interrupt\SpecialChar ~
+(2)
+\begin_inset Quotes srd
+\end_inset 
+
+
+\family default 
+).
+\newline 
+Splint has an excellent on line manual at 
+\begin_inset LatexCommand \url{http://www.splint.org/manual/}
+
+\end_inset 
+
+ and it's capabilities go beyond pure syntax checking.
+ You'll need to tell splint the location of SDCC's include files so a typical
+ command line could look like this: 
+\newline 
+
+\family sans 
+splint\SpecialChar ~
+-I\SpecialChar ~
+/usr/local/share/sdcc/include/mcs51/\SpecialChar ~
+\SpecialChar ~
+myprogram.c
 \layout Subsection
 
 Intermediate Dump Options
@@ -8595,7 +8862,7 @@ Paged xdata access is just as straightforward as using the other addressing
  modes of a 8051.
  It is typically located at the start of xdata and has a maximum size of
  256 bytes.
- The following example writes 0x01 to the address pointed to.
+ The following example writes 0x01 to the pdata variable.
  Please note, pdata access physically accesses xdata memory.
  The high byte of the address is determined by port P2 
 \begin_inset LatexCommand \index{P2 (mcs51 sfr)}
@@ -8609,52 +8876,30 @@ Paged xdata access is just as straightforward as using the other addressing
 \end_inset 
 
 ).
+ This is the 
+\series bold 
+default
+\series default 
+ storage class for the Medium Memory model, e.g.:
 \layout Verse
 
 
 \family typewriter 
-pdata unsigned char *test_pdata_ptr;
-\newline 
-
-\newline 
-void main() 
-\newline 
-{ 
-\newline 
-\SpecialChar ~
-\SpecialChar ~
-\SpecialChar ~
-\SpecialChar ~
-test_pdata_ptr = (pdata *)0xfe; 
-\newline 
-\SpecialChar ~
-\SpecialChar ~
-\SpecialChar ~
-\SpecialChar ~
-*test_pdata_ptr = 1; 
-\newline 
-} 
+pdata unsigned char test_pdata;
 \layout Standard
 
-Generates the assembly code:
+Writing 0x01 to this variable generates the assembly code:
 \layout Verse
 
 
 \family typewriter 
-75*01 FE\SpecialChar ~
-\SpecialChar ~
-\SpecialChar ~
-mov\SpecialChar ~
- _test_pdata_ptr,#0xFE
-\newline 
-78 FE\SpecialChar ~
+78r00\SpecialChar ~
 \SpecialChar ~
 \SpecialChar ~
 \SpecialChar ~
 \SpecialChar ~
 \SpecialChar ~
-mov\SpecialChar ~
- r0,#0xFE 
+mov r0,#_test_pdata
 \newline 
 74 01\SpecialChar ~
 \SpecialChar ~
@@ -8662,8 +8907,7 @@ mov\SpecialChar ~
 \SpecialChar ~
 \SpecialChar ~
 \SpecialChar ~
-mov\SpecialChar ~
- a,#0x01
+mov a,#0x01 
 \newline 
 F2\SpecialChar ~
 \SpecialChar ~
@@ -8674,7 +8918,7 @@ F2\SpecialChar ~
 \SpecialChar ~
 \SpecialChar ~
 \SpecialChar ~
-movx @r0,a 
+movx @r0,a
 \layout Standard
 
 If the -
@@ -8872,6 +9116,26 @@ sfr
 
 \begin_inset LatexCommand \index{\_\_sfr}
 
+\end_inset 
+
+ / sfr16
+\begin_inset LatexCommand \index{sfr16}
+
+\end_inset 
+
+
+\begin_inset LatexCommand \index{\_\_sfr16}
+
+\end_inset 
+
+ / sfr32
+\begin_inset LatexCommand \index{sfr32}
+
+\end_inset 
+
+
+\begin_inset LatexCommand \index{\_\_sfr32}
+
 \end_inset 
 
  / sbit
@@ -8884,10 +9148,10 @@ sfr
 
 Like the bit keyword, 
 \emph on 
-sfr / sbit 
+sfr / sfr16 / sfr32 / sbit 
 \emph default 
-signifies both a data-type and storage class, they are used to describe
- the 
+signify both a data-type and storage class, they are used to describe the
 \emph on 
 s
 \emph default 
@@ -8925,7 +9189,24 @@ sfr at
  0x80 P0;\SpecialChar ~
  /* special function register P0 at location 0x80 */
 \newline 
-sbit at 0xd7 CY; /* CY (Carry Flag
+/* 16 bit special function register combination for timer 0 */
+\newline 
+/* with the high byte at location 0x8C and the low byte at location 0x8A
+ */
+\newline 
+sfr16 at
+\begin_inset LatexCommand \index{at}
+
+\end_inset 
+
+
+\begin_inset LatexCommand \index{\_\_at}
+
+\end_inset 
+
+ 0x8C8A TMR0;
+\newline 
+sbit at 0xd7 CY; /* CY (Carry Flag
 \begin_inset LatexCommand \index{Flags}
 
 \end_inset 
@@ -8944,6 +9225,19 @@ Special function registers which are located on an address dividable by
  sbit
 \emph default 
  addresses a specific bit within these sfr.
+\newline 
+16 Bit and 32 bit special function register combinations which require a
+ certain access order are better not declared using 
+\emph on 
+sfr16
+\emph default 
+ or 
+\emph on 
+sfr32.
+
+\emph default 
+ Allthough SDCC usually accesses them Least Significant Byte (LSB) first,
+ this is not guaranteed.
 \layout Subsubsection
 
 Pointers
@@ -9001,6 +9295,13 @@ code unsigned char * code p;
  */
 \newline 
 char * xdata p;
+\newline 
+
+\newline 
+/* the following is a function pointer physically located in data space
+ */
+\newline 
+char (* data fp)(void);
 \layout Standard
 
 Well you get the idea.
@@ -10212,6 +10513,13 @@ Parameters
 
 , (storage classes for parameters will be ignored), their allocation is
  governed by the memory model in use, and the reentrancy options.
+\layout Standard
+
+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.
 \layout Section
 
 Overlaying
@@ -10654,7 +10962,13 @@ nooverlay
  if it is not reentrant.
  Furthermore nonreentrant functions should not be called from the main program
  while the interrupt service routine might be active.
+ They also must not be called from low priority interrupt service routines
+ while a high priority interrupt service routine might be active.
+ You could use semaphores or make the function
+\emph on 
+ critical
+\emph default 
+ if all parameters are passed in registers.
 \newline 
 
 \newline 
@@ -14534,12 +14848,12 @@ MCS51 Memory Models
 
 \layout Subsubsection
 
-Small and Large
+Small, Medium and Large
 \layout Standard
 
-SDCC allows two memory models for MCS51 code, 
+SDCC allows three memory models for MCS51 code, 
 \shape slanted 
-small
+small, medium
 \shape default 
  and 
 \shape slanted 
@@ -14551,16 +14865,15 @@ large
 never
 \emph default 
  be combined together or the results would be unpredictable.
- The library routines supplied with the compiler are compiled as both small
- and large.
- The compiled library modules are contained in separate directories as small
- and large so that you can link to either set.
+ The library routines supplied with the compiler are compiled as small,
+ medium and large.
+ The compiled library modules are contained in separate directories as small,
+ medium and large so that you can link to the appropriate set.
 \layout Standard
 
-When the large model is used all variables declared without a storage class
- will be allocated into the external ram, this includes all parameters and
- local variables (for non-reentrant
+When the medium or large model is used all variables declared without a
+ storage class will be allocated into the external ram, this includes all
parameters and local variables (for non-reentrant
 \begin_inset LatexCommand \index{reentrant}
 
 \end_inset 
@@ -15098,6 +15411,24 @@ std_c99
 
 - Follow the C99 standard and disable SDCC features that conflict with the
  standard (incomplete support).
+\layout Itemize
+
+codeseg <name>
+\begin_inset LatexCommand \index{\#pragma codeseg}
+
+\end_inset 
+
+- Use this name (max.
+ 8 characters) for the code segment.
+\layout Itemize
+
+constseg <name>
+\begin_inset LatexCommand \index{\#pragma constseg}
+
+\end_inset 
+
+- Use this name (max.
+ 8 characters) for the const segment.
 \layout Standard
 
 SDCPP supports the following #pragma directives:
@@ -15210,7 +15541,7 @@ The compiler creates the following #defines
 
 
 \begin_inset  Tabular
-<lyxtabular version="3" rows="10" columns="2">
+<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">
@@ -15411,6 +15742,43 @@ status Collapsed
 
 \layout Standard
 
+SDCC_MODEL_MEDIUM
+\begin_inset LatexCommand \index{SDCC\_MODEL\_MEDIUM}
+
+\end_inset 
+
+
+\end_inset 
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+when 
+\emph on 
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash 
+/
+\end_inset 
+
+-model-medium
+\emph default 
+ is used
+\end_inset 
+</cell>
+</row>
+<row topline="true">
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
 SDCC_MODEL_LARGE
 \begin_inset LatexCommand \index{SDCC\_MODEL\_LARGE}
 
@@ -15888,7 +16256,7 @@ $(PRJ).hex: $(OBJS)
 \SpecialChar ~
 \SpecialChar ~
 \SpecialChar ~
-gplink -m -s $(PRJ).lkr -o $(PRJ).hex $(OBJS)
+gplink -m -s $(PRJ).lkr -o $(PRJ).hex $(OBJS) libsdcc.lib
 \layout Standard
 
 Here is a 
@@ -15934,7 +16302,7 @@ $(PRJ).hex: $(OBJS)
 \SpecialChar ~
 \SpecialChar ~
 \SpecialChar ~
-mplink /v $(PRJ).lkr /m $(PRJ).map /o $(PRJ).hex $(OBJS)
+mplink /v $(PRJ).lkr /m $(PRJ).map /o $(PRJ).hex $(OBJS) libsdcc.lib
 \layout Standard
 
 Please note that indentations within a
@@ -15942,6 +16310,131 @@ Please note that indentations within a
  Makefile
 \family default 
  have to be done with a tabulator character.
+\layout Subsection
+
+Command-line options
+\layout Standard
+
+Besides the switches common to all SDCC backends, the PIC14 port accepts
+ the following options (for an updated list see sdcc -
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash 
+/
+\end_inset 
+
+-help):
+\layout List
+\labelwidthstring 00.00.0000
+
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash 
+/
+\end_inset 
+
+-debug-extra 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 disable (slightly faulty) optimization on pCode
+\layout Subsection
+
+The library
+\layout Subsubsection
+
+error: missing definition for symbol 
+\begin_inset Quotes sld
+\end_inset 
+
+__gptrget1
+\begin_inset Quotes srd
+\end_inset 
+
+
+\layout Standard
+
+The PIC14 port uses library routines to provide more complex operations
+ like multiplication, division/modulus and (generic) pointer dereferencing.
+ In order to add these routines to your project, you must link with PIC14's
+\family typewriter 
+libsdcc.lib
+\family default 
+.
+ For single source file projects this is done automatically, more complex
+ projects must add 
+\family typewriter 
+libsdcc.lib
+\family default 
+ to the linker's arguments.
+ Make sure you also add an include path for the library (using the -I switch
+ to the linker)!
+\layout Subsubsection
+
+Processor mismatch in file 
+\begin_inset Quotes sld
+\end_inset 
+
+XXX
+\begin_inset Quotes srd
+\end_inset 
+
+.
+\layout Standard
+
+This warning can usually be ignored due to the very good compatibility amongst
+ 14 bit PIC devices.
+\layout Standard
+
+You might also consider recompiling the library for your specific device
+ by changing the ARCH=p16f877 (default target) entry in 
+\family typewriter 
+device/lib/pic/Makefile.in
+\family default 
+ and 
+\family typewriter 
+device/lib/pic/Makefile
+\family default 
+ to reflect your device.
+ This might even improve performance for smaller devices as unneccesary
+ BANKSELs migth be removed.
+\layout Subsection
+
+Known bugs
+\layout Subsubsection
+
+initialized data
+\layout Standard
+
+Currently, data can only be initialized if it resides in the source file
+ together with 
+\emph on 
+main()
+\emph default 
+.
+ Data in other source files will silently 
+\series bold 
+not
+\series default 
+ be initialized.
 \layout Section
 
 The PIC16
@@ -16417,6 +16910,20 @@ status Collapsed
 /
 \end_inset 
 
+-optimize-df Analyze the dataflow of the generated code and improve it.
+\layout List
+\labelwidthstring 00.00.0000
+
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash 
+/
+\end_inset 
+
 -obanksel=nn Set optimization level for inserting BANKSELs.
 \newline 
 
@@ -19632,7 +20139,7 @@ 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 available on Unix platforms only.
+ Sdcdb is currently not available on Win32 platforms.
 \layout Section
 
 Compiling for Debugging
@@ -19731,7 +20238,7 @@ foo.ihx - the Intel hex format
  object file.
 \layout Section
 
-Command Line Options.
+Command Line Options
 \layout Itemize
 
 -
@@ -19798,15 +20305,15 @@ status Collapsed
 -k <port number> passed to simulator see the simulator docs for details.
 \layout Section
 
-Debugger Commands.
+Debugger Commands
 \layout Standard
 
 As mentioned earlier the command interface for the debugger has been deliberatel
 y kept as close the GNU debugger gdb, as possible.
  This will help the integration with existing graphical user interfaces
  (like ddd, xxgdb or xemacs) existing for the GNU debugger.
- If you use a graphical user interface for the debugger you can skip the
next sections.
+ If you use a graphical user interface for the debugger you can skip this
section.
 \layout Subsubsection*
 
 break [line | file:line | function | file:function]
@@ -19949,6 +20456,91 @@ quit
  My name is Bobby Brown"
 \layout Section
 
+Interfacing with DDD
+\layout Comment
+
+The screenshot was converted from png to eps with: 
+\begin_inset Quotes sld
+\end_inset 
+
+bmeps -c -e8f -p3 ddd_example.png >ddd_example.eps
+\begin_inset Quotes srd
+\end_inset 
+
+ which produces a pretty compact eps file which is free from compression
+ artifacts.
+\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).
+\layout Standard
+
+The .eps File 
+\size footnotesize 
+
+\begin_inset LatexCommand \url{http://cvs.sourceforge.net/viewcvs.py/*checkout*/sdcc/sdcc/doc/figures/ddd_example.eps}
+
+\end_inset 
+
+
+\size default 
+ shows a screenshot of a debugging session with DDD
+\begin_inset LatexCommand \index{DDD (debugger)}
+
+\end_inset 
+
+ (Unix only) on a simulated 8032.
+ The debugging session might not run as smoothly as the screenshot suggests.
+ The debugger allows setting of breakpoints, displaying and changing variables,
+ single stepping through C and assembler code.
+\newline 
+The source was compiled with 
+\family sans 
+\series bold 
+
+\newline 
+
+\newline 
+sdcc -
+\family default 
+\series default 
+
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash 
+/
+\end_inset 
+
+
+\family sans 
+\series bold 
+-debug ddd_example.c
+\family default 
+\series default 
+\family sans 
+\series bold 
+
+\newline 
+
+\family default 
+\series default 
+
+\newline 
+and DDD was invoked with 
+\family sans 
+\series bold 
+
+\newline 
+
+\newline 
+ddd -debugger 'sdcdb -cpu 8032 ddd_example'
+\layout Section
+
 Interfacing with XEmacs
 \begin_inset LatexCommand \index{XEmacs}
 
@@ -19959,7 +20551,7 @@ Interfacing with XEmacs
 
 \end_inset 
 
-.
+
 \layout Standard
 
 Two files (in emacs lisp) are provided for the interfacing with XEmacs,
@@ -21005,7 +21597,7 @@ Tools
 <features>
 <column alignment="center" valignment="top" leftline="true" width="0pt">
 <column alignment="center" valignment="top" leftline="true" width="0pt">
-<column alignment="center" valignment="top" leftline="true" rightline="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">
 \begin_inset Text
@@ -21687,7 +22279,7 @@ Related open source tools
 <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" rightline="true" width="0pt">
 <row topline="true" bottomline="true">
 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
 \begin_inset Text
@@ -22006,7 +22598,12 @@ splint
 
 \layout Standard
 
-Statically checks c sources (has anyone adapted splint for SDCC?)
+Statically checks c sources (see 
+\begin_inset LatexCommand \ref{lyx:more-pedantic-SPLINT}
+
+\end_inset 
+
+)
 \end_inset 
 </cell>
 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
@@ -22376,7 +22973,7 @@ The SDCC project is hosted on the SDCC sourceforge site at
 
 \end_inset 
 
- area and cvs code repository
+ area and Subversion code repository
 \begin_inset LatexCommand \index{cvs code repository}
 
 \end_inset 
@@ -22594,7 +23191,7 @@ Traffic on sdcc-devel and sdcc-user is about 100 mails/month each not counting
 ChangeLog
 \layout Standard
 
-You can follow the status of the cvs version
+You can follow the status of the Subversion version
 \begin_inset LatexCommand \index{version}
 
 \end_inset 
@@ -22609,7 +23206,7 @@ You can follow the status of the cvs version
 
 \size footnotesize 
 
-\begin_inset LatexCommand \htmlurl{http://cvs.sf.net/cgi-bin/viewcvs.cgi/*checkout*/sdcc/sdcc/ChangeLog?rev=HEAD&content-type=text/plain}
+\begin_inset LatexCommand \htmlurl{http://svn.sourceforge.net/viewcvs.cgi/*checkout*/sdcc/trunk/sdcc/ChangeLog}
 
 \end_inset 
 
@@ -22763,6 +23360,132 @@ The pic port uses a different set of regression tests, you'll find them
 sdcc/src/regression
 \shape default 
 .
+\layout Section
+
+Use of SDCC in Education
+\layout Standard
+
+In short: 
+\emph on 
+highly
+\emph default 
+ encouraged
+\begin_inset Foot
+collapsed false
+
+\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
+\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}
+
+\end_inset 
+
+, 
+\begin_inset LatexCommand \url[Oregano]{http://www.oregano.at/ip/ip01.htm}
+
+\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
+
+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}
+
+\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}
+
+\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}
+
+\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://wiki.laptop.org/wiki/One_Laptop_per_Child}
+
+\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
@@ -24158,6 +24881,11 @@ so little-endian is the more efficient byte order.
 Highest Order Bit
 \begin_inset LatexCommand \index{Highest Order Bit}
 
+\end_inset 
+
+ / Any Order Bit
+\begin_inset LatexCommand \index{Any Order Bit}
+
 \end_inset 
 
 
@@ -24165,7 +24893,8 @@ Highest Order Bit
 
 It is frequently required to obtain the highest order bit of an integral
  type (long, int, short or char types).
- SDCC recognizes the following expression to yield the highest order bit
+ Also obtaining any other order bit is not uncommon.
+ SDCC recognizes the following expressions to yield the highest order bit
  and generates optimized code for it, e.g.:
 \layout Verse
 
@@ -24179,7 +24908,11 @@ foo () {
 \newline 
 \SpecialChar ~
 \SpecialChar ~
-unsigned char hob; 
+unsigned char hob1, aob1; 
+\newline 
+\SpecialChar ~
+\SpecialChar ~
+bit hob2, hob3, aob2, aob3; 
 \newline 
 \SpecialChar ~
 \SpecialChar ~
@@ -24188,7 +24921,27 @@ unsigned char hob;
 \newline 
 \SpecialChar ~
 \SpecialChar ~
-hob = (gint >> 15) & 1; 
+hob1 = (gint >> 15) & 1; 
+\newline 
+\SpecialChar ~
+\SpecialChar ~
+hob2 = (gint >> 15) & 1; 
+\newline 
+\SpecialChar ~
+\SpecialChar ~
+hob3 = gint & 0x8000; 
+\newline 
+\SpecialChar ~
+\SpecialChar ~
+aob1 = (gint >> 9) & 1; 
+\newline 
+\SpecialChar ~
+\SpecialChar ~
+aob2 = (gint >> 8) & 1; 
+\newline 
+\SpecialChar ~
+\SpecialChar ~
+aob3 = gint & 0x0800; 
 \newline 
 \SpecialChar ~
 \SpecialChar ~
@@ -24341,106 +25094,1010 @@ will generate the following code:
 \SpecialChar ~
  mov\SpecialChar ~
 \SpecialChar ~
- _foo_hob_1_1,a
-\layout Standard
-
-Variations of this case however will 
-\emph on 
-not
-\emph default 
- be recognized.
- It is a standard C expression, so I heartily recommend this be the only
- way to get the highest order bit, (it is portable).
- Of course it will be recognized even if it is embedded in other expressions,
- e.g.:
-\layout Verse
-
-
-\family typewriter 
-xyz = gint + ((gint >> 15) & 1);
-\layout Standard
-
-will still be recognized.
-\layout Subsection
-
-Peephole Optimizer
-\begin_inset LatexCommand \label{sub:Peephole-Optimizer}
-
-\end_inset 
-
-
-\begin_inset LatexCommand \index{Peephole optimizer}
-
-\end_inset 
-
-
-\layout Standard
-
-The compiler uses a rule based, pattern matching and re-writing mechanism
- for peep-hole optimization.
- It is inspired by 
-\emph on 
-copt
-\emph default 
- a peep-hole optimizer by Christopher W.
- Fraser (cwfraser\SpecialChar ~
-@\SpecialChar ~
-microsoft.com).
- A default set of rules are compiled into the compiler, additional rules
- may be added with the 
-\emph on 
--
-\begin_inset ERT
-status Collapsed
-
-\layout Standard
-
-\backslash 
-/
-\end_inset 
-
--peep-file
-\begin_inset LatexCommand \index{-\/-peep-file}
-
-\end_inset 
-
- <filename>
-\emph default 
- option.
- The rule language is best illustrated with examples.
-\layout Verse
-
-
-\family typewriter 
-replace { 
+ _foo_hob1_1_1,a 
 \newline 
 \SpecialChar ~
 \SpecialChar ~
-mov %1,a 
-\newline 
 \SpecialChar ~
 \SpecialChar ~
-mov a,%1
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+ 66 ;\SpecialChar ~
+ hob.c 8 
 \newline 
-} by {
+0011 E5*01\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+ 67\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+ mov\SpecialChar ~
+\SpecialChar ~
+ a,(_gint + 1) 
 \newline 
+0013 33\SpecialChar ~
 \SpecialChar ~
 \SpecialChar ~
-mov %1,a
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+ 68\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+ rlc\SpecialChar ~
+\SpecialChar ~
+ a 
 \newline 
-}
-\layout Standard
-
-The above rule will change the following assembly
-\begin_inset LatexCommand \index{Assembler routines}
-
-\end_inset 
-
- sequence:
-\layout Verse
-
-
-\family typewriter 
+0014 92*00\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+ 69\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+ mov\SpecialChar ~
+\SpecialChar ~
+ _foo_hob2_1_1,c 
+\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 ~
+ 66 ;\SpecialChar ~
+ hob.c 9 
+\newline 
+0016 E5*01\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+ 67\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+ mov\SpecialChar ~
+\SpecialChar ~
+ a,(_gint + 1) 
+\newline 
+0018 33\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+ 68\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+ rlc\SpecialChar ~
+\SpecialChar ~
+ a 
+\newline 
+0019 92*01\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+ 69\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+ mov\SpecialChar ~
+\SpecialChar ~
+ _foo_hob3_1_1,c 
+\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 ~
+ 70 ;\SpecialChar ~
+ hob.c 10 
+\newline 
+001B E5*01\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+ 71\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+ mov\SpecialChar ~
+\SpecialChar ~
+ a,(_gint + 1) 
+\newline 
+001D 03\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+ 72\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+ rr\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+ a 
+\newline 
+001E 54 01\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+ 73\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+ anl\SpecialChar ~
+\SpecialChar ~
+ a,#0x01 
+\newline 
+0020 F5*03\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+ 74\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+ mov\SpecialChar ~
+\SpecialChar ~
+ _foo_aob1_1_1,a 
+\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 ~
+ 75 ;\SpecialChar ~
+ hob.c 11 
+\newline 
+0022 E5*01\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+ 76\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+ mov\SpecialChar ~
+\SpecialChar ~
+ a,(_gint + 1) 
+\newline 
+0024 13\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+ 77\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+ rrc\SpecialChar ~
+\SpecialChar ~
+ a 
+\newline 
+0025 92*02\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+ 78\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+ mov\SpecialChar ~
+\SpecialChar ~
+ _foo_aob2_1_1,c 
+\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 ~
+ 79 ;\SpecialChar ~
+ hob.c 12 
+\newline 
+0027 E5*01\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+ 80\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+ mov\SpecialChar ~
+\SpecialChar ~
+ a,(_gint + 1) 
+\newline 
+0029 A2 E3\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+ 81\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+ mov\SpecialChar ~
+\SpecialChar ~
+ c,acc[3] 
+\newline 
+002B 92*03\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+ 82\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+ mov\SpecialChar ~
+\SpecialChar ~
+ _foo_aob3_1_1,c 
+\layout Standard
+
+Other variations of these cases however will 
+\emph on 
+not
+\emph default 
+ be recognized.
+ They are standard C expressions, so I heartily recommend these be the only
+ way to get the highest order bit, (it is portable).
+ Of course it will be recognized even if it is embedded in other expressions,
+ e.g.:
+\layout Verse
+
+
+\family typewriter 
+xyz = gint + ((gint >> 15) & 1);
+\layout Standard
+
+will still be recognized.
+\layout Subsection
+
+Higher Order Byte
+\begin_inset LatexCommand \index{Higher Order Byte}
+
+\end_inset 
+
+ / Higher Order Word
+\begin_inset LatexCommand \index{Higher Order Word}
+
+\end_inset 
+
+
+\layout Standard
+
+It is also frequently required to obtain a higher order byte or word of
+ a larger integral type (long, int or short types).
+ SDCC recognizes the following expressions to yield the higher order byte
+ or word and generates optimized code for it, e.g.:
+\layout Verse
+
+
+\family typewriter 
+unsigned int gint; 
+\newline 
+unsigned long int glong; 
+\newline 
+
+\newline 
+foo () { 
+\newline 
+\SpecialChar ~
+\SpecialChar ~
+unsigned char hob1, hob2; 
+\newline 
+\SpecialChar ~
+\SpecialChar ~
+unsigned int how1, how2; 
+\newline 
+\SpecialChar ~
+\SpecialChar ~
+...
+\newline 
+\SpecialChar ~
+\SpecialChar ~
+hob1 = (gint >> 8) & 0xFF; 
+\newline 
+\SpecialChar ~
+\SpecialChar ~
+hob2 = glong >> 24; 
+\newline 
+\SpecialChar ~
+\SpecialChar ~
+how1 = (glong >> 16) & 0xFFFF; 
+\newline 
+\SpecialChar ~
+\SpecialChar ~
+how2 = glong >> 8; 
+\newline 
+\SpecialChar ~
+\SpecialChar ~
+..
+\newline 
+}
+\layout Standard
+
+will generate the following code:
+\layout Verse
+
+
+\family typewriter 
+\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 ~
+ 91 ;\SpecialChar ~
+ hob.c 15 
+\newline 
+0037 85*01*06\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+ 92\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+ mov\SpecialChar ~
+\SpecialChar ~
+ _foo_hob1_1_1,(_gint + 1) 
+\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 ~
+ 93 ;\SpecialChar ~
+ hob.c 16 
+\newline 
+003A 85*05*07\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+ 94\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+ mov\SpecialChar ~
+\SpecialChar ~
+ _foo_hob2_1_1,(_glong + 3) 
+\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 ~
+ 95 ;\SpecialChar ~
+ hob.c 17 
+\newline 
+003D 85*04*08\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+ 96\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+ mov\SpecialChar ~
+\SpecialChar ~
+ _foo_how1_1_1,(_glong + 2) 
+\newline 
+0040 85*05*09\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+ 97\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+ mov\SpecialChar ~
+\SpecialChar ~
+ (_foo_how1_1_1 + 1),(_glong + 3) 
+\newline 
+0043 85*03*0A\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+ 98\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+ mov\SpecialChar ~
+\SpecialChar ~
+ _foo_how2_1_1,(_glong + 1) 
+\newline 
+0046 85*04*0B\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+ 99\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+ mov\SpecialChar ~
+\SpecialChar ~
+ (_foo_how2_1_1 + 1),(_glong + 2) 
+\layout Standard
+
+Again, variations of these cases may 
+\emph on 
+not
+\emph default 
+ be recognized.
+ They are standard C expressions, so I heartily recommend these be the only
+ way to get the higher order byte/word, (it is portable).
+ Of course it will be recognized even if it is embedded in other expressions,
+ e.g.:
+\layout Verse
+
+
+\family typewriter 
+xyz = gint + ((gint >> 8) & 0xFF);
+\layout Standard
+
+will still be recognized.
+\layout Subsection
+
+Peephole Optimizer
+\begin_inset LatexCommand \label{sub:Peephole-Optimizer}
+
+\end_inset 
+
+
+\begin_inset LatexCommand \index{Peephole optimizer}
+
+\end_inset 
+
+
+\layout Standard
+
+The compiler uses a rule based, pattern matching and re-writing mechanism
+ for peep-hole optimization.
+ It is inspired by 
+\emph on 
+copt
+\emph default 
+ a peep-hole optimizer by Christopher W.
+ Fraser (cwfraser\SpecialChar ~
+@\SpecialChar ~
+microsoft.com).
+ A default set of rules are compiled into the compiler, additional rules
+ may be added with the 
+\emph on 
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash 
+/
+\end_inset 
+
+-peep-file
+\begin_inset LatexCommand \index{-\/-peep-file}
+
+\end_inset 
+
+ <filename>
+\emph default 
+ option.
+ The rule language is best illustrated with examples.
+\layout Verse
+
+
+\family typewriter 
+replace { 
+\newline 
+\SpecialChar ~
+\SpecialChar ~
+mov %1,a 
+\newline 
+\SpecialChar ~
+\SpecialChar ~
+mov a,%1
+\newline 
+} by {
+\newline 
+\SpecialChar ~
+\SpecialChar ~
+mov %1,a
+\newline 
+}
+\layout Standard
+
+The above rule will change the following assembly
+\begin_inset LatexCommand \index{Assembler routines}
+
+\end_inset 
+
+ sequence:
+\layout Verse
+
+
+\family typewriter 
 mov r1,a 
 \newline 
 mov a,r1
@@ -24874,6 +26531,18 @@ return rets;/* is invalid in SDCC although allowed in ANSI */
 \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}; /* 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)}
 
@@ -24900,19 +26569,6 @@ return rets;/* is invalid in SDCC although allowed in ANSI */
 not supported.
 \layout Itemize
 
-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
 \begin_inset LatexCommand \index{K\&R style}
 
@@ -24941,6 +26597,26 @@ int i,j; /* are valid in ANSI but not valid in SDCC */
 \end_deeper 
 \layout Itemize
 
+Most enhancements in C99 are not supported, f.e.:
+\begin_deeper 
+\layout Verse
+
+
+\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