title: Case insensitive string match
body: <p>I'm struggling with a problem with some AT&amp;T assembly syntax.</p>
  
  <p>Im using the "as" compiler on linux x86.</p>
  
  <p>Im making a password program but it needs to be case insensitive. To clarify, it should evaluate true regardless of the case of any given character.</p>
  
  <p>I have the normal evaluation process working correctly and i have it set up to iterate through a string.</p>
  
  <pre><code>#Comparison Routine
  
      movl $Password, %ebx     #Move the entire hardcoded password into ebx
      movl $buffer_data, %edx  #Move the entire input password into edx
      movl $Password_len, %ecx #Move the length of the input password into ecx
  
  0:  
      movb (%ebx), %al         #Move one byte of the hardcoded password into al
      xorb (%edx), %al         #Compare one byte of the input password to one byte of the hardedcoded
      jz SkipCase              #If they match, jump to SkipCase
  
  ##### 
  
      andb $32, %al   # 
      xorb (%edx), %al
  
      jz SkipCase
      jnz IncorrectOutput #   
  
  SkipCase:
      inc %ebx                #Iterate through the
      inc %edx                #strings and decrease
      dec %ecx                #the length variable
      jnz 0b                  #if we're not finished, continue
      jmp CorrectOutput       #If all is good, goto CorrectOutput
  </code></pre>
  
  <p>This is the section im struggling with, i can't figure out how to actually convert the character between cases. I'm aware i need to add or subtract 32 from it but something is amiss. Any comments or suggestions would be very helpful. Thanks.</p>
  
  <pre><code>andb $32, %al   # 
  xorb (%edx), %al
  </code></pre>
  
  <p>This is the section for coverting the case, i have tried <code>add</code>, <code>sub</code>, <code>and</code> and <code>or</code> and i just cant get it to work. i realise the <code>jz SkipCase</code> after this is not nessessary.</p>
  
  <p>The comparison routine is largely based off another question on here that i'll link if nessessary.</p>
  
  <p>Apologies for layout and excessive hashes, bad commenting style i know.</p>