|
|
1.1 root 1: //////////
2: / i8086 C string library.
3: / strpbrk()
4: / ANSI 4.11.5.4.
5: //////////
6:
7: //////////
8: / char *
9: / strpbrk(String1, String2)
10: / char *String1, *String2;
11: /
12: / Return a pointer to the first char in String1
13: / which matches any character in String2.
14: //////////
15:
16: #include <larges.h>
17:
18: String1 = LEFTARG
19: String2 = String1+DPL
20:
21: Enter(strpbrk_)
22: Les di, String1(bp) / String1 address to ES:DI
23: sub ax, ax / Clear AL for NULL return value
24: #if LARGEDATA
25: mov dx, ax / and clear DX likewise
26: #endif
27: cld
28:
29: 1: movb ah, Pes (di) / Get char from String1 to AH
30: inc di / and point to next
31: orb ah, ah
32: je 3f / No match found, return NULL
33: Lds si, String2(bp) / String2 address to DS:SI
34:
35: 2: lodsb / String2 character to AL
36: orb al, al
37: je 1b / No match in String2, try next String1 char
38: cmpb ah, al
39: jne 2b / Mismatch, try next String2 char
40: dec di / Match, return pointer
41: mov ax, di / in AX
42: #ifdef LARGEDATA
43: mov dx, es / or DX:AX
44: #endif
45:
46: 3: Leave
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.