title: TASM pointer position comparison
body: <p>I am down to my last section of code for a program that checks if a given line is a palindrome. However, I have one thing that I need help with.</p>
  
  <p>I have pointers si and di, pointing at the first and last characters of the line. I use them to compare the characters, then move on. However, I also need to compare the positions of the pointers themselves, so I know where I need to stop as I know that the line is a palindrome.</p>
  
  <p>Here is the segment of code that does the comparing.</p>
  
  <pre><code>is_pol PROC near
  mov si, offset currentline
  mov di, offset currentline
  add di, currentline_offset
  
  comparesi:
      cmp si, 'a'         
          jl notsmallsi
      cmp si, 'z'
      jg notsymbolsi
      jmp comparedi
  notsmallsi:
      cmp si, 'A'
      jl notlargesi
      cmp si, 'Z'
      jg notsymbolsi
      jmp comparedi
  notlargesi:
      cmp si, '0'
      jl notsymbolsi
      cmp si, '9'
      jg notsymbolsi
      jmp comparedi
  notsymbolsi:
      inc si
      jmp comparesi
  comparedi:
      cmp di, 'a'
      jl notsmalldi
      cmp di, 'z'
      jg notsymboldi
      jmp compare
  notsmalldi:
      cmp di, 'A'
      jl notlargedi
      cmp di, 'Z'
      jg notsymboldi
      jmp compare
  notlargedi:
      cmp di, '0'
      jl notsymboldi
      cmp di, '9'
      jg notsymboldi
      jmp compare
  notsymboldi:
      dec di
      jmp comparedi
  compare:
      cmp si, di
      jne no_palindrome
      inc si
      dec di
  
      jmp is_palindrome
      jmp comparesi
  
  no_palindrome:
      lea dx, not_palindrome
      mov cx, 30
      ret
  
  is_palindrome:
      lea dx, palindrome
      mov cx, 30
      ret
  is_pol ENDP
  </code></pre>
  
  <p>The section of code that is missing is the one between "dec di" and "jmp is_palindrome"</p>
  
  <p>I appreciate the help.</p>