home *** CD-ROM | disk | FTP | other *** search
/ Microsoft Programmer's Library 1.3 / Microsoft-Programers-Library-v1.3.iso / sampcode / alde_c / misc / lib / dlibssrc / strchr.s < prev    next >
Encoding:
Text File  |  1987-10-03  |  539 b   |  33 lines

  1. *    #include <stdio.h>
  2. *    
  3. *    char *strchr(string, symbol)
  4. *    register char *string;
  5. *    register char symbol;
  6. *    /*
  7. *     *    Return a pointer to the first occurance of <symbol> in <string>.
  8. *     *    NULL is returned if <symbol> is not found.
  9. *     */
  10. *    {
  11. *        do {
  12. *            if(*string == symbol)
  13. *                return(string);
  14. *        } while(*string++);
  15. *        return(NULL);
  16. *    }
  17.  
  18. .text
  19. .globl _strchr
  20. _strchr:
  21.     move.l    4(a7),a0
  22.     move.w    8(a7),d0
  23. strchr1:
  24.     cmp.b    (a0),d0
  25.     bne    strchr2
  26.     move.l    a0,d0
  27.     rts
  28. strchr2:
  29.     tst.b    (a0)+
  30.     bne    strchr1
  31.     clr.l    d0
  32.     rts
  33.