home *** CD-ROM | disk | FTP | other *** search
/ Large Pack of OldSkool DOS MOD Trackers / cdfm.zip / INDXWORD.RT < prev    next >
Text File  |  1992-07-28  |  733b  |  30 lines

  1. public  _indexword
  2. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  3. ; Find a word (2bytes) in a counted list
  4. ; In:
  5. ;   AX - word to find
  6. ;   EDX -> string of words, first byte is length (in words)
  7. ; Out:
  8. ;   CF=1 - not found
  9. ;   CF=0 - found
  10. ;     EAX - index
  11. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  12. _indexword:
  13.         push edi
  14.         push ecx
  15.         lea edi,[edx+1]
  16.         movzx ecx,byte ptr [edx]
  17.         repnz scasw
  18.         jnz short indexwordf0
  19.         movzx eax,byte ptr [edx]
  20.         sub eax,ecx
  21.         dec eax
  22.         jmp short indexwordf1
  23. indexwordf0:
  24.         stc
  25. indexwordf1:
  26.         pop ecx
  27.         pop edi
  28.         ret
  29.  
  30.