title: Str_compare -- from Irvine's assembly book
body: <pre><code>    Str_compare PROC USES eax edx esi edi,
          string1: PTR BYTE,
          string2: PTR BYTE
      ;
      ; Compare two strings.
      ; Returns nothing, but the Zero and Carry flags are affected
      ; exactly as they would be by the CMP instruction.
      ;-----------------------------------------------------------
          mov  esi, string1
          mov  edi, string2
      L1: mov  al, [esi]
          mov  dl, [edi]
          cmp  al, 0
          jne  L2
          cmp  dl, 0
          jne  L2
          jmp  L3
  
      L2: inc  esi
          inc  edi
          cmp  al, dl
          je   L1
  
      L3: ret
      Str_compare ENDP
  </code></pre>
  
  <p>Against the code above, what if <code>string1</code> is just <code>byte 0</code> and <code>string2</code> is some common string whose length is not 0?<br>
  I suppose, when cpu enter L1 at the first time, IP will jump to L2 after <code>cmp dl, 0</code>. <code>inc esi</code> will make esi point to an content-unknown byte right after the 0 byte of string1, so this program break down, right?</p>