* .version: bumped version number to 2.4.8
[fw/sdcc] / doc / sdccman.lyx
index 38912811c34aee324232f8201e76a89e40655a23..2c211266192251a6999ab64d8248df7701c1c7db 100644 (file)
@@ -3,6 +3,7 @@
 \textclass book
 \begin_preamble
 
+
 \usepackage[
   pdftitle={SDCC Compiler User Guide},
   pdfauthor={SDCC development team},
@@ -82,7 +83,7 @@ SDCC Compiler User Guide
 
 
 \size normal 
-SDCC 2.4.2
+SDCC 2.4.7
 \size footnotesize 
 
 \newline 
@@ -128,7 +129,8 @@ C
 \emph on 
 C
 \emph default 
-ompiler) is a Freeware, retargettable, optimizing ANSI-C compiler by 
+ompiler) is an open source, retargettable, optimizing ANSI-C compiler by
 \series bold 
 Sandeep Dutta
 \series default 
@@ -143,7 +145,17 @@ Sandeep Dutta
  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.
- SDCC uses ASXXXX & ASLINK, a Freeware, retargettable assembler & linker.
+ SDCC uses ASXXXX
+\begin_inset LatexCommand \index{asXXXX (as-gbz80, as-hc08, asx8051, as-z80)}
+
+\end_inset 
+
+ & ASLINK
+\begin_inset LatexCommand \index{aslink}
+
+\end_inset 
+
+, an open source retargettable assembler & linker.
  SDCC has extensive language extensions suitable for utilizing various microcont
 rollers and underlying hardware effectively.
  
@@ -274,7 +286,7 @@ Open Source
 
 All packages used in this compiler system are 
 \emph on 
-opensource
+open source
 \emph default 
  and 
 \emph on 
@@ -1957,6 +1969,21 @@ make install prefix=$(HOME)/local/sdcc
 \layout Standard
 
 Of course this doesn't change the search paths compiled into the binaries.
+\newline 
+
+\newline 
+Moreover the install path can be changed by defining DESTDIR
+\begin_inset LatexCommand \index{DESTDIR}
+
+\end_inset 
+
+:
+\layout LyX-Code
+
+make install DESTDIR=$(HOME)/sdcc.rpm/
+\layout Standard
+
+Please note that DESTDIR must have a trailing slash!
 \layout Section
 
 Search Paths
@@ -3132,11 +3159,14 @@ 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
-\begin_inset LatexCommand \index{tabulator spacing (8)}
+\begin_inset LatexCommand \index{tabulator spacing (8 columns)}
 
 \end_inset 
 
  used in the project is 8.
+ Although a tabulator spacing of 8 is a sensible choice for programmers
+ (it's a power of 2 and allows to display 8/16 bit signed variables without
+ loosing columns) the plan is to move towards using only spaces in the source.
 \layout Subsection
 
 Building SDCC Using Microsoft Visual C++ 6.0/NET (MSVC)
@@ -6013,7 +6043,33 @@ status Collapsed
 
 \end_inset 
 
- Causes the linker use unused register banks for data variables or stack.
+ Causes the linker to use unused register banks for data variables and pack
+ data, idata and stack together.
+ This is the default now.
+\layout List
+\labelwidthstring 00.00.0000
+
+
+\series bold 
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash 
+/
+\end_inset 
+
+-no-pack-iram
+\series default 
+\SpecialChar ~
+
+\begin_inset LatexCommand \index{-\/-pack-iram}
+
+\end_inset 
+
+ Causes the linker to use old style for allocating memory areas.
 \layout Subsection
 
 DS390 / DS400 Options
@@ -6669,7 +6725,7 @@ status Collapsed
 
 
 \series default 
 Pass the inline assembler code through the peep hole optimizer.
+ Pass the inline assembler code through the peep hole optimizer.
  This can cause unexpected changes to inline assembler code, please go through
  the peephole optimizer
 \begin_inset LatexCommand \index{Peephole optimizer}
@@ -6678,6 +6734,54 @@ status Collapsed
 
  rules defined in the source file tree '<target>/peeph.def' before using
  this option.
+\layout List
+\labelwidthstring 00.00.0000
+
+
+\series bold 
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash 
+/
+\end_inset 
+
+-opt-code-speed
+\begin_inset LatexCommand \index{-\/-opt-code-speed}
+
+\end_inset 
+
+
+\series default 
+ The compiler will optimize code generation towards fast code, possibly
+ at the expense of code size.
+\layout List
+\labelwidthstring 00.00.0000
+
+
+\series bold 
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash 
+/
+\end_inset 
+
+-opt-code-size
+\begin_inset LatexCommand \index{-\/-opt-code-size}
+
+\end_inset 
+
+
+\series default 
+ The compiler will optimize code generation towards compact code, possibly
+ at the expense of code speed.
 \layout Subsection
 
 Other Options
@@ -6827,6 +6931,7 @@ reentrant
  Parameters and Local Variables for more details.
  If this option is used all source files in the project should be compiled
  with this option.
+ It automatically implies --int-long-reent and --float-reent.
  
 \layout List
 \labelwidthstring 00.00.0000
@@ -6909,7 +7014,7 @@ callee_saves
 \series bold 
 -
 \begin_inset ERT
-status Open
+status Collapsed
 
 \layout Standard
 
@@ -7106,8 +7211,8 @@ status Collapsed
 /
 \end_inset 
 
--nostdincl
-\begin_inset LatexCommand \index{-\/-nostdincl}
+-nostdinc
+\begin_inset LatexCommand \index{-\/-nostdinc}
 
 \end_inset 
 
@@ -7289,6 +7394,30 @@ status Collapsed
 \labelwidthstring 00.00.0000
 
 
