]> git.gag.com Git - fw/sdcc/blobdiff - doc/sdccman.lyx
* src/SDCCglobl.h,
[fw/sdcc] / doc / sdccman.lyx
index e1b54bbeaad71567573f60f00e93c04424c27f19..d74af8026033a626ba71e3e63b5e1dfa897aec0d 100644 (file)
@@ -93,7 +93,7 @@ SDCC 2.6.4
 \size footnotesize
 
 \newline
-$Date$ 
+$Date::            
 \newline
 $Revision$
 
@@ -8606,7 +8606,8 @@ status Collapsed
 \family typewriter
  signed
 \family default
-. In some embedded enviornments the default signedness of
+.
+ In some embedded environments the default signedness of
 \family typewriter
  char
 \family default
@@ -8614,8 +8615,10 @@ status Collapsed
 \family typewriter
  unsigned
 \family default
-. To set the signess for characters to unsigned, use the option --funsigned-char.
- If this option is set and no signedness keyword (unsigned/signed) is given, a char will be signed.
+.
+ To set the signess for characters to unsigned, use the option --funsigned-char.
+ If this option is set and no signedness keyword (unsigned/signed) is given,
+ a char will be signed.
  All other types are unaffected.
 
 \layout List
@@ -8814,6 +8817,31 @@ status Collapsed
 \layout Standard
 
 
+\backslash
+/
+
+\end_inset
+
+-no-gen-comments
+\begin_inset LatexCommand \index{-\/-no-gen-comments}
+
+\end_inset
+
+
+\series default
+ Will not include code generator comments in the generated files.
+
+\layout List
+\labelwidthstring 00.00.0000
+
+\series bold
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+
 \backslash
 /
 
@@ -13339,215 +13367,1028 @@ SDCC generates this instruction if the source follows this pattern:
 \layout Verse
 
 \family typewriter
