title: Accessing address of a string in inline assembly in gcc
body: <p>I have written the below assembly code to convert a string from lower case to uppercase, It's not completely working because i'm not able to access the address of a string that i'm converting. this code is not working why?</p>
  
  <pre><code>  #include&lt;stdio.h&gt;
    int convert(char *str)
    {
         char *ptr;
    __asm__ __volatile__ ( "movl (%1),%%ebx;"
                      "subl $1,%%ebx;"
                      "movl %%ebx,%0;"
              "REPEAT: addl $1,%%ebx;"
                      "testl %%ebx,%%ebx;"
                      "je END;"
                      "movzbl 0(%%ebx),%%ecx;"
                      "cmpl $97, %%ecx;"
                      "jb END;"
                      "cmpl $122,%%ecx;"
                      "ja END;"
                      "subb $32,0(%%ebx);"
                      "jmp REPEAT;"
                "END: movl %%ebx,(%0);"
                      :"=r" (ptr)
                      :"r"  (str)
                   );
     printf("converted string =%s\n", str);
   }
  
    int main()
    {
    int i;  
    char str[] = "convert";
  
    i = convert(str);
    return 0;
  
    }
  </code></pre>