+\series bold 
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash 
+/
+\end_inset 
+
+-disable-warning\SpecialChar ~
+<nnnn>
+\begin_inset LatexCommand \index{-\/-disable-warning}
+
+\end_inset 
+
+
+\series default 
+ Disable specific warning with number <nnnn>.
+\layout List
+\labelwidthstring 00.00.0000
+
+
 \series bold 
 -
 \begin_inset ERT
@@ -8143,8 +8272,10 @@ pdata
 
 \layout Standard
 
-Paged xdata access is currently not as straightforward as using the other
- addressing modes of a 8051.
+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.
  Please note, pdata access physically accesses xdata memory.
  The high byte of the address is determined by port P2 
@@ -8227,7 +8358,7 @@ F2\SpecialChar ~
 movx @r0,a 
 \layout Standard
 
-Be extremely carefull if you use pdata together with the -
+If the -
 \begin_inset ERT
 status Collapsed
 
@@ -8242,7 +8373,8 @@ status Collapsed
 
 \end_inset 
 
- option.
+ option is used the pdata memory area is followed by the xstack memory area
+ and the sum of their sizes is limited to 256 bytes.
 \layout Subsubsection
 
 code
@@ -8673,14 +8805,15 @@ data
 
  grows, it will use up the remaining register banks, and the 16 bytes used
  by the 128 bit variables, and 80 bytes for general purpose use.
- If any bit variables are used, the data variables will be placed after
- the byte holding the last bit variable.
+ If any bit variables are used, the data variables will be placed in unused
register banks and after the byte holding the last bit variable.
  For example, if register banks 0 and 1 are used, and there are 9 bit variables
  (two bytes used), 
 \emph on 
 data
 \emph default 
- variables will be placed starting at address 0x22.
+ variables will be placed starting from address 0x10 to 0x20 and continue
+ at address 0x22.
  You can also use -
 \begin_inset ERT
 status Collapsed
@@ -8722,7 +8855,7 @@ idata
  
 \layout Standard
 
-By default the 8051 linker will place the stack after the last byte of data
+By default the 8051 linker will place the stack after the last byte of (i)data
  variables.
  Option -
 \begin_inset ERT
@@ -9076,7 +9209,7 @@ xdata
  0x7ffe unsigned int chksum;
 \layout Standard
 
-In the above example the variable chksum will located at 0x7ffe and 0x7fff
+In the above example the variable chksum will be located at 0x7ffe and 0x7fff
  of the external ram.
  The compiler does 
 \emph on 
@@ -9118,8 +9251,7 @@ In case of memory mapped I/O devices the keyword
 \emph on 
 volatile
 \emph default 
- have to be used to tell the compiler that accesses might not be optimized
- away:
+ has to be used to tell the compiler that accesses might not be removed:
 \layout Verse
 
 
@@ -9197,37 +9329,81 @@ le space.
 
 
 \family typewriter 
-extern volatile bit SDI;
+extern volatile bit MOSI;\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+/* master out, slave in */
 \newline 
-extern volatile bit SCLK;
+extern volatile bit MISO;\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+/* master in, slave out */
 \newline 
-extern volatile bit CPOL;
+extern volatile bit MCLK;\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+/* master clock */
 \newline 
 
 \newline 
-void DS1306_put(unsigned char value)
+/* Input and Output of a byte on a 3-wire serial bus.
 \newline 
-{
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+If needed adapt polarity of clock, polarity of data and bit order
+\newline 
+\SpecialChar ~
+*/
+\newline 
+unsigned char spi_io(unsigned char out_byte) 
+\newline 
+{ 
 \newline 
 \SpecialChar ~
 \SpecialChar ~
 \SpecialChar ~
 \SpecialChar ~
-unsigned char mask=0x80;
+unsigned char i=8;
 \newline 
-
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+do { 
+\newline 
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+MOSI = out_byte & 0x80; 
 \newline 
 \SpecialChar ~
 \SpecialChar ~
 \SpecialChar ~
 \SpecialChar ~
-while(mask)
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+out_byte <<= 1;
 \newline 
 \SpecialChar ~
 \SpecialChar ~
 \SpecialChar ~
 \SpecialChar ~
-{
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+MCLK = 1; 
 \newline 
 \SpecialChar ~
 \SpecialChar ~
@@ -9237,7 +9413,15 @@ while(mask)
 \SpecialChar ~
 \SpecialChar ~
 \SpecialChar ~
-SDI=(value & mask)?1:0;
+/* _asm nop _endasm; */\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+/* for slow peripherals */
 \newline 
 \SpecialChar ~
 \SpecialChar ~
@@ -9247,7 +9431,7 @@ SDI=(value & mask)?1:0;
 \SpecialChar ~
 \SpecialChar ~
 \SpecialChar ~
-SCLK=!CPOL;
+if(MISO) 
 \newline 
 \SpecialChar ~
 \SpecialChar ~
@@ -9257,7 +9441,11 @@ SCLK=!CPOL;
 \SpecialChar ~
 \SpecialChar ~
 \SpecialChar ~
-SCLK=CPOL;
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+out_byte += 1; 
 \newline 
 \SpecialChar ~
 \SpecialChar ~
@@ -9267,13 +9455,19 @@ SCLK=CPOL;
 \SpecialChar ~
 \SpecialChar ~
 \SpecialChar ~
-mask/=2;
+MCLK = 0; 
 \newline 
 \SpecialChar ~
 \SpecialChar ~
 \SpecialChar ~
 \SpecialChar ~
-}
+} while(--i);
+\newline 
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+return out_byte; 
 \newline 
 }
 \layout Standard
@@ -9283,29 +9477,23 @@ Then, someplace in the code for the first hardware you would use
 
 
 \family typewriter 
-bit at 0x80 SDI;\SpecialChar ~
+bit at 0x80 MOSI;\SpecialChar ~
 \SpecialChar ~
 \SpecialChar ~
 \SpecialChar ~
 /* I/O port 0, bit 0 */
 \newline 