-volatile
-\begin_inset LatexCommand \index{volatile}
+volatile
+\begin_inset LatexCommand \index{volatile}
+
+\end_inset
+
+ bit resource_is_free; 
+\newline
+
+\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
+
+
+\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: Note, nowadays the 
+\emph default
+using
+\emph on
+ attribute has an effect on
+\emph default
+\emph on
+the generated code for a 
+\emph default
+non-interrupt
+\emph on
+ function
+\emph default
+.
+\emph on
+)
+
+\layout Standard
+An 
+\emph on
+interrupt
+\emph default
+ function using a non-zero bank will assume that it can trash that register
+ bank, and will not save it.
+ Since high-priority interrupts
+\begin_inset LatexCommand \index{interrupts}
+
+\end_inset
+
+
+\begin_inset LatexCommand \index{interrupt priority}
+
+\end_inset
+
+ can interrupt low-priority ones on the 8051 and friends, this means that
+ if a high-priority ISR 
+\emph on
+using
+\emph default
+ a particular bank occurs while processing a low-priority ISR 
+\emph on
+using
+\emph default
+ the same bank, terrible and bad things can happen.
+ To prevent this, no single register bank should be 
+\emph on
+used
+\emph default
+ by both a high priority and a low priority ISR.
+ This is probably most easily done by having all high priority ISRs use
+ one bank and all low priority ISRs use another.
+ If you have an ISR which can change priority at runtime, you're on your
+ own: I suggest using the default bank zero and taking the small performance
+ hit.
+
+\layout Standard
+\added_space_bottom bigskip 
+It is most efficient if your ISR calls no other functions.
+ If your ISR must call other functions, it is most efficient if those functions
+ use the same bank as the ISR (see note 1 below); the next best is if the
+ called functions use bank zero.
+ It is very inefficient to call a function using a different, non-zero bank
+ from an ISR.
+
+
+
+\layout Section
+Startup Code
+\begin_inset LatexCommand \label{sub:Startup-Code}
+
+\end_inset
+
+
+\begin_inset LatexCommand \index{Startup code}
+
+\end_inset
+
+
+
+\layout Subsection
+MCS51/DS390 Startup Code
+
+\layout Standard
+The compiler triggers the linker to link certain initialization modules
+ from the runtime library
+\begin_inset LatexCommand \index{Runtime library}
+
+\end_inset
+
+ called crt<something>.
+ Only the necessary ones are linked, for instance crtxstack.asm (GSINIT1,
+ GSINIT5) is not linked unless the --xstack option is used.
+ These modules are highly entangled by the use of special segments/areas,
+ but a common layout is shown below:
+
+\layout Verse
+
+\family typewriter
+\series bold
+\size footnotesize
+(main.asm)
+
+\layout Verse
+
+\family typewriter
+\size footnotesize
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+.area HOME (CODE)
+\newline
+__interrupt_vect:
+\newline
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+ljmp __sdcc_gsinit_startup
+
+\layout Verse
+
+\family typewriter
+\series bold
+\size footnotesize
+(crtstart.asm)
+
+\layout Verse
+
+\family typewriter
+\size footnotesize
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+.area GSINIT0 (CODE)
+\newline
+__sdcc_gsinit_startup::
+\newline
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+mov sp,#__start__stack - 1
+
+\layout Verse
+
+\family typewriter
+\series bold
+\size footnotesize
+(crtxstack.asm)
+
+\layout Verse
+
+\family typewriter
+\size footnotesize
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+.area GSINIT1 (CODE)
+\newline
+__sdcc_init_xstack::
+\newline
+; Need to initialize in GSINIT1 in
+ case the user's __sdcc_external_startup uses the xstack.
+\newline
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+mov __XPAGE,#(__start__x
+stack >> 8)
+\newline
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+mov _spx,#__start__xstack
+
+\layout Verse
+
+\family typewriter
+\series bold
+\size footnotesize
+(crtstart.asm)
+
+\layout Verse
+
+\family typewriter
+\size footnotesize
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+.area GSINIT2 (CODE)
+\newline
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+lcall __sdcc_external_startup
+\newline
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+mov a,dpl
+\newline
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+jz __sdcc_init_data
+\newline
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+ljmp
+ __sdcc_program_startup
+\newline
+__sdcc_init_data:
+
+\layout Verse
+
+\family typewriter
+\series bold
+\size footnotesize
+(crtxinit.asm)
+
+\layout Verse
+
+\family typewriter
+\size footnotesize
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+.area GSINIT3 (CODE)
+\newline
+__mcs51_genXINIT::
+\newline
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+mov r1,#l_XINIT
+\newline
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+mov a,r1
+\newline
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+orl a,#(l_XINIT
+ >> 8)
+\newline
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+jz 00003$
+\newline
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+mov r2,#((l_XINIT+255) >> 8)
+\newline
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+mov dptr,#s_XINIT
+\newline
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+mov r0,#s_XISEG
+\newline
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+mov
+ __XPAGE,#(s_XISEG >> 8)
+\newline
+00001$:\SpecialChar ~
+clr a
+\newline
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+movc a,@a+dptr
+\newline
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+movx @r0,a
+\newline
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+inc dptr
+\newline
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+inc
+ r0
+\newline
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+cjne r0,#0,00002$
+\newline
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+inc __XPAGE
+\newline
+00002$:\SpecialChar ~
+djnz r1,00001$
+\newline
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+djnz r2,00001$
+\newline
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+mov __XPAGE,#0
+xFF
+\newline
+00003$:
+
+\layout Verse
+
+\family typewriter
+\series bold
+\size footnotesize
+(crtclear.asm)
+
+\layout Verse
+
+\family typewriter
+\size footnotesize
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+.area GSINIT4 (CODE)
+\newline
+__mcs51_genRAMCLEAR::
+\newline
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+clr a
+\newline
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+mov r0,#(l_IRAM-1)
+\newline
+00004$:\SpecialChar ~
+mov
+ @r0,a
+\newline
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+djnz r0,00004$
+\newline
+; _mcs51_genRAMCLEAR() end
+
+\layout Verse
+
+\family typewriter
+\series bold
+\size footnotesize
+(crtxclear.asm)
+
+\layout Verse
+
+\family typewriter
+\size footnotesize
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+.area GSINIT4 (CODE)
+\newline
+__mcs51_genXRAMCLEAR::
+\newline
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+mov r0,#l_PSEG
+\newline
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+mov a,r0
+\newline
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+jz 00006$
+\newline
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+mov
+ r1,#s_PSEG
+\newline
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+mov __XPAGE,#(s_PSEG >> 8)
+\newline
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+clr a
+\newline
+00005$:\SpecialChar ~
+movx @r1,a
+\newline
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+inc r1
+\newline
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+djnz r0,00005$
+\newline
+0
+0006$:
+\newline
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+mov r0,#l_XSEG
+\newline
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+mov a,r0
+\newline
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+orl a,#(l_XSEG >> 8)
+\newline
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+jz 00008$
+\newline
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+mov r1,#((l_XSEG
+ + 255) >> 8)
+\newline
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+mov dptr,#s_XSEG
+\newline
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+clr a
+\newline
+00007$:\SpecialChar ~
+movx @dptr,a
+\newline
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+inc dptr
+\newline
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+djnz r0,00007$
+\newline
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+djnz
+ r1,00007$
+\newline
+00008$:
+
+\layout Verse
+
+\family typewriter
+\series bold
+\size footnotesize
+(crtxstack.asm)
+
+\layout Verse
+
+\family typewriter
+\size footnotesize
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+.area GSINIT5 (CODE)
+\newline
+; Need to initialize in GSINIT5 because __mcs51_genXINIT
+ modifies __XPAGE
+\newline
+; and __mcs51_genRAMCLEAR modifies _spx.
+\newline
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+mov __XPAGE,#(__start__x
+stack >> 8)
+\newline
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+mov _spx,#__start__xstack
+
+\layout Verse
+
+\family typewriter
+\series bold
+\size footnotesize
+(application modules)
+
+\layout Verse
+
+\family typewriter
+\size footnotesize
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+.area GSINIT (CODE)
+
+\layout Verse
+
+\family typewriter
+\series bold
+\size footnotesize
+(main.asm)
 
