home *** CD-ROM | disk | FTP | other *** search
- ;STRNCHR - Search for matching character.
- ; char *strnchr(addr: address; len: integer; pat: char);
-
- ; This is like strchr (=index) except that it works with fixed length
- ; strings.
-
- cseg
- public strnchr_
-
- strnchr_:pop bx
- pop di ;start address
- pop cx ;length
- pop ax ;character to match
- push ax
- push cx
- push di
- push bx
-
- cld
- push ds
- pop es
- jcxz s1 ;if not found
- repne scasb
- jne s1 ;if not found
- dec di ;if found, back up
- s1: xchg ax,di
- ret
- end