-bit at 0x81 SCLK;\SpecialChar ~
+bit at 0x81 MISO;\SpecialChar ~
+\SpecialChar ~
 \SpecialChar ~
 \SpecialChar ~
 /* I/O port 0, bit 1 */
 \newline 
-bit CPOL;\SpecialChar ~
-\SpecialChar ~
-\SpecialChar ~
-\SpecialChar ~
-\SpecialChar ~
-\SpecialChar ~
+bit at 0x82 MCLK;\SpecialChar ~
 \SpecialChar ~
 \SpecialChar ~
 \SpecialChar ~
-\SpecialChar ~
-\SpecialChar ~
-/* This is a variable, let the linker allocate this one */
+/* I/O port 0, bit 2 */
 \layout Standard
 
 Similarly, for the second hardware you would use
@@ -9313,13 +9501,14 @@ Similarly, for the second hardware you would use
 
 
 \family typewriter 
-bit at 0x83 SDI;\SpecialChar ~
+bit at 0x83 MOSI;\SpecialChar ~
 \SpecialChar ~
 \SpecialChar ~
 \SpecialChar ~
 /* I/O port 0, bit 3 */
 \newline 
-bit at 0x91 SCLK;\SpecialChar ~
+bit at 0x91 MISO;\SpecialChar ~
+\SpecialChar ~
 \SpecialChar ~
 \SpecialChar ~
 /* I/O port 1, bit 1 */
@@ -9329,18 +9518,11 @@ bit
 
 \end_inset 
 
- CPOL;\SpecialChar ~
-\SpecialChar ~
-\SpecialChar ~
-\SpecialChar ~
-\SpecialChar ~
-\SpecialChar ~
+ at 0x92 MCLK;\SpecialChar ~
 \SpecialChar ~
 \SpecialChar ~
 \SpecialChar ~
-\SpecialChar ~
-\SpecialChar ~
-/* This is a variable, let the linker allocate this one */
+/* I/O port 1, bit 2 */
 \layout Standard
 
 and you can use the same hardware dependent routine without changes, as
@@ -9836,7 +10018,7 @@ volatile
 If the access to these variables is not 
 \emph on 
 atomic
-\begin_inset LatexCommand \index{atomic access}
+\begin_inset LatexCommand \index{atomic}
 
 \end_inset 
 
@@ -10290,6 +10472,41 @@ Since the number of interrupts available is chip specific and the interrupt
 \end_inset 
 
  for details on customizing startup.
+\layout Subsection
+
+Z80 Interrupt Service Routines
+\layout Standard
+
+The Z80 uses several different methods for determining the correct interrupt
+ vector depending on the hardware implementation.
+ Therefore, SDCC ignores the optional interrupt number and does not attempt
+ to generate an interrupt vector table.
+\layout Standard
+
+By default, SDCC generates code for a maskable interrupt, which uses an
+ RETI instruction to return from the interrupt.
+ To write an interrupt handler for the non-maskable interrupt, which needs
+ an RETN instruction instead, add the 
+\emph on 
+critical
+\emph default 
+ keyword:
+\layout Verse
+
+
+\family typewriter 
+void nmi_isr (void) critical interrupt
+\newline 
+{ 
+\newline 
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+...
+\newline 
+}
 \layout Section
 
 Enabling and Disabling Interrupts
@@ -10619,74 +10836,169 @@ interrupt priorities
 
  and don't add complexity unless you have to.
  
-\layout Section
+\layout Subsection
 
-Functions using private register banks
-\begin_inset LatexCommand \label{sub:Functions-using-private-banks}
+Semaphore
+\begin_inset LatexCommand \index{semaphore}
 
 \end_inset 
 
- (mcs51/ds390)
locking (mcs51/ds390)
 \layout Standard
 
-Some architectures have support for quickly changing register sets.
- SDCC supports this feature with the 
-\emph on 
-using
-\begin_inset LatexCommand \index{using (mcs51, ds390 register bank)}
+Some architectures (mcs51/ds390) have an atomic
+\begin_inset LatexCommand \index{atomic}
 
 \end_inset 
 
-
+ bit test and
+\emph on 
 \emph default 
