Sophie

Sophie

distrib > Fedora > 14 > x86_64 > media > updates > by-pkgid > e677bbbdff6d27fe001f15e0ef2bb4cc > files > 250

sdcc-3.0.0-0.fc14.x86_64.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">

<!--Converted with LaTeX2HTML 2008 (1.71)
original version by:  Nikos Drakos, CBLU, University of Leeds
* revised and updated by:  Marcus Hennecke, Ross Moore, Herb Swan
* with significant contributions from:
  Jens Lippmann, Marek Rouchal, Martin Wilck and others -->
<HTML>
<HEAD>
<TITLE>3.13.3 Use of Labels within Inline Assembler</TITLE>
<META NAME="description" CONTENT="3.13.3 Use of Labels within Inline Assembler">
<META NAME="keywords" CONTENT="sdccman">
<META NAME="resource-type" CONTENT="document">
<META NAME="distribution" CONTENT="global">

<META NAME="Generator" CONTENT="LaTeX2HTML v2008">
<META HTTP-EQUIV="Content-Style-Type" CONTENT="text/css">

<LINK REL="STYLESHEET" HREF="sdccman.css">

<LINK REL="previous" HREF="node83.html">
<LINK REL="up" HREF="node81.html">
<LINK REL="next" HREF="node85.html">
</HEAD>

<BODY >
<!--Navigation Panel-->
<A NAME="tex2html1933"
  HREF="node85.html">
<IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="next.png"></A> 
<A NAME="tex2html1927"
  HREF="node81.html">
<IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="up.png"></A> 
<A NAME="tex2html1923"
  HREF="node83.html">
<IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="prev.png"></A> 
<A NAME="tex2html1929"
  HREF="node1.html">
<IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents" SRC="contents.png"></A> 
<A NAME="tex2html1931"
  HREF="node191.html">
<IMG WIDTH="43" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="index" SRC="index.png"></A> 
<BR>
<B> Next:</B> <A NAME="tex2html1934"
  HREF="node85.html">3.14 Interfacing with Assembler</A>
<B> Up:</B> <A NAME="tex2html1928"
  HREF="node81.html">3.13 Inline Assembler Code</A>
<B> Previous:</B> <A NAME="tex2html1924"
  HREF="node83.html">3.13.2 Naked Functions</A>
 &nbsp; <B>  <A NAME="tex2html1930"
  HREF="node1.html">Contents</A></B> 
 &nbsp; <B>  <A NAME="tex2html1932"
  HREF="node191.html">Index</A></B> 
<BR>
<BR>
<!--End of Navigation Panel-->

<H2><A NAME="SECTION004133000000000000000">
3.13.3 Use of Labels within Inline Assembler</A>
</H2>

<P>
SDCC allows the use of in-line assembler with a few restrictions regarding
labels. All labels defined within inline assembler code have to be
of the form <I>nnnnn$</I> where nnnnn is a number less than 100 (which
implies a limit of utmost 100 inline assembler labels <I>per function</I>).<A NAME="tex2html39"
  HREF="footnode.html#foot2308"><SUP>3.7</SUP></A> 
<BLOCKQUOTE>
<TT>__asm<A NAME="2310"></A><A NAME="2311"></A> </TT>&nbsp;
<BR><TT>&nbsp;&nbsp;&nbsp;&nbsp;mov&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;b,#10 </TT>&nbsp;
<BR><TT>00001$: </TT>&nbsp;
<BR><TT>&nbsp;&nbsp;&nbsp;&nbsp;djnz&nbsp;&nbsp;&nbsp;&nbsp;b,00001$ </TT>&nbsp;
<BR><TT>__endasm<A NAME="2315"></A><A NAME="2316"></A>
;</TT>

</BLOCKQUOTE>
Inline assembler code cannot reference any C-labels, however it can
reference labels<A NAME="2318"></A> defined by the inline assembler, e.g.:
<BLOCKQUOTE>
<TT>foo() { </TT>&nbsp;
<BR><TT>&nbsp;&nbsp;&nbsp;&nbsp;/* some c code */ </TT>&nbsp;
<BR><TT>&nbsp;&nbsp;&nbsp;&nbsp;__asm </TT>&nbsp;
<BR><TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;; some assembler code </TT>&nbsp;
<BR><TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ljmp 0003$ </TT>&nbsp;
<BR><TT>&nbsp;&nbsp;&nbsp;&nbsp;__endasm; </TT>&nbsp;
<BR><TT>&nbsp;&nbsp;&nbsp;&nbsp;/* some more c code */ </TT>&nbsp;
<BR><TT>clabel:&nbsp;&nbsp;/* inline assembler cannot reference this
label */ </TT><A NAME="tex2html40"
  HREF="footnode.html#foot5878"><SUP>3.8</SUP></A>&nbsp;
<BR><TT>&nbsp;&nbsp;&nbsp;&nbsp;__asm</TT>&nbsp;
<BR><TT>&nbsp;&nbsp;&nbsp;&nbsp;0003$: ;label (can be referenced by inline assembler
only) </TT>&nbsp;
<BR><TT>&nbsp;&nbsp;&nbsp;&nbsp;__endasm<A NAME="2335"></A><A NAME="2336"></A>
; </TT>&nbsp;
<BR><TT>&nbsp;&nbsp;&nbsp;&nbsp;/* some more c code */</TT>&nbsp;
<BR><TT>}</TT>

</BLOCKQUOTE>
In other words inline assembly code can access labels defined in inline
assembly within the scope of the function. The same goes the other
way, i.e. labels defines in inline assembly can not be accessed by
C statements.

<P>
<HR>
<!--Navigation Panel-->
<A NAME="tex2html1933"
  HREF="node85.html">
<IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="next.png"></A> 
<A NAME="tex2html1927"
  HREF="node81.html">
<IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="up.png"></A> 
<A NAME="tex2html1923"
  HREF="node83.html">
<IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="prev.png"></A> 
<A NAME="tex2html1929"
  HREF="node1.html">
<IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents" SRC="contents.png"></A> 
<A NAME="tex2html1931"
  HREF="node191.html">
<IMG WIDTH="43" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="index" SRC="index.png"></A> 
<BR>
<B> Next:</B> <A NAME="tex2html1934"
  HREF="node85.html">3.14 Interfacing with Assembler</A>
<B> Up:</B> <A NAME="tex2html1928"
  HREF="node81.html">3.13 Inline Assembler Code</A>
<B> Previous:</B> <A NAME="tex2html1924"
  HREF="node83.html">3.13.2 Naked Functions</A>
 &nbsp; <B>  <A NAME="tex2html1930"
  HREF="node1.html">Contents</A></B> 
 &nbsp; <B>  <A NAME="tex2html1932"
  HREF="node191.html">Index</A></B> 
<!--End of Navigation Panel-->
<ADDRESS>

2011-03-20
</ADDRESS>
</BODY>
</HTML>