From: Evan C. <ca...@po...> - 2001-03-28 22:11:45
|
<html><head></head><body>I just bought one of those PAULMON 8051 starter boards to try out the 8051 controller. While looking over his hardware and associated source code, I came accross the following assembler code:<br> <br> mov dptr, #0x4003<br> mov a, #128<br> movx @dptr, a<br> <br> The question is, how can this be converted to C under sdcc<br> <pre class="moz-signature">-- Evan L. Carew E-Mail: <a class="moz-txt-link-abbreviated" href="mailto:ca...@po...">ca...@po...</a> Web: <a class="moz-txt-link-freetext" href="http://home.msen.com/~carew/">http://home.msen.com/~carew/</a> Linux, where do you want to go tomorrow? </pre> </body></html> |
From: Sandeep D. <sa...@dd...> - 2001-03-28 22:45:34
|
xdata at 0x4003 somevar; foo() { .... somevar = 128; .... } -----Original Message----- From: sdc...@li... [mailto:sdc...@li...]On Behalf Of Evan Carew Sent: Wednesday, March 28, 2001 2:12 PM To: SDCC Users Subject: [Sdcc-user] Assembler to C I just bought one of those PAULMON 8051 starter boards to try out the 8051 controller. While looking over his hardware and associated source code, I came accross the following assembler code: mov dptr, #0x4003 mov a, #128 movx @dptr, a The question is, how can this be converted to C under sdcc -- Evan L. Carew E-Mail: ca...@po... Web: http://home.msen.com/~carew/ Linux, where do you want to go tomorrow? _______________________________________________ Sdcc-user mailing list Sdc...@li... http://lists.sourceforge.net/lists/listinfo/sdcc-user |
From: Evan C. <ca...@po...> - 2001-03-29 01:50:13
|
<html><head></head><body>Sandeep,<br> <br> Hmm... As I read my original code, I saw on the first line that I was setting the dptr register at addresses 0x084 and 0x085 to the value 0x4003. Presumably that means half goes into the first address and half to the other. Looking at your code, it looks like you are setting "somevar" to address 0x4003, then writing to it directly. Does this mean this is the way to access external memory directly without having to use the DPTR register, or does the xdata operator (which I am unfimillar with) perform the magic for the programmer?<br> <br> If this is the case, could you point me to a reference or example of what xdata can do for me?<br> <br> Thanks<br> <br> Sandeep Dutta wrote:<br> <blockquote type="cite" cite="mid:001501c0b7d8$90fb9680$e11...@dd..."> <div><font color="#0000ff" size="2"><span class="380394222-28032001">xdata at 0x4003 somevar;</span></font></div> <div> </div> <div><font color="#0000ff" size="2"><span class="380394222-28032001">foo()</span></font></div> <div><font color="#0000ff" size="2"><span class="380394222-28032001">{</span></font></div> <div><font color="#0000ff" size="2"><span class="380394222-28032001"> ....</span></font></div> <div><font color="#0000ff" size="2"><span class="380394222-28032001"> somevar = 128;</span></font></div> <div><font color="#0000ff" size="2"><span class="380394222-28032001"> ....</span></font></div> <div><font color="#0000ff" size="2"><span class="380394222-28032001">}</span></font></div> <div> </div> <div> </div> <blockquote><div align="Left" class="OutlookMessageHeader" dir="Ltr"><font face="Tahoma" size="2">-----Original Message-----<br><b>From:</b> <a class="moz-txt-link-abbreviated" href="mailto:sdc...@li...">sdc...@li...</a> [<a class="moz-txt-link-freetext" href="mailto:sdc...@li...">mailto:sdc...@li...</a>]<b>On Behalf Of </b>Evan Carew<br><b>Sent:</b> Wednesday, March 28, 2001 2:12 PM<br><b>To:</b> SDCC Users<br><b>Subject:</b> [Sdcc-user] Assembler to C<br><br></font></div>I just bought one of those PAULMON 8051 starter boards to try out the 8051 controller. While looking over his hardware and associated source code, I came accross the following assembler code:<br><br>mov dptr, #0x4003<br>mov a, #128<br>movx @dptr, a<br><br>The question is, how can this be converted to C under sdcc<br></blockquote> </blockquote> <br> <pre class="moz-signature">-- Evan L. Carew E-Mail: <a class="moz-txt-link-abbreviated" href="mailto:ca...@po...">ca...@po...</a> Web: <a class="moz-txt-link-freetext" href="http://home.msen.com/~carew/">http://home.msen.com/~carew/</a> Linux, where do you want to go tomorrow? </pre> <br> </body></html> |