-\end_inset
+\layout Verse
 
- bit resource_is_free; 
+\family typewriter
+\size footnotesize
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+.area GSFINAL (CODE)
 \newline
-
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+ljmp __sdcc_program_startup
 \newline
-if (resource_is_free) 
+;---------------------------------
+-----------------------
+\newline
+; Home
+\newline
+;--------------------------------------------------
+------
 \newline
 \SpecialChar ~
 \SpecialChar ~
-{ 
-\newline
 \SpecialChar ~
 \SpecialChar ~
 \SpecialChar ~
 \SpecialChar ~
-resource_is_free=0; 
+\SpecialChar ~
+\SpecialChar ~
+.area HOME (CODE)
 \newline
 \SpecialChar ~
 \SpecialChar ~
 \SpecialChar ~
 \SpecialChar ~
-...
-\newline
 \SpecialChar ~
 \SpecialChar ~
 \SpecialChar ~
 \SpecialChar ~
-resource_is_free=1;
+.area CSEG (CODE)
+\newline
+__sdcc_program_startup:
 \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
-
-
-\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
-
-).
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+lcall _main
 \newline
-
-\emph on
-(pending: Note, nowadays the 
-\emph default
-using
-\emph on
- attribute has an effect on
-\emph default
-\emph on
-the generated code for a 
-\emph default
-non-interrupt
-\emph on
- function
-\emph default
-.
-\emph on
-)
-
-\layout Standard
-An 
-\emph on
-interrupt
-\emph default
- function using a non-zero bank will assume that it can trash that register
- bank, and will not save it.
- Since high-priority interrupts
-\begin_inset LatexCommand \index{interrupts}
-
-\end_inset
-
-
-\begin_inset LatexCommand \index{interrupt priority}
-
-\end_inset
-
- can interrupt low-priority ones on the 8051 and friends, this means that
- if a high-priority ISR 
-\emph on
-using
-\emph default
- a particular bank occurs while processing a low-priority ISR 
-\emph on
-using
-\emph default
- the same bank, terrible and bad things can happen.
- To prevent this, no single register bank should be 
-\emph on
-used
-\emph default
- by both a high priority and a low priority ISR.
- This is probably most easily done by having all high priority ISRs use
- one bank and all low priority ISRs use another.
- If you have an ISR which can change priority at runtime, you're on your
- own: I suggest using the default bank zero and taking the small performance
- hit.
-
-\layout Standard
-\added_space_bottom bigskip 
-It is most efficient if your ISR calls no other functions.
- If your ISR must call other functions, it is most efficient if those functions
- use the same bank as the ISR (see note 1 below); the next best is if the
- called functions use bank zero.
- It is very inefficient to call a function using a different, non-zero bank
- from an ISR.
-
-
-
-\layout Section
-Startup Code
-\begin_inset LatexCommand \label{sub:Startup-Code}
-
-\end_inset
-
-
-\begin_inset LatexCommand \index{Startup code}
-
-\end_inset
-
-
-
-\layout Subsection
-MCS51/DS390 Startup Code
+;
+ return from main will lock up
+\newline
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+sjmp .
 
 \layout Standard
-The compiler inserts a call to the C routine 
+One of these modules (crtstart.asm) contains a call to the C routine 
 \emph on
 _sdcc_external_startup()
 \begin_inset LatexCommand \index{\_sdcc\_external\_startup()}
@@ -13560,18 +14401,17 @@ _sdcc_external_startup()
  
 \series default
 at the start of the CODE area.
- This routine is in the runtime library
+ This routine is also in the runtime library
 \begin_inset LatexCommand \index{Runtime library}
 
 \end_inset
 
-.
- By default this routine returns 0, if this routine returns a non-zero value,
- the static & global variable initialization will be skipped and the function
- main will be invoked.
+ and returns 0 by default.
+ If this routine returns a non-zero value, the static & global variable
+ initialization will be skipped and the function main will be invoked.
  Otherwise static & global variables will be initialized before the function
  main is invoked.
- You could add a 
+ You could add an 
 \emph on
 _sdcc_external_startup()
 \emph default
@@ -16775,7 +17615,7 @@ and
 not
 \emph default
  support long variables and field widths).
- Be sure to only use only one of these printf options within a project.
+ Be sure to use only one of these printf options within a project.
 \newline
 
 
@@ -19433,17 +20273,33 @@ sfr
 \layout Verse
 
 \family typewriter
-__sfr __at (0x92) _XPAGE; /* Cypress EZ-USB family */
+__sfr __at (0x85) _XPAGE; /* Ramtron VRS51 family a.k.a.
+ MPAGE */
+
+\layout Verse
+
+\family typewriter
+__sfr __at (0x92) _XPAGE; /* Cypress EZ-USB family, Texas Instruments (Chipcon)
+ a.k.a.
+ MPAGE */
 
 \layout Verse
 
 \family typewriter
-__sfr __at (0xaf) _XPAGE; /* some Silicon Labs (Cygnal) chips */
+__sfr __at (0x91) _XPAGE; /* Infineon (Siemens) C500 family a.k.a.
+ XPAGE */
 
 \layout Verse
 
 \family typewriter
-__sfr __at (0xaa) _XPAGE; /* some Silicon Labs (Cygnal) chips */
+__sfr __at (0xaf) _XPAGE; /* some Silicon Labs (Cygnal) chips a.k.a.
+ EMI0CN */
+
+\layout Verse
+
+\family typewriter
+__sfr __at (0xaa) _XPAGE; /* some Silicon Labs (Cygnal) chips a.k.a.
+ EMI0CN */
 
 \layout Standard
 For more exotic implementations further customizations may be needed.
@@ -19577,8 +20433,8 @@ The port to the Freescale/Motorola HC08
  inline assembly and so are not yet usable.
 
 \layout Standard
-\added_space_bottom bigskip 
 \pagebreak_bottom 
+\added_space_bottom bigskip 
 The HC08 port passes the regression test suite (see section 
 \begin_inset LatexCommand \ref{sec:Quality-control}
 
@@ -19651,7 +20507,7 @@ For devices that have multiple code pages it is more efficient to use the
  pages and there's less page selection overhead.
 
 \layout Enumerate
- And as for any 8 bit micro (especially for PIC 14 as they have a very simple
+And as for any 8 bit micro (especially for PIC 14 as they have a very simple
  instruction set), use 'unsigned char' whereever possible instead of 'int'.
 
 \layout Subsection
@@ -19990,8 +20846,8 @@ Known bugs
 initialized data
 
 \layout Standard
-Currently, data can only be initialized if it resides in the source file
 \pagebreak_bottom 
+Currently, data can only be initialized if it resides in the source file
  together with 
 \emph on
 main()
@@ -20017,6 +20873,8 @@ collapsed true
 \end_inset
 
 
+\family default
+
 
 
 \layout Section
@@ -24688,8 +25546,8 @@ sdcdbsrc-serial nil
 The following is a list of key mapping for the debugger interface.
 
 \layout Standard
-\SpecialChar ~
 \pagebreak_bottom 
+\SpecialChar ~
 
 \family typewriter
 
@@ -25473,6 +26331,8 @@ Toggle list mode
 ;; 
 \newline
 
+\family default
+
 
 
 \layout Chapter
@@ -28456,8 +29316,8 @@ 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.
 \pagebreak_bottom 
+then SDCC is probably among the first choices.
  Well, probably SDCC might be the only choice.