title: How to test characters in a string [Assembly]
body: <p>I'm writing a program to search for vowels inside a string, but I'm having trouble testing the individual characters inside the string, I have the basic concept down and I've done this before using C++ and Python, but I don't know how to code it in Assembly.</p>
  
  <p>I'm going to use a switch to add up and test the individual characters, and I know that I need to use a loop to cycle through all the characters, but I'm stuck on actually testing individual characters. (this isn't what I have coded per say but an illustrative example)</p>
  
  <pre><code>max_length     dd      40
  user_input     resd    max_length
  str_len        dw      $ - user_input
  GetStr         user_input             ; "I am a boy"
  mov            ecx, str_len
  </code></pre>
  
  <p>And this is where I get stuck. How would you test the individual characters of <code>user_input</code> ? </p>
  
  <p>In C++ you would have something like <code>if(user_input[0] = 'Y')</code>, but how do I translate that type of instruction to assembly (user_input[0])</p>
  
  <p>I understand that it does not work this way in assembly but hopefully this will clear some things up.</p>
  
  <pre><code>str_len DW      $ - user_input
  max_length      EQU  40
  
  jump_table:   
          DD      case_0
          DD      case_1
          DD      case_2
          DD      case_3
          DD      case_4
          DD      case_5
  
  .UDATA
  
  user_input    resd      max_length
  
  
  _main:
      push    ebp
      mov     ebp, esp
  
  switch:    
      xor     eax,eax
      xor     ebx,ebx
      PutStr  prompt
      GetStr   user_input
      mov     ecx, [str_len]
      mov     esi, user_input
  
  read:    
      mov     al, byte [esi+ebx]
      or      al, 20h
      cmp     al, 'a'
      je      [jump_table]
      cmp     al, 'e'
      je      [jump_table+4]
      cmp     al, 'i'
      je      [jump_table+8]
      cmp     al, 'o'
      je      [jump_table+12]
      cmp     al, 'u'
      je      [jump_table+16]
      cmp     ecx, 0
      je      [jump_table+20]
      inc     ebx
      jmp     read
  </code></pre>
  
  <p>this is where I am now, as I commented further down I'm getting an error linked to <code>str_len</code></p>
  
  <p>This is all working, I just need to clear the buffer, Thanks!
      str_len         DD       40 
      max_length      EQU      40</p>
  
  <pre><code>jump_table:   
          DD      case_0
          DD      case_1
          DD      case_2
          DD      case_3
          DD      case_4
          DD      case_5
  
  .UDATA
  
  user_input    resb      max_length
  
  .CODE
  
  .STARTUP
  
  switch:    
      xor     eax,eax
      xor     ebx,ebx
      xor     esi, esi
      PutStr  prompt
      GetStr  user_input
      mov     ecx, [str_len]
      mov     esi, user_input
  
  read:    
      mov     al, byte [esi+ebx]
      or      al, 20h
      ;PutCh   al
      cmp     al, 'a'
      je      vowel_A
      cmp     al, 'e'
      je      vowel_E
      cmp     al, 'i'
      je      vowel_I
      cmp     al, 'o'
      je      vowel_O
      cmp     al, 'u'
      je      vowel_U
      cmp     ecx, 0
      je      str_end
      inc     ebx
      dec     ecx
      jmp     read
  </code></pre>