|
|
1.1 root 1: //////////
2: / i8086 C string library.
3: / strchr()
4: / ANSI 4.11.5.2.
5: / Previously known as index().
6: / Entry point for index() retained for backward compatability.
7: //////////
8:
9: //////////
10: / char *
11: / strchr(String, Char)
12: / char *String;
13: / int Char;
14: /
15: / Find Char in String, return pointer or NULL.
16: //////////
17:
18: #include <larges.h>
19:
20: String = LEFTARG
21: Char = String+DPL
22:
23: .globl strchr_
24: strchr_:
25:
26: Enter(index_)
27: Lds si, String(bp) / String address to DS:SI
28: movb ah, Char(bp) / Char to AH
29: cld
30:
31: 1: lodsb / String character to AL
32: cmpb al, ah
33: je 2f / Got it, return address
34: orb al, al / Test for NUL
35: jne 1b / Not done
36: movb ah, al / End of String, return NULL
37: #if LARGEDATA
38: mov dx, ax
39: #endif
40: jmp 3f
41:
42: 2: dec si / Back up to match
43: mov ax, si / AX = offset
44: #if LARGEDATA
45: mov dx, ds / DX = segment
46: #endif
47:
48: 3: Leave
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.