+
+\series default
+ Hides your ugly and inefficient c-code from the asm file, so you can always
+ blame the compiler :).
+\layout List
+\labelwidthstring 00.00.0000
+
+
+\series bold
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-i-code-in-asm
+\begin_inset LatexCommand \index{-\/-i-code-in-asm}
+
+\end_inset
+
+
+\series default
+ Include i-codes in the asm file.
+ Sounds like noise but is most helpful for debugging the compiler itself.
+\layout List
+\labelwidthstring 00.00.0000
+
+
+\series bold
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-less-pedantic
+\begin_inset LatexCommand \index{-\/-less-pedantic}
+
+\end_inset
+
+
+\series default
+ Disable some of the more pedantic warnings (jwk burps: please be more specific
+ here, please!)
+\layout List
+\labelwidthstring 00.00.0000
+
+
+\series bold
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-print-search-dirs
+\begin_inset LatexCommand \index{-\/-print-search-dirs}
+
+\end_inset
+
+
+\series default
+ Display the directories in the compiler's search path
+\layout List
+\labelwidthstring 00.00.0000
+
+
+\series bold
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-vc
+\begin_inset LatexCommand \index{-\/-vc}
+
+\end_inset
+
+
+\series default
+ Display errors and warnings using MSVC style, so you can use SDCC with
+ visual studio
+\layout List
+\labelwidthstring 00.00.0000
+
+
+\series bold
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-use-stderr
+\begin_inset LatexCommand \index{-\/-use-stdout}
+
+\end_inset
+
+
+\series default
+ Send errors and warnings to stdout instead of stderr
+\layout Subsubsection
+
+Intermediate Dump Options
+\begin_inset LatexCommand \index{Options intermediate dump}
+
+\end_inset
+
+
+\begin_inset LatexCommand \index{Intermediate dump options}
+
+\end_inset
+
+
+\layout Standard
+
+The following options are provided for the purpose of retargetting and debugging
+ the compiler.
+ These provided a means to dump the intermediate code (iCode
+\begin_inset LatexCommand \index{iCode}
+
+\end_inset
+
+) generated by the compiler in human readable form at various stages of
+ the compilation process.
+
+\layout List
+\labelwidthstring 00.00.0000
+
+
+\series bold
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-dumpraw
+\begin_inset LatexCommand \index{-\/-dumpraw}
+
+\end_inset
+
+
+\series default
+ This option will cause the compiler to dump the intermediate code into
+ a file of named
+\emph on
+<source filename>.dumpraw
+\emph default
+ just after the intermediate code has been generated for a function, i.e.
+ before any optimizations are done.
+ The basic blocks
+\begin_inset LatexCommand \index{Basic blocks}
+
+\end_inset
+
+ at this stage ordered in the depth first number, so they may not be in
+ sequence of execution.
+\layout List
+\labelwidthstring 00.00.0000
+
+
+\series bold
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-dumpgcse
+\begin_inset LatexCommand \index{-\/-dumpgcse}
+
+\end_inset
+
+
+\series default
+ Will create a dump of iCode's, after global subexpression elimination
+\begin_inset LatexCommand \index{Global subexpression elimination}
+
+\end_inset
+
+, into a file named
+\emph on
+<source filename>.dumpgcse.
+\layout List
+\labelwidthstring 00.00.0000
+
+
+\series bold
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-dumpdeadcode
+\begin_inset LatexCommand \index{-\/-dumpdeadcode}
+
+\end_inset
+
+
+\series default
+ Will create a dump of iCode's, after deadcode elimination
+\begin_inset LatexCommand \index{Dead-code elimination}
+
+\end_inset
+
+, into a file named
+\emph on
+<source filename>.dumpdeadcode.
+\layout List
+\labelwidthstring 00.00.0000
+
+
+\series bold
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-dumploop
+\begin_inset LatexCommand \index{-\/-dumploop}
+
+\end_inset
+
+
+\series default
+\size large
+
+\size default
+Will create a dump of iCode's, after loop optimizations
+\begin_inset LatexCommand \index{Loop optimization}
+
+\end_inset
+
+, into a file named
+\emph on
+<source filename>.dumploop.
+\layout List
+\labelwidthstring 00.00.0000
+
+
+\series bold
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-dumprange
+\begin_inset LatexCommand \index{-\/-dumprange}
+
+\end_inset
+
+
+\series default
+\size large
+
+\size default
+Will create a dump of iCode's, after live range analysis
+\begin_inset LatexCommand \index{Live range analysis}
+
+\end_inset
+
+, into a file named
+\emph on
+<source filename>.dumprange.
+\layout List
+\labelwidthstring 00.00.0000
+
+
+\series bold
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-dumlrange
+\begin_inset LatexCommand \index{-\/-dumlrange}
+
+\end_inset
+
+
+\series default
+ Will dump the life ranges
+\begin_inset LatexCommand \index{Live range analysis}
+
+\end_inset
+
+ for all symbols.
+\layout List
+\labelwidthstring 00.00.0000
+
+
+\series bold
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-dumpregassign
+\begin_inset LatexCommand \index{-\/-dumpregassign}
+
+\end_inset
+
+
+\bar under
+
+\series default
+\bar default
+Will create a dump of iCode's, after register assignment
+\begin_inset LatexCommand \index{Register assignment}
+
+\end_inset
+
+, into a file named
+\emph on
+<source filename>.dumprassgn.
+\layout List
+\labelwidthstring 00.00.0000
+
+
+\series bold
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-dumplrange
+\begin_inset LatexCommand \index{-\/-dumplrange}
+
+\end_inset
+
+
+\series default
+ Will create a dump of the live ranges of iTemp's
+\layout List
+\labelwidthstring 00.00.0000
+
+
+\series bold
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-dumpall
+\begin_inset LatexCommand \index{-\/-dumpall}
+
+\end_inset
+
+
+\size large
+\bar under
+
+\series default
+\size default
+\bar default
+Will cause all the above mentioned dumps to be created.
+\layout Subsection
+
+Environment variables
+\begin_inset LatexCommand \index{Environment variables}
+
+\end_inset
+
+
+\layout Standard
+
+SDCC recognizes the following environment variables:
+\layout List
+\labelwidthstring 00.00.0000
+
+
+\series bold
+SDCC_LEAVE_SIGNALS
+\begin_inset LatexCommand \index{SDCC\_LEAVE\_SIGNALS}
+
+\end_inset
+
+
+\series default
+ SDCC installs a signal handler
+\begin_inset LatexCommand \index{signal handler}
+
+\end_inset
+
+ to be able to delete temporary files after an user break (^C) or an exception.
+ If this environment variable is set, SDCC won't install the signal handler
+ in order to be able to debug SDCC.
+\layout List
+\labelwidthstring 00.00.0000
+
+
+\series bold
+TMP
+\begin_inset LatexCommand \index{TMP}
+
+\end_inset
+
+,\SpecialChar ~
+TEMP
+\begin_inset LatexCommand \index{TEMP}
+
+\end_inset
+
+,\SpecialChar ~
+TMPDIR
+\begin_inset LatexCommand \index{TMPDIR}
+
+\end_inset
+
+
+\series default
+ Path, where temporary files will be created.
+ The order of the variables is the search order.
+ In a standard *nix environment these variables are not set, and there's
+ no need to set them.
+ On Windows it's recommended to set one of them.
+\layout List
+\labelwidthstring 00.00.0000
+
+
+\series bold
+SDCC_HOME
+\begin_inset LatexCommand \index{SDCC\_HOME}
+
+\end_inset
+
+
+\series default
+ Path, see
+\begin_inset Quotes sld
+\end_inset
+
+2.3 Install and search paths
+\begin_inset Quotes srd
+\end_inset
+
+.
+\layout List
+\labelwidthstring 00.00.0000
+
+
+\series bold
+SDCC_INCLUDE
+\begin_inset LatexCommand \index{SDCC\_INCLUDE}
+
+\end_inset
+
+
+\series default
+ Path, see
+\begin_inset Quotes sld
+\end_inset
+
+2.3 Install and search paths
+\begin_inset Quotes srd
+\end_inset
+
+.
+\layout List
+\labelwidthstring 00.00.0000
+
+
+\series bold
+SDCC_LIB
+\begin_inset LatexCommand \index{SDCC\_LIB}
+
+\end_inset
+
+
+\series default
+ Path, see
+\begin_inset Quotes sld
+\end_inset
+
+2.3 Install and search paths
+\begin_inset Quotes srd
+\end_inset
+
+.
+\layout Standard
+
+There are some more environment variables recognized by SDCC, but these
+ are solely used for debugging purposes.
+ They can change or disappear very quickly, and will never be documented.
+\layout Subsection
+
+MCS51/DS390 Storage Class
+\begin_inset LatexCommand \index{Storage class}
+
+\end_inset
+
+ Language Extensions
+\layout Standard
+
+In addition to the ANSI storage classes SDCC allows the following MCS51
+ specific storage classes.
+\layout Subsubsection
+
+xdata
+\begin_inset LatexCommand \index{xdata}
+
+\end_inset
+
+
+\layout Standard
+
+Variables declared with this storage class will be placed in the external
+ RAM.
+ This is the
+\series bold
+default
+\series default
+ storage class for Large Memory model, e.g.:
+\layout Verse
+
+
+\family typewriter
+xdata unsigned char xduc;
+\layout Subsubsection
+
+data
+\begin_inset LatexCommand \index{data}
+
+\end_inset
+
+
+\layout Standard
+
+This is the
+\series bold
+default
+\series default
+ storage class for Small Memory model.
+ Variables declared with this storage class will be allocated in the directly
+ addressable portion of the internal RAM of a 8051, e.g.:
+\layout Verse
+
+
+\family typewriter
+data int iramdata;
+\layout Subsubsection
+
+idata
+\begin_inset LatexCommand \index{idata}
+
+\end_inset
+
+
+\layout Standard
+
+Variables declared with this storage class will be allocated into the indirectly
+ addressable portion of the internal ram of a 8051, e.g.:
+\layout Verse
+
+
+\family typewriter
+idata int idi;
+\layout Subsubsection
+
+bit
+\begin_inset LatexCommand \index{bit}
+
+\end_inset
+
+
+\layout Standard
+
+This is a data-type and a storage class specifier.
+ When a variable is declared as a bit, it is allocated into the bit addressable
+ memory of 8051, e.g.:
+\layout Verse
+
+
+\family typewriter
+bit iFlag;
+\layout Subsubsection
+
+sfr
+\begin_inset LatexCommand \index{sfr}
+
+\end_inset
+
+ / sbit
+\begin_inset LatexCommand \index{sbit}
+
+\end_inset
+
+
+\layout Standard
+
+Like the bit keyword,
+\emph on
+sfr / sbit
+\emph default
+signifies both a data-type and storage class, they are used to describe
+ the special function registers and special bit variables of a 8051, eg:
+\layout Verse
+
+
+\family typewriter
+sfr at
+\begin_inset LatexCommand \index{at}
+
+\end_inset
+
+ 0x80 P0; /* special function register P0 at location 0x80 */
+\newline
+sbit at 0xd7 CY; /* CY (Carry Flag
+\begin_inset LatexCommand \index{Flags}
+
+\end_inset
+
+
+\begin_inset LatexCommand \index{Carry flag}
+
+\end_inset
+
+) */
+\layout Subsection
+
+Pointers
+\begin_inset LatexCommand \index{Pointers}
+
+\end_inset
+
+
+\layout Standard
+
+SDCC allows (via language extensions) pointers to explicitly point to any
+ of the memory spaces
+\begin_inset LatexCommand \index{Memory model}
+
+\end_inset
+
+ of the 8051.
+ In addition to the explicit pointers, the compiler uses (by default) generic
+ pointers which can be used to point to any of the memory spaces.
+\newline
+
+\newline
+Pointer declaration examples:
+\layout Verse
+
+
+\family typewriter
+/* pointer physically in xternal ram pointing to object in internal ram
+ */
+\newline
+data unsigned char * xdata p;
+\newline
+
+\newline
+/* pointer physically in code rom pointing to data in xdata space */
+\newline
+xdata unsigned char * code p;
+\newline
+
+\newline
+/* pointer physically in code space pointing to data in code space */
+\newline
+code unsigned char * code p;
+\newline
+
+\newline
+/* the following is a generic pointer physically located in xdata space
+ */
+\newline
+char * xdata p;
+\layout Standard
+
+Well you get the idea.
+
+\newline
+
+\newline
+All unqualified pointers are treated as 3-byte (4-byte for the ds390)
+\emph on
+generic
+\emph default
+ pointers.
+
+\size small
+
+\newline
+
+\newline
+
+\size default
+The highest order byte of the
+\emph on
+generic
+\emph default
+ pointers contains the data space information.
+ Assembler support routines are called whenever data is stored or retrieved
+ using
+\emph on
+generic
+\emph default
+ pointers.
+ These are useful for developing reusable library
+\begin_inset LatexCommand \index{Libraries}
+
+\end_inset
+
+ routines.
+ Explicitly specifying the pointer type will generate the most efficient
+ code.
+\layout Subsection
+
+Parameters
+\begin_inset LatexCommand \index{Parameters}
+
+\end_inset
+
+ & Local Variables
+\begin_inset LatexCommand \index{Local variable}
+
+\end_inset
+
+
+\layout Standard
+
+Automatic (local) variables and parameters to functions can either be placed
+ on the stack or in data-space.
+ The default action of the compiler is to place these variables in the internal
+ RAM (for small model) or external RAM (for large model).
+ This in fact makes them
+\emph on
+static
+\begin_inset LatexCommand \index{static}
+
+\end_inset
+
+
+\emph default
+ so by default functions are non-reentrant
+\begin_inset LatexCommand \index{reentrant}
+
+\end_inset
+
+.
+\newline
+
+\newline
+They can be placed on the stack
+\begin_inset LatexCommand \index{stack}
+
+\end_inset
+
+ either by using the
+\emph on
+ -
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-stack-auto
+\begin_inset LatexCommand \index{-\/-stack-auto}
+
+\end_inset
+
+
+\emph default
+ option or by using the
+\emph on
+reentrant
+\begin_inset LatexCommand \index{reentrant}
+
+\end_inset
+
+
+\emph default
+ keyword in the function declaration, e.g.:
+\layout Verse
+
+
+\family typewriter
+unsigned char foo(char i) reentrant
+\newline
+{
+\newline
+...
+
+\newline
+}
+\layout Standard
+
+Since stack space on 8051 is limited, the
+\emph on
+reentrant
+\emph default
+keyword or the
+\emph on
+ -
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-stack-auto
+\emph default
+ option should be used sparingly.
+ Note that the reentrant keyword just means that the parameters & local
+ variables will be allocated to the stack, it
+\emph on
+does not
+\emph default
+ mean that the function is register bank independent.
+\newline
+
+\newline
+Local variables can be assigned storage classes and absolute
+\begin_inset LatexCommand \index{Absolute addressing}
+
+\end_inset
+
+ addresses, e.g.:
+\layout Verse
+
+
+\family typewriter
+unsigned char foo() {
+\newline
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+xdata unsigned char i;
+\newline
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+bit bvar;
+\newline
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+data at 0x31 unsigned char j;
+\newline
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+...
+
+\newline
+}
+\layout Standard
+
+In the above example the variable
+\emph on
+i
+\emph default
+ will be allocated in the external ram,
+\emph on
+bvar
+\emph default
+ in bit addressable space and
+\emph on
+ j
+\emph default
+ in internal ram.
+ When compiled with
+\emph on
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-stack-auto
+\emph default
+ or when a function is declared as
+\emph on
+reentrant
+\emph default
+ this should only be done for static variables.
+\layout Standard
+
+Parameters however are not allowed any storage class, (storage classes for
+ parameters will be ignored), their allocation is governed by the memory
+ model in use, and the reentrancy options.
+\layout Subsection
+
+Overlaying
+\begin_inset LatexCommand \index{Overlaying}
+
+\end_inset
+
+
+\layout Standard
+
+For non-reentrant
+\begin_inset LatexCommand \index{reentrant}
+
+\end_inset
+
+ functions SDCC will try to reduce internal ram space usage by overlaying
+ parameters and local variables of a function (if possible).
+ Parameters and local variables of a function will be allocated to an overlayabl
+e segment if the function has
+\emph on
+no other function calls and the function is non-reentrant and the memory
+ model
+\begin_inset LatexCommand \index{Memory model}
+
+\end_inset
+
+ is small.
+
+\emph default
+ If an explicit storage class
+\begin_inset LatexCommand \index{Storage class}
+
+\end_inset
+
+ is specified for a local variable, it will NOT be overlayed.
+\layout Standard
+
+Note that the compiler (not the linkage editor) makes the decision for overlayin
+g the data items.
+ Functions that are called from an interrupt service routine should be preceded
+ by a #pragma\SpecialChar ~
+NOOVERLAY
+\begin_inset LatexCommand \index{\#pragma NOOVERLAY}
+
+\end_inset
+
+ if they are not reentrant.
+\layout Standard
+
+Also note that the compiler does not do any processing of inline
+\begin_inset LatexCommand \index{inline}
+
+\end_inset
+
+ assembler code, so the compiler might incorrectly assign local variables
+ and parameters of a function into the overlay segment if the inline assembler
+ code calls other c-functions that might use the overlay.
+ In that case the #pragma\SpecialChar ~
+NOOVERLAY should be used.
+\layout Standard
+
+Parameters and Local variables of functions that contain 16 or 32 bit multiplica
+tion
+\begin_inset LatexCommand \index{Multiplication}
+
+\end_inset
+
+ or division
+\begin_inset LatexCommand \index{Division}
+
+\end_inset
+
+ will NOT be overlayed since these are implemented using external functions,
+ e.g.:
+\layout Verse
+
+
+\family typewriter
+#pragma SAVE
+\newline
+#pragma NOOVERLAY
+\begin_inset LatexCommand \index{\#pragma NOOVERLAY}
+
+\end_inset
+
+
+\newline
+void set_error(unsigned char errcd)
+\newline
+{
+\newline
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+P3 = errcd;
+\newline
+}
+\newline
+#pragma RESTORE
+\newline
+
+\newline
+void some_isr () interrupt
+\begin_inset LatexCommand \index{interrupt}
+
+\end_inset
+
+ 2 using
+\begin_inset LatexCommand \index{using}
+
+\end_inset
+
+ 1
+\newline
+{
+\newline
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+...
+\newline
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+set_error(10);
+\newline
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+...
+
+\newline
+}
+\layout Standard
+
+In the above example the parameter
+\emph on
+errcd
+\emph default
+ for the function
+\emph on
+set_error
+\emph default
+ would be assigned to the overlayable segment if the #pragma\SpecialChar ~
+NOOVERLAY was
+ not present, this could cause unpredictable runtime behavior when called
+ from an ISR.
+ The #pragma\SpecialChar ~
+NOOVERLAY ensures that the parameters and local variables for
+ the function are NOT overlayed.
+\layout Subsection
+
+Interrupt Service Routines
+\layout Standard
+
+SDCC allows interrupt service routines to be coded in C, with some extended
+ keywords.
+\layout Verse
+
+
+\family typewriter
+void timer_isr (void) interrupt 1 using 1
+\newline
+{
+\newline
+..
+
+\newline
+}
+\layout Standard
+
+The optional number following the
+\emph on
+interrupt
+\begin_inset LatexCommand \index{interrupt}
+
+\end_inset
+
+
+\emph default
+ keyword is the interrupt number this routine will service.
+ When present, the compiler will insert a call to this routine in the
+ interrupt vector table for the interrupt number specified.
+ The
+\emph on
+using
+\emph default
+ keyword can be used to tell the compiler to use the specified register
+ bank (8051 specific) when generating code for this function.
+ Note that when some function is called from an interrupt service routine
+ it should be preceded by a #pragma\SpecialChar ~
+NOOVERLAY
+\begin_inset LatexCommand \index{\#pragma NOOVERLAY}
+
+\end_inset
+
+ if it is not reentrant.
+ Furthermore nonreentrant functions should not be called from the main program
+ while the interrupt service routine might be active.
+ If the interrupt service routines changes variables which are accessed
+ by other functions these variables should be declared
+\emph on
+volatile
+\emph default
+
+\begin_inset LatexCommand \index{volatile}
+
+\end_inset
+
+.
+
+\layout Standard
+
+A special note here, int (16 bit) and long (32 bit) integer division
+\begin_inset LatexCommand \index{Division}
+
+\end_inset
+
+, multiplication
+\begin_inset LatexCommand \index{Multiplication}
+
+\end_inset
+
+ & modulus
+\begin_inset LatexCommand \index{Modulus}
+
+\end_inset
+
+ operations are implemented using external support routines developed in
+ ANSI-C, if an interrupt service routine needs to do any of these operations
+ then the support routines (as mentioned in a following section) will have
+ to be recompiled using the
+\emph on
+ -
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-stack-auto
+\begin_inset LatexCommand \index{-\/-stack-auto}
+
+\end_inset
+
+
+\emph default
+ option and the source file will need to be compiled using the
+\emph on
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-int-long-ren
+\emph default
+t
+\begin_inset LatexCommand \index{-\/-int-long-rent}
+
+\end_inset
+
+ compiler option.
+\layout Standard
+
+If you have multiple source files in your project, interrupt service routines
+ can be present in any of them, but a prototype of the isr MUST be present
+ or included in the file that contains the function
+\emph on
+main
+\emph default
+.
+\layout Standard
+
+Interrupt numbers and the corresponding address & descriptions for the Standard
+ 8051/8052 are listed below.
+ SDCC will automatically adjust the interrupt vector table to the maximum
+ interrupt number specified.
+\newline
+
+\layout Standard
+\align center
+
+\begin_inset Tabular
+<lyxtabular version="3" rows="7" columns="3">
+<features>
+<column alignment="center" valignment="top" leftline="true" width="0in">
+<column alignment="center" valignment="top" leftline="true" width="0in">
+<column alignment="center" valignment="top" leftline="true" rightline="true" width="0in">
+<row topline="true" bottomline="true">
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+Interrupt #
+\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
+
+Vector Address
+\end_inset
+</cell>
+</row>
+<row topline="true">
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+0
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+External 0
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+0x0003
+\end_inset
+</cell>
+</row>
+<row topline="true">
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+1
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+Timer 0
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+0x000B
+\end_inset
+</cell>
+</row>
+<row topline="true">
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+2
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+External 1
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+0x0013
+\end_inset
+</cell>
+</row>
+<row topline="true">
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+3
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+Timer 1
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+0x001B
+\end_inset
+</cell>
+</row>
+<row topline="true">
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+4
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+Serial
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+0x0023
+\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
+
+5
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+Timer 2 (8052)
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+0x002B
+\end_inset
+</cell>
+</row>
+</lyxtabular>
+
+\end_inset
+
+
+\newline
+
+\layout Standard
+
+If the interrupt service routine is defined without
+\emph on
+using
+\begin_inset LatexCommand \index{using}
+
+\end_inset
+
+
+\emph default
+ a register bank or with register bank 0 (using 0), the compiler will save
+ the registers used by itself on the stack upon entry and restore them at
+ exit, however if such an interrupt service routine calls another function
+ then the entire register bank will be saved on the stack.
+ This scheme may be advantageous for small interrupt service routines which
+ have low register usage.
+\layout Standard
+
+If the interrupt service routine is defined to be using a specific register
+ bank then only
+\emph on
+a, b & dptr
+\emph default
+ are save and restored, if such an interrupt service routine calls another
+ function (using another register bank) then the entire register bank of
+ the called function will be saved on the stack.
+ This scheme is recommended for larger interrupt service routines.
+\layout Standard
+
+Calling other functions from an interrupt service routine is not recommended,
+ avoid it if possible.
+\newline
+
+\newline
+Also see the _naked modifier.
+\layout Subsection
+
+Critical Functions
+\layout Standard
+
+
+\shape italic
+<TODO: this isn't implemented at all!>
+\shape default
+
+\newline
+
+\newline
+A special keyword may be associated with a function declaring it as
+\emph on
+critical
+\emph default
+.
+ SDCC will generate code to disable all interrupts upon entry to a critical
+ function and enable them back before returning.
+ Note that nesting critical functions may cause unpredictable results.
+\layout Verse
+
+
+\family typewriter
+int foo () critical
+\newline
+{
+\newline
+...
+
+\newline
+...
+
+\newline
+}
+\layout Standard
+
+The critical attribute maybe used with other attributes like
+\emph on
+reentrant.
+\layout Subsection
+
+Naked Functions
+\begin_inset LatexCommand \index{Naked functions}
+
+\end_inset
+
+
+\layout Standard
+
+A special keyword may be associated with a function declaring it as
+\emph on
+_naked
+\begin_inset LatexCommand \index{\_naked}
+
+\end_inset
+
+.
+
+\emph default
+The
+\emph on
+_naked
+\emph default
+ function modifier attribute prevents the compiler from generating prologue
+\begin_inset LatexCommand \index{function prologue}
+
+\end_inset
+
+ and epilogue
+\begin_inset LatexCommand \index{function epilogue}
+
+\end_inset
+
+ code for that function.
+ This means that the user is entirely responsible for such things as saving
+ any registers that may need to be preserved, selecting the proper register
+ bank, generating the
+\emph on
+return
+\emph default
+ instruction at the end, etc.
+ Practically, this means that the contents of the function must be written
+ in inline assembler.
+ This is particularly useful for interrupt functions, which can have a large
+ (and often unnecessary) prologue/epilogue.
+ For example, compare the code generated by these two functions:
+\layout Verse
+
+
+\family typewriter
+volatile
+\begin_inset LatexCommand \index{volatile}
+
+\end_inset
+
+ data unsigned char counter;
+\newline
+void simpleInterrupt(void) interrupt
+\begin_inset LatexCommand \index{interrupt}
+
+\end_inset
+
+ 1
+\newline
+{
+\newline
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+counter++;
+\newline
+}
+\newline
+
+\newline
+void nakedInterrupt(void) interrupt 2 _naked
+\newline
+{
+\newline
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+_asm
+\begin_inset LatexCommand \index{\_asm}
+
+\end_inset
+
+
+\newline
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+inc\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+_counter
+\newline
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+reti\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+; MUST explicitly include ret or reti in _naked function.
+\newline
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+_endasm
+\begin_inset LatexCommand \index{\_endasm}
+
+\end_inset
+
+;
+\newline
+}
+\layout Standard
+
+For an 8051 target, the generated simpleInterrupt looks like:
+\layout Verse
+
+
+\family typewriter
+_simpleIterrupt:
+\newline
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+push\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+acc
+\newline
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+push\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+b
+\newline
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+push\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+dpl
+\newline
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+push\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+dph
+\newline
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+push\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+psw
+\newline
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+mov\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+psw,#0x00
+\newline
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+inc\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+_counter
+\newline
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+pop\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+psw
+\newline
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+pop\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+dph
+\newline
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+pop\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+dpl
+\newline
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+pop\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+b
+\newline
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+pop\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+acc
+\newline
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+reti
+\layout Standard
+
+whereas nakedInterrupt looks like:
+\layout Verse
+
+
+\family typewriter
+_nakedInterrupt:
+\newline
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+inc\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+_counter
+\newline
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+reti\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+; MUST explicitly include ret(i) in _naked function.
+\layout Standard
+
+While there is nothing preventing you from writing C code inside a _naked
+ function, there are many ways to shoot yourself in the foot doing this,
+ and it is recommended that you stick to inline assembler.
+\layout Subsection
+
+Functions using private banks
+\begin_inset LatexCommand \index{bank}
+
+\end_inset
+
+
+\layout Standard
+
+The
+\emph on
+using
+\begin_inset LatexCommand \index{using}
+
+\end_inset
+
+
+\emph default
+ attribute (which tells the compiler to use a register bank other than the
+ default bank zero) should only be applied to
+\emph on
+interrupt
+\begin_inset LatexCommand \index{interrupt}
+
+\end_inset
+
+
+\emph default
+ functions (see note 1 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
+\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{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
+
+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 Subsection
+
+Absolute Addressing
+\begin_inset LatexCommand \index{Absolute addressing}
+
+\end_inset
+
+
+\layout Standard
+
+Data items can be assigned an absolute address with the
+\emph on
+at
+\begin_inset LatexCommand \index{at}
+
+\end_inset
+
+ <address>
+\emph default
+ keyword, in addition to a storage class, e.g.:
+\layout Verse
+
+
+\family typewriter
+xdata
+\begin_inset LatexCommand \index{xdata}
+
+\end_inset
+
+ at
+\begin_inset LatexCommand \index{at}
+
+\end_inset
+
+ 0x7ffe unsigned int chksum;
+\layout Standard
+
+In the above example the variable chksum will located at 0x7ffe and 0x7fff
+ of the external ram.
+ The compiler does not actually reserve any space for variables declared
+ in this way (they are implemented with an equate in the assembler).
+ Thus it is left to the programmer to make sure there are no overlaps with
+ other variables that are declared without the absolute address.
+ The assembler listing file (.lst
+\begin_inset LatexCommand \index{.lst}
+
+\end_inset
+
+) and the linker output files (.rst
+\begin_inset LatexCommand \index{.rst}
+
+\end_inset
+
+) and (.map
+\begin_inset LatexCommand \index{.map}
+
+\end_inset
+
+) are good places to look for such overlaps.
+\layout Standard
+
+In case of memory mapped I/O devices the keyword
+\emph on
+volatile
+\emph default
+ should be used to tell the compiler that accesses might not be optimized
+ away:
+\layout Verse
+
+
+\family typewriter
+volatile
+\begin_inset LatexCommand \index{volatile}
+
+\end_inset
+
+ xdata
+\begin_inset LatexCommand \index{xdata}
+
+\end_inset
+
+ at
+\begin_inset LatexCommand \index{at}
+
+\end_inset
+
+ 0x8000 unsigned char PORTA_8255;
+\layout Standard
+
+Absolute address can be specified for variables in all storage classes,
+ e.g.:
+\layout Verse
+
+
+\family typewriter
+bit
+\begin_inset LatexCommand \index{bit}
+
+\end_inset
+
+ at
+\begin_inset LatexCommand \index{at}
+
+\end_inset
+
+ 0x02 bvar;
+\layout Standard
+
+The above example will allocate the variable at offset 0x02 in the bit-addressab
+le space.
+ There is no real advantage to assigning absolute addresses to variables
+ in this manner, unless you want strict control over all the variables allocated.
+ One possible use would be to write hardware portable code.
+ For example, if you have a routine that uses one or more of the microcontroller
+ I/O pins, and such pins are different for two different hardwares, you
+ can declare the I/O pins in you routine using
+\layout Verse
+
+
+\family typewriter
+extern bit SDI;
+\newline
+extern bit SCLK;
+\newline
+extern bit CPOL;
+\newline
+
+\newline
+void DS1306_put(unsigned char value)
+\newline
+{
+\newline
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+unsigned char mask=0x80;
+\newline
+
+\newline
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+while(mask)
+\newline
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+{
+\newline
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+SDI=(value & mask)?1:0;
+\newline
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+SCLK=!CPOL;
+\newline
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+SCLK=CPOL;
+\newline
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+mask/=2;
+\newline
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+}
+\newline
+}
+\layout Standard
+
+Then, someplace in the code for the first hardware you would use
+\layout Verse
+
+
+\family typewriter
+bit at 0x80 SDI;\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+/*I/O port 0, bit 0*/
+\newline
+bit at 0x81 SCLK;\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+/*I/O port 0, bit 1*/
+\newline
+bit CPOL;\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+/*This is a variable, let the linker allocate this one*/
+\layout Standard
+
+Similarly, for the second hardware you would use
+\layout Verse
+
+
+\family typewriter
+bit at 0x83 SDI;\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+/*I/O port 0, bit 3*/
+\newline
+bit at 0x91 SCLK;\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+/*I/O port 1, bit 1*/
+\newline
+bit CPOL;\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+/*This is a variable, let the linker allocate this one*/
+\layout Standard
+
+and you can use the same hardware dependent routine without changes, as
+ for example in a library.
+ This is somehow similar to sbit, but only one absolute address has to be
+ specified in the whole project.
+\layout Subsection
+
+Startup Code
+\begin_inset LatexCommand \index{Startup code}
+
+\end_inset
+
+
+\layout Standard
+
+The compiler inserts a call to the C routine
+\emph on
+_sdcc_external_startup()
+\begin_inset LatexCommand \index{\_sdcc\_external\_startup()}
+
+\end_inset
+
+
+\series bold
+\emph default
+
+\series default
+at the start of the CODE area.
+ This routine is 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 Other wise static & global variables will be initialized
+ before the function main is invoked.
+ You could add a
+\emph on
+_sdcc_external_startup()
+\emph default
+ routine to your program to override the default if you need to setup hardware
+ or perform some other critical operation prior to static & global variable
+ initialization.
+\layout Subsection
+
+Inline Assembler Code
+\begin_inset LatexCommand \index{Assembler routines}
+
+\end_inset
+
+
+\layout Standard
+
+SDCC allows the use of in-line assembler with a few restriction as regards
+ labels.
+ All labels defined within inline assembler code
+\emph on
+has to be
+\emph default
+ of the form
+\emph on
+nnnnn$
+\emph default
+ where nnnn is a number less than 100 (which implies a limit of utmost 100
+ inline assembler labels
+\emph on
+per function
+\emph default
+\noun on
+)
+\noun default
+.
+ It is strongly recommended that each assembly instruction (including labels)
+ be placed in a separate line (as the example shows).
+ When the
+\emph on
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-peep-asm
+\begin_inset LatexCommand \index{-\/-peep-asm}
+
+\end_inset
+
+
+\emph default
+ command line option is used, the inline assembler code will be passed through
+ the peephole optimizer
+\begin_inset LatexCommand \index{Peephole optimizer}
+
+\end_inset
+
+.
+ This might cause some unexpected changes in the inline assembler code.
+ Please go through the peephole optimizer rules defined in file
+\emph on
+SDCCpeeph.def
+\emph default
+ carefully before using this option.
+\layout Verse
+
+
+\family typewriter
+_asm
+\begin_inset LatexCommand \index{\_asm}
+
+\end_inset
+
+
+\newline
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+mov\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+b,#10
+\newline
+00001$:
+\newline
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+djnz\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+b,00001$
+\newline
+_endasm
+\begin_inset LatexCommand \index{\_endasm}
+
+\end_inset
+
+ ;
+\layout Standard
+
+The inline assembler code can contain any valid code understood by the assembler
+, this includes any assembler directives and comment lines.
+ The compiler does not do any validation of the code within the
+\family typewriter
+_asm ...
+ _endasm;
+\family default
+ keyword pair.
+
+\newline
+
+\newline
+Inline assembler code cannot reference any C-Labels, however it can reference
+ labels
+\begin_inset LatexCommand \index{Labels}
+
+\end_inset
+
+ defined by the inline assembler, e.g.:
+\layout Verse
+
+
+\family typewriter
+foo() {
+\newline
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+/* some c code */
+\newline
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+_asm
+\newline
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+; some assembler code
+\newline
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+ljmp $0003
+\newline
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+_endasm;
+\newline
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+/* some more c code */
+\newline
+clabel:\SpecialChar ~
+\SpecialChar ~
+/* inline assembler cannot reference this label */
+\newline
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~