- attribute (which tells the compiler to use a register bank
-\begin_inset LatexCommand \index{register bank (mcs51, ds390)}
+clear
+\emph on 
+\emph default 
+instruction.
+ These type of instructions are typically used in preemptive multitasking
+ systems, where a routine f.e.
+ claims the use of a data structure ('acquires a lock
+\begin_inset LatexCommand \index{lock}
 
 \end_inset 
 
- other than the default bank zero).
- It should only be applied to 
-\emph on 
-interrupt
+ on it'), makes some modifications and then releases the lock when the data
+ structure is consistent again.
+ The instruction may also be used if interrupt and non-interrupt code have
+ to compete for a resource.
+ With the atomic bit test and clear instruction interrupts
 \begin_inset LatexCommand \index{interrupt}
 
 \end_inset 
 
-
-\emph default 
- functions (see footnote below).
- This will in most circumstances make the generated ISR code more efficient
- since it will not have to save registers on the stack.
+ don't have to be disabled for the locking operation.
 \layout Standard
 
-The 
-\emph on 
-using
-\emph default 
- attribute will have no effect on the generated code for a 
-\emph on 
-non-interrupt
-\emph default 
- function (but may occasionally be useful anyway
-\begin_inset Foot
-collapsed false
-
-\layout Standard
+SDCC generates this instruction if the source follows this pattern:
+\layout Verse
 
-possible exception: if a function is called ONLY from 'interrupt' functions
- using a particular bank, it can be declared with the same 'using' attribute
- as the calling 'interrupt' functions.
- For instance, if you have several ISRs using bank one, and all of them
- call memcpy(), it might make sense to create a specialized version of memcpy()
- 'using 1', since this would prevent the ISR from having to save bank zero
- to the stack on entry and switch to bank zero before calling the function
-\end_inset 
 
-).
+\family typewriter 
+volatile bit resource_is_free; 
 \newline 
 
-\emph on 
-(pending: I don't think this has been done yet)
+\newline 
+if (resource_is_free) 
+\newline 
+\SpecialChar ~
+\SpecialChar ~
+{ 
+\newline 
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+resource_is_free=0; 
+\newline 
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+...
+\newline 
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+resource_is_free=1;
+\newline 
+\SpecialChar ~
+\SpecialChar ~
+} 
+\layout Standard
+
+Note, mcs51 and ds390 support only an atomic
+\begin_inset LatexCommand \index{atomic}
+
+\end_inset 
+
+ bit test and 
+\emph on 
+clear
+\emph default 
+ instruction (as opposed to atomic bit test and 
+\emph on 
+set).
+\layout Section
+
+Functions using private register banks
+\begin_inset LatexCommand \label{sub:Functions-using-private-banks}
+
+\end_inset 
+
+ (mcs51/ds390)
+\layout Standard
+
+Some architectures have support for quickly changing register sets.
+ SDCC supports this feature with the 
+\emph on 
+using
+\begin_inset LatexCommand \index{using (mcs51, ds390 register bank)}
+
+\end_inset 
+
+
+\emph default 
+ attribute (which tells the compiler to use a register bank
+\begin_inset LatexCommand \index{register bank (mcs51, ds390)}
+
+\end_inset 
+
+ other than the default bank zero).
+ It should only be applied to 
+\emph on 
+interrupt
+\begin_inset LatexCommand \index{interrupt}
+
+\end_inset 
+
+
+\emph default 
+ functions (see footnote below).
+ This will in most circumstances make the generated ISR code more efficient
+ since it will not have to save registers on the stack.
+\layout Standard
+
+The 
+\emph on 
+using
+\emph default 
+ attribute will have no effect on the generated code for a 
+\emph on 
+non-interrupt
+\emph default 
+ function (but may occasionally be useful anyway
+\begin_inset Foot
+collapsed false
+
+\layout Standard
+
+possible exception: if a function is called ONLY from 'interrupt' functions
+ using a particular bank, it can be declared with the same 'using' attribute
+ as the calling 'interrupt' functions.
+ For instance, if you have several ISRs using bank one, and all of them
+ call memcpy(), it might make sense to create a specialized version of memcpy()
+ 'using 1', since this would prevent the ISR from having to save bank zero
+ to the stack on entry and switch to bank zero before calling the function
+\end_inset 
+
+).
+\newline 
+
+\emph on 
+(pending: I don't think this has been done yet)
 \layout Standard
 
 An 
@@ -10779,10 +11091,30 @@ _sdcc_external_startup()
  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.
- The startup code clears the complete 256 byte of idata memory, this might
- cause problems for 128 byte devices (endless loop reported for Chipcon
- CC1010).
+ be accessed or if the watchdog needs to be disabled, this is the place
+ to do it.
+ The startup code clears all internal data memory, 256 bytes by default,
+ but from 0 to n-1 if 
+\emph on 
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash 
+/
+\end_inset 
+
+-iram-size
+\begin_inset LatexCommand \index{-\/-iram-size}
+
+\end_inset 
+
+n
+\emph default 
+ is used.
+ (recommended for Chipcon CC1010).
 \layout Standard
 
 See also the compiler option 
@@ -13415,6 +13747,62 @@ putchar()
  in sdcc/device/lib.
 \layout Standard
 
+The default
+\family typewriter 
+ printf()
+\begin_inset LatexCommand \index{printf()}
+
+\end_inset 
+
+
+\family default 
+implementation in
+\family typewriter 
+ printf_large.c
+\family default 
+ does not support float (except on ds390).
+ To enable this recompile it with the option 
+\emph on 
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash 
+/
+\end_inset 
+
+DUSE_FLOATS=1
+\begin_inset LatexCommand \index{USE\_FLOATS}
+
+\end_inset 
+
+
+\emph default 
+ on the command line.
+ Use
+\emph on 
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash 
+/
+\end_inset 
+
+-model-large
+\begin_inset LatexCommand \index{-\/-model-large}
+
+\end_inset 
+
+
+\emph default 
+ for the mcs51 port, since this uses a lot of memory.
+\layout Standard
+
 If you're short on memory you might want to use 
 \family typewriter 
 printf_small()
@@ -13425,12 +13813,7 @@ instead
 \emph default 
  of
 \family typewriter 
- printf()
-\begin_inset LatexCommand \index{printf()}
-
-\end_inset 
-
-.
+ printf().
 
 \family default 
  For the mcs51 there is an assembly version 
@@ -13581,15 +13964,6 @@ External Stack
 
 \layout Standard
 
-
-\series bold 
-Attention
-\series default 
-: this option wasn't maintained for a long time and is quite buggy.
- Small programs might work.
- You've been warned!
-\layout Standard
-
 The external stack (-
 \begin_inset ERT
 status Collapsed
@@ -13610,8 +13984,9 @@ status Collapsed
 
 \end_inset 
 
- memory (usually at the start of the external ram segment) and is 256 bytes
- in size.
+ memory (usually at the start of the external ram segment) and uses all
+ unused space in pdata (max.
+ 256 bytes).
  When -
 \begin_inset ERT
 status Collapsed
@@ -13647,7 +14022,8 @@ status Collapsed
 
  option, all parameters and local variables are allocated on the external
  stack (note: support libraries will need to be recompiled with the same
- options).
+ options.
+ There is a predefined target in the library makefile).
 \layout Standard
 
 The compiler outputs the higher order address byte of the external ram segment
@@ -13895,6 +14271,14 @@ less_pedantic
  your own now ;-(
 \layout Itemize
 
+disable_warning <nnnn>
+\begin_inset LatexCommand \index{\#pragma disable\_warning}
+
+\end_inset 
+
+ - the compiler will not warn you anymore about warning number <nnnn>.
+\layout Itemize
+
 nogcse
 \begin_inset LatexCommand \index{\#pragma nogcse}
 
@@ -14008,6 +14392,35 @@ status Collapsed
 \end_inset 
 
  Parameters and Local Variables.
+\layout Itemize
+
+opt_code_speed 
+\begin_inset LatexCommand \index{\#pragma opt\_code\_speed}
+
+\end_inset 
+
+- The compiler will optimize code generation towards fast code, possibly
+ at the expense of code size.
+\layout Itemize
+
+opt_code_size 
+\begin_inset LatexCommand \index{\#pragma opt\_code\_size}
+
+\end_inset 
+
+- The compiler will optimize code generation towards compact code, possibly
+ at the expense of code speed.
+\layout Itemize
+
+opt_code_balanced 
+\begin_inset LatexCommand \index{\#pragma opt\_code\_balanced}
+
+\end_inset 
+
+- The compiler will attempt to generate code that is both compact and fast,
+ as long as meeting one goal is not a detriment to the other (this is the
+ default).
 \layout Standard
 
 SDCPP supports the following #pragma directives:
@@ -14896,41 +15309,6 @@ status Collapsed
 /
 \end_inset 
 
--stack-auto Auto variables that are function parameters, will be saved on
- stack by default.
-\emph on 
-There is no need to specify this in the command line.
-\layout List
-\labelwidthstring 00.00.0000
-
--
-\begin_inset ERT
-status Collapsed
-
-\layout Standard
-
-\backslash 
-/
-\end_inset 
-
--float-reent All floating point functions are reentrant by default.
-\emph on 
-There is no need to specifiy this in the command line.
-\layout List
-\labelwidthstring 00.00.0000
-
--
-\begin_inset ERT
-status Collapsed
-
-\layout Standard
-
-\backslash 
-/
-\end_inset 
-
 -callee-saves See -
 \begin_inset ERT
 status Collapsed
@@ -15005,8 +15383,7 @@ status Collapsed
 /
 \end_inset 
 
--pgen-bank Instructs the port to insert BANKSEL directives before instructions
- that use the Bank Select Register (BSR).
+-nodefaultlibs do not link default libraries when linking.
 \layout List
 \labelwidthstring 00.00.0000
 
@@ -15020,8 +15397,25 @@ status Collapsed
 /
 \end_inset 
 
--pomit-config-words Instructs the port to omit the generation of the configurati
-on words.
+-obanksel=# Set optimization level for inserting BANKSELs.
+\begin_deeper 
+\layout List
+\labelwidthstring 00.00.0000
+
+0 is no optimization
+\layout List
+\labelwidthstring 00.00.0000
+
+1 checks previous used register and if it is the same then does not emit
+ BANKSEL, accounts only for labels.
+\layout List
+\labelwidthstring 00.00.0000
+
+2 tries to check the location of (even different) symbols and removes BANKSELs
+ if they are in the same bank.
+ Important: This will only work properly if the linker script does not have
+ sections across bank borders!
+\end_deeper 
 \layout List
 \labelwidthstring 00.00.0000
 
@@ -15035,7 +15429,7 @@ status Collapsed
 /
 \end_inset 
 
--pomit-ivt Instructs the port to omit the generation of the interrupt vectors
+-pomit-config-words Omit the generation of the configuration words.
 \layout List
 \labelwidthstring 00.00.0000
 
@@ -15049,8 +15443,7 @@ status Collapsed
 /
 \end_inset 
 
--pleave-reset-vector Used in conjuction with the previous command, instructs
- the port NOT to omit the reset vector.
+-pomit-ivt Omit the generation of the interrupt vectors.
 \layout List
 \labelwidthstring 00.00.0000
 
@@ -15064,19 +15457,43 @@ status Collapsed
 /
 \end_inset 
 
--stack-model=[model] Used in conjuction with the command above.
- Defines the stack model to be used, valid stack models are : 
-\begin_deeper 
-\layout List
-\labelwidthstring 00.00.0000
+-pleave-reset-vector Used in conjuction with -
+\begin_inset ERT
+status Collapsed
 
+\layout Standard
 
-\emph on 
-small
-\emph default 
- Selects small stack model.
- 8 bit stack and frame pointers.
- Supports 256 bytes stack size.
+\backslash 
+/
+\end_inset 
+
+-pomit-ivt, instructs the port NOT to omit the reset vector.
+\layout List
+\labelwidthstring 00.00.0000
+
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash 
+/
+\end_inset 
+
+-stack-model=[model] Used in conjuction with the command above.
+ Defines the stack model to be used, valid stack models are : 
+\begin_deeper 
+\layout List
+\labelwidthstring 00.00.0000
+
+
+\emph on 
+small
+\emph default 
+ Selects small stack model.
+ 8 bit stack and frame pointers.
+ Supports 256 bytes stack size.
 \layout List
 \labelwidthstring 00.00.0000
 
@@ -15147,6 +15564,77 @@ status Collapsed
 \end_inset 
 
 -link= sets the full path and name of an external linker to call.
+\layout List
+\labelwidthstring 00.00.0000
+
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash 
+/
+\end_inset 
+
+-call-tree dump call tree in .calltree file
+\layout List
+\labelwidthstring 00.00.0000
+
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash 
+/
+\end_inset 
+
+-mplab-comp MPLAB compatibility option.
+ Currently only suppresses special gpasm directives.
+\layout List
+\labelwidthstring 00.00.0000
+
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash 
+/
+\end_inset 
+
+-use-crt= Use a custom run-time module instead of the defaults.
+\layout List
+\labelwidthstring 00.00.0000
+
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash 
+/
+\end_inset 
+
+-no-crt Don't link the default run-time modules
+\layout List
+\labelwidthstring 00.00.0000
+
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash 
+/
+\end_inset 
+
+-optimize-goto Try to use (conditional) BRA instead of GOTO
 \layout Subsubsection
 
 Debugging Options
@@ -15212,6 +15700,35 @@ status Collapsed
 \end_inset 
 
 -pcode-verbose Enable pcode debugging information in translation.
+\layout List
+\labelwidthstring 00.00.0000
+
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash 
+/
+\end_inset 
+
+-denable-peeps Force the usage of peepholes.
+ Use with care.
+\layout List
+\labelwidthstring 00.00.0000
+
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash 
+/
+\end_inset 
+
+-gstack Trace push/pops for stack pointer overflow
 \layout Subsection
 
 Preprocessor Macros
@@ -15418,25 +15935,49 @@ PIC16 port currently supports the following pragmas:
 
 stack pragma stack forces the code generator to initialize the stack & frame
  pointers at a specific address.
- This is an adhoc solution since gplink does not support yet stack.
- When the gplink issue is resolved the pragma will be deprecated
-\begin_inset Foot
-collapsed true
+ This is an adhoc solution for cases where no STACK directive is available
+ in the linker script or gplink is not instructed to create a stack section.
+\newline 
+The stack pragma should be used only once in a project.
+ Multiple pragmas may result in indeterminate behaviour of the program.
+\newline 
+The format is as follows:
+\layout LyX-Code
 
+#pragma stack bottom_address [stack_size]
 \layout Standard
 
 
 \emph on 
-It is important to initialize the stack, otherwise strange things can happen.
- Stack is not initialized by default because there are some sources that
- do not require it.
- (like library sources)
-\end_inset 
+bottom_address
+\emph default 
+ is the lower bound of the stack section.
+ The stack pointer initially will point at address (bottom_address+stack_size-1).
+\layout LyX-Code
+
+Example:
+\layout LyX-Code
+
+\layout LyX-Code
+
+/* initializes stack of 100 bytes at RAM address 0x200 */
+\layout LyX-Code
+
+#pragma stack 0x200 100
+\layout List
+\labelwidthstring 00.00.0000
+
+wparam use the WREG to pass one byte of the first function argument.
+ This improves speed but you may not use this for functions with arguments
+ that are called via function pointers, otherwise one byte of the first
+ parameter will get lost.
+ This pragma should be placed in the header file to propagate the calling
+ convention to all callers.
+\layout LyX-Code
+
+#pragma wparam function1[, function2, ...]
+\layout LyX-Code
 
-.
-\newline 
-The stack pragma should be used only once in a project.
- Multiple pragmas may result in indeterminate behaviour of the program.
 \layout LyX-Code
 
 Example:
@@ -15444,10 +15985,28 @@ Example:
 
 \layout LyX-Code
 
-/* initializes stack at RAM address 0x5ff */
+/* pass one byte via stack and one byte via WREG */
+\layout LyX-Code
+
+#pragma wparam foo
 \layout LyX-Code
 
-#pragma stack 0x5ff
+void foo(int x);
+\layout List
+\labelwidthstring 00.00.0000
+
+code place a function symbol at static FLASH address
+\layout LyX-Code
+
+Example:
+\layout LyX-Code
+
+\layout LyX-Code
+
+/* place function test_func at 0x4000 */
+\layout LyX-Code
+
+#pragma code test_func 0x4000
 \layout List
 \labelwidthstring 00.00.0000
 
@@ -15469,8 +16028,8 @@ Example:
 char foo;
 \layout Standard
 
-In order for this pragma to work there are some changes that must be made
- in the .lkr script used in link stage.
+In order for this pragma to work extra SECTION directives should be added
+ in the .lkr script.
  In the following example a sample .lkr file is shown:
 \layout LyX-Code
 
@@ -15533,16 +16092,16 @@ SECTION    NAME=CONFIG     ROM=config
 
 \layout LyX-Code
 
-SECTION    NAME=bank0      RAM=gpr0
+SECTION    NAME=bank0      RAM=gpr0       # these SECTION directives
 \layout LyX-Code
 
-SECTION    NAME=bank1      RAM=gpr1
+SECTION    NAME=bank1      RAM=gpr1       # should be added to link
 \layout LyX-Code
 
-SECTION    NAME=bank2      RAM=gpr2
+SECTION    NAME=bank2      RAM=gpr2       # section name 'bank?' with
 \layout LyX-Code
 
-SECTION    NAME=bank3      RAM=gpr3
+SECTION    NAME=bank3      RAM=gpr3       # a specific DATABANK name
 \layout LyX-Code
 
 SECTION    NAME=bank4      RAM=gpr4
@@ -15554,6 +16113,234 @@ SECTION    NAME=bank5      RAM=gpr5
 The linker will recognise the section name set in the pragma statement and
  will position the variable at the memory bank set with the RAM field at
  the SECTION line in the linker script file.
+\layout List
+\labelwidthstring 00.00.0000
+
+library instructs the linker to use a library module.
+\newline 
+Usage:
+\layout LyX-Code
+
+#pragma library module_name
+\layout Standard
+
+
+\emph on 
+module_name
+\emph default 
+ can be any library or object file (including its path).
+ Note that there are four reserved keywords which have special meaning.
+ These are:
+\layout Standard
+\align center 
+
+\begin_inset  Tabular
+<lyxtabular version="3" rows="6" columns="3">
+<features>
+<column alignment="center" valignment="top" leftline="true" width="0">
+<column alignment="block" valignment="top" leftline="true" width="20page%">
+<column alignment="left" valignment="top" leftline="true" rightline="true" width="0">
+<row topline="true" bottomline="true">
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+Keyword
+\end_inset 
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+Description
+\end_inset 
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+Module to link
+\end_inset 
+</cell>
+</row>
+<row topline="true">
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+
+\series bold 
+ignore
+\end_inset 
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+ignore all library pragmas
+\end_inset 
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+
+\emph on 
+(none)
+\end_inset 
+</cell>
+</row>
+<row topline="true">
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+
+\series bold 
+c
+\end_inset 
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+link the C library
+\end_inset 
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+
+\emph on 
+libc18f
+\emph default 
+.lib
+\end_inset 
+</cell>
+</row>
+<row topline="true">
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+
+\series bold 
+math
+\end_inset 
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+link the Math libarary
+\end_inset 
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+
+\emph on 
+libm18f
+\emph default 
+.lib
+\end_inset 
+</cell>
+</row>
+<row topline="true">
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+
+\series bold 
+io
+\end_inset 
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+link the I/O library
+\end_inset 
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+
+\emph on 
+libio18f*
+\emph default 
+.lib
+\end_inset 
+</cell>
+</row>
+<row topline="true" bottomline="true">
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+
+\series bold 
+debug
+\end_inset 
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+link the debug library
+\end_inset 
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+
+\emph on 
+libdebug
+\emph default 
+.lib
+\end_inset 
+</cell>
+</row>
+</lyxtabular>
+
+\end_inset 
+
+
+\newline 
+* is the device number, i.e.
+ 452 for PIC18F452 MCU.
+\layout Standard
+
+This feature allows for linking with specific libraries withoug having to
+ explicit name them in the command line.
+ Note that the 
+\noun on 
+ignore
+\noun default 
+ keyword will reject all modules specified by the library pragma.
 \layout Subsection
 
 Header Files
@@ -15609,6 +16396,47 @@ Libraries are created with gplib which is part of the gputils package
 \end_inset 
 
 .
+\layout Subsubsection
+
+Building the libraries
+\layout Standard
+
+Before using SDCC/pic16 there are some libraries that need to be compiled.
+ This process is not done automatically by SDCC since not all users use
+ SDCC for pic16 projects.
+ So each user should compile the libraries separately.
+\layout Standard
+
+The steps to compile the pic16 libraries under Linux are:
+\layout LyX-Code
+
+cd device/lib/pic16
+\layout LyX-Code
+
+./configure
+\layout LyX-Code
+
+make
+\layout LyX-Code
+
+cd ..
+\layout LyX-Code
+
+make model-pic16
+\layout LyX-Code
+
+su -c 'make install'     # install the libraries, you need the root password
+\layout Standard
+
+If you need to install the headers to, do:
+\layout LyX-Code
+
+cd device/include
+\layout LyX-Code
+
+su -c 'make install'     # install the headers, you need the root password
+\layout LyX-Code
+
 \layout Subsection
 
 Memory Models
@@ -15762,10 +16590,18 @@ FSR2 is assigned as frame pointer
 The following stack models are supported by the PIC16 port
 \layout Itemize
 
-small model
-\layout Itemize
 
-large model
+\noun on 
+small
+\noun default 
+ model
+\layout Itemize
+
+
+\noun on 
+large
+\noun default 
+ model
 \layout Standard
 
 
@@ -15877,16 +16713,27 @@ Frame pointer FSR2
 \layout Standard
 
 
-\series bold 
-Currently stack and frame pointers should be initialized explicit by the
- user at the desired Data RAM position (see 
-\begin_inset LatexCommand \ref{sub:PIC16_Pragmas}
+\noun on 
+Large 
+\noun default 
+stack model is currently not working properly throughout the code generator.
+ So its use is not advised.
+ Also there are some other points that need special care:
+\newline 
 
-\end_inset 
+\layout Enumerate
+
+Do not create stack sections with size more than one physical bank (that
+ is 256 bytes)
+\layout Enumerate
+
+Stack sections should no cross physical bank limits (i.e.
+ #pragma stack 0x50 0x100)
+\layout Standard
 
- Pragma stack).
- Uninitialized stack and frame pointers can result in unexpected behavior
of the resulting binary.
+These limitations are caused by the fact that only FSRxL is modified when
+ using SMALL stack model, so no more than 256 bytes of stack can be used.
This problem will disappear after LARGE model is fully implemented.
 \layout Subsection
 
 Function return values
@@ -17934,7 +18781,27 @@ sdcc/Changelog
 
 \layout Standard
 
-ASXXXX Assemblers and ASLINK Relocating Linker
+ASXXXX
+\begin_inset LatexCommand \index{asXXXX (as-gbz80, as-hc08, asx8051, as-z80)}
+
+\end_inset 
+
+
+\begin_inset LatexCommand \index{Assembler documentation}
+
+\end_inset 
+
+ Assemblers and ASLINK
+\begin_inset LatexCommand \index{aslink}
+
+\end_inset 
+
+
+\begin_inset LatexCommand \index{Linker documentation}
+
+\end_inset 
+
+ Relocating Linker
 \end_inset 
 </cell>
 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
@@ -19359,10 +20226,6 @@ void f () {
 \SpecialChar ~
 global = 2; 
 \newline 
-\SpecialChar ~
-\SpecialChar ~
-return; 
-\newline 
 }
 \layout Subsection
 
@@ -19727,17 +20590,19 @@ Note the subexpressions
 
 \layout Standard
 
-SDCC changes switch statements to jump tables
+SDCC can optimize switch statements to jump tables
 \begin_inset LatexCommand \index{jump tables}
 
 \end_inset 
 
- when the following conditions are true.
+.
+ It makes the decision based on an estimate of the generated code size.
+ SDCC is quite liberal in the requirements for jump table generation: 
 \layout Itemize
 
-The case labels are in numerical sequence, the labels need not be in order,
- and the starting number need not be one or zero.
+The labels need not be in order, and the starting number need not be one
+ or zero, the case labels are in numerical sequence or not too many case
+ labels are missing.
 \begin_deeper 
 \layout Verse
 
@@ -19864,8 +20729,7 @@ case 3: ...\SpecialChar ~
 \SpecialChar ~
 \SpecialChar ~
 \SpecialChar ~
-case 2: ...
+
 \newline 
 \SpecialChar ~
 \SpecialChar ~
@@ -19898,6 +20762,164 @@ case 6: ...\SpecialChar ~
 \SpecialChar ~
 case 3: ...
  
+\newline 
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+case 7: ...\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+case 4: ...
+\newline 
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+case 8: ...\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+case 5: ...
+\newline 
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+case 9: ...\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+case 6: ...
+\newline 
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+case 10: ...\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+case 7: ...
+\newline 
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+case 11: ...\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+case 8: ...
 \newline 
 }\SpecialChar ~
 \SpecialChar ~
@@ -19944,16 +20966,24 @@ Both the above switch statements will be implemented using a jump-table.
 \end_deeper 
 \layout Itemize
 
-The number of case labels is at least three, since it takes two conditional
- statements to handle the boundary conditions.
+The number of case labels is not larger than supported by the target architectur
+e.
+\layout Itemize
+
+If the case labels are not in numerical sequence ('gaps' between cases)
+ SDCC checks whether a jump table with additionally inserted dummy cases
+ is still attractive.
 \layout Itemize
 
-The number of case labels is less than 84, since each label takes 3 bytes
- and a jump-table can be utmost 256 bytes long.
+If the starting number is not zero and a check for the lower boundary of
+ the jump-table can thus be eliminated SDCC might insert dummy cases 0,
+ ...
+ .
 \layout Standard
 
-Switch statements which have gaps in the numeric sequence or those that
have more that 84 case labels can be split into more than one switch statement
+Switch statements which have large gaps in the numeric sequence or those
that have too many case labels can be split into more than one switch statement
  for efficient code generation, e.g.:
 \layout Verse
 
@@ -19983,22 +21013,52 @@ case 4: ...
 \newline 
 \SpecialChar ~
 \SpecialChar ~
-case 9: ...
+case 5: ...
+\newline 
+\SpecialChar ~
+\SpecialChar ~
+case 6: ...
+\newline 
+\SpecialChar ~
+\SpecialChar ~
+case 7: ...
+\newline 
+\SpecialChar ~
+\SpecialChar ~
+case 101: ...
+\newline 
+\SpecialChar ~
+\SpecialChar ~
+case 102: ...
+\newline 
+\SpecialChar ~
+\SpecialChar ~
+case 103: ...
+\newline 
+\SpecialChar ~
+\SpecialChar ~
+case 104: ...
  
 \newline 
 \SpecialChar ~
 \SpecialChar ~
-case 10: ...
+case 105: ...
  
 \newline 
 \SpecialChar ~
 \SpecialChar ~
-case 11: ...
+case 106: ...
  
 \newline 
 \SpecialChar ~
 \SpecialChar ~
-case 12: ...
+case 107: ...
  
 \newline 
 }
@@ -20030,6 +21090,21 @@ case 3: ...
 \SpecialChar ~
 case 4: ...
  
+\newline 
+\SpecialChar ~
+\SpecialChar ~
+case 5: ...
+\newline 
+\SpecialChar ~
+\SpecialChar ~
+case 6: ...
+\newline 
+\SpecialChar ~
+\SpecialChar ~
+case 7: ...
 \newline 
 }
 \layout Standard
@@ -20043,27 +21118,37 @@ switch (i) {
 \newline 
 \SpecialChar ~
 \SpecialChar ~
-case 9:\SpecialChar ~
+case 101: ...
+\newline 
+\SpecialChar ~
 \SpecialChar ~
-...
+case 102: ...
  
 \newline 
 \SpecialChar ~
 \SpecialChar ~
-case 10:\SpecialChar ~
-...
+case 103: ...
  
 \newline 
 \SpecialChar ~
 \SpecialChar ~
-case 11:\SpecialChar ~
-...
+case 104: ...
  
 \newline 
 \SpecialChar ~
 \SpecialChar ~
-case 12:\SpecialChar ~
-...
+case 105: ...
+\newline 
+\SpecialChar ~
+\SpecialChar ~
+case 106: ...
+\newline 
+\SpecialChar ~
+\SpecialChar ~
+case 107: ...
  
 \newline 
 }
@@ -20071,9 +21156,15 @@ case 12:\SpecialChar ~
 
 then both the switch statements will be implemented using jump-tables whereas
  the unmodified switch statement will not be.
- You might also consider inserting dummy cases 0 and 5 to 8 in this example.
-\newline 
+\layout Comment
+
+There might be reasons which SDCC cannot know about to either favour or
+ not favour jump tables.
+ If the target system has to be as quick for the last switch case as for
+ the first (pro jump table), or if the switch argument is known to be zero
+ in the majority of the cases (contra jump table).
+\layout Standard
+
 The pragma nojtbound
 \begin_inset LatexCommand \index{\#pragma nojtbound}
 
@@ -21430,7 +22521,16 @@ Figure II gives a table of iCode operations supported by the compiler.
 \series bold 
 \shape italic 
 \color red
-<Where is Figure II ?>
+<Where is Figure II?>
+\layout Comment
+
+In the original article Figure II was announced to be downloadable on 
+\shape italic 
+Circuit Cellar
+\shape default 
+'s web site.
+ Unfortunately it never seemed to have shown up there, so: where is Figure
+ II?
 \layout Paragraph*
 
 ICode Example