home *** CD-ROM | disk | FTP | other *** search
/ Groovy Bytes: Behind the Moon / groovybytes.iso / GROOVY / SND_TOOL / FUNK108A.ZIP / DOS32V30.ZIP / PAL / STRINGS / STRPBRK.ASM < prev    next >
Encoding:
Assembly Source File  |  1995-05-20  |  1.1 KB  |  47 lines

  1. ;****************************************************************************
  2. ; Filename: STRPBRK.ASM
  3. ;   Author: Adam Seychell
  4. ;  Version: 0.0
  5. ;  Created: 1995.April.20
  6. ;  Updated: -
  7. ;   
  8. ;****************************************************************************
  9. ; Copyright Adam Seychell, 1994-1995.
  10. ; All rights reserved.
  11. ;****************************************************************************
  12. ; Function: char *strpbrk(const char *s1, const char *s2);
  13. ;  Comment: Scans one string for the first occurrence of
  14. ;        any character that is in a second string
  15. ;    Input: Eax, pointer to string1
  16. ;           Edx, pointer to string2
  17. ;   Output: Pointer to first character in s1 that maches a character
  18. ;        appearing in s2. NUL if none maches found.
  19. ;****************************************************************************
  20. Include     STDDEF.INC
  21.  
  22.     Codeseg
  23.  
  24. Proc    strpbrk ,2
  25.     Push    Edi,Esi
  26.     Mov    Edi,Eax
  27.     Mov    Esi,Edx
  28. @@Next01:
  29.     Mov    Dl,[Edi]
  30.     Inc    Edi
  31.     TestZ    Dl
  32.     jz @@Error
  33.     Mov    Eax,Esi
  34.     Call    @strchr
  35.     TestZ    Eax
  36.     jz @@Next01
  37.     Lea    Eax,[Edi-1]
  38.     Pop    Esi,Edi
  39.     Ret
  40.  
  41. @@Error:
  42.     Clear    Eax
  43.     Pop    Esi,Edi
  44.     Ret
  45. Endp
  46.  
  47. End