<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://community.arm.com/utility/feedstylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>What does LDRB do here?</title><link>https://community.arm.com/developer/tools-software/tools/f/keil-forum/35319/what-does-ldrb-do-here</link><description> 
Hello. 
I&amp;#39;ve been looking at a piece of code that I&amp;#39;m not entirely sure what
it does. 

 
 LDR r0, =str
 MOV r1, #0
loop
 LDRB r2, [r0], #1
 ADD r1, r1, #1
 CMP r2, #0
 BNE loop
 SUB r1, r1, #1
Data Segment Little Endian Format
 str DCB &amp;quot;mCQ5Gtq&amp;quot;,0</description><dc:language>en-US</dc:language><generator>Telligent Community 10</generator><item><title>RE: What does LDRB do here?</title><link>https://community.arm.com/thread/71026?ContentTypeID=1</link><pubDate>Fri, 30 Nov 2018 00:41:45 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:0e627e6d-86fd-4b26-9bf7-5aa9a419c6fa</guid><dc:creator>Andy Neil</dc:creator><description>&lt;p&gt;&lt;p&gt;
You could always run it in the &lt;b&gt;Simulator&lt;/b&gt; - and watch what
it does ... ?&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: What does LDRB do here?</title><link>https://community.arm.com/thread/86447?ContentTypeID=1</link><pubDate>Thu, 29 Nov 2018 18:53:54 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:b1e89391-3364-4583-a619-1d352c0abb8c</guid><dc:creator>Westonsupermare Pier</dc:creator><description>&lt;p&gt;&lt;p&gt;
Equivalent to&lt;/p&gt;

&lt;pre&gt;
char str[] = &amp;quot;mCQ5Gtq&amp;quot;;
uint8_t *r0 = str; // pointer is 32-bit wide
uint32_t r1 = 0;

do
{
  r2 = *r0++; // LDRB r2, [r0], #1
  r1++;
}while(r2); // while not NUL
r1--;
&lt;/pre&gt;

&lt;p&gt;
R0 is a 32-bit pointer, for a byte, it reads the byte into R2, and
increments R0 by 1&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>