|
|
1.1 ! root 1: ////////// ! 2: / i8086 C string library. ! 3: / strspn() ! 4: / ANSI 4.11.5.6. ! 5: ////////// ! 6: ! 7: ////////// ! 8: / size_t ! 9: / strspn(String1, String2) ! 10: / char *String1, *String2; ! 11: / ! 12: / Return the length of the initial segment of String1 which consists of ! 13: / characters in String2 ! 14: ////////// ! 15: ! 16: #include <larges.h> ! 17: ! 18: String1 = LEFTARG ! 19: String2 = String1+DPL ! 20: ! 21: Enter(strspn_) ! 22: Les di, String1(bp) / String1 address String1 ES:DI ! 23: mov dx, di / Save for length calc ! 24: cld ! 25: 1: movb ah, Pes (di) / Get char from String 1 ! 26: orb ah, ah ! 27: je 3f / If equal done ! 28: ! 29: Lds si, String2(bp) / address of String2 DS:SI ! 30: 2: lodsb / From character String1 AL ! 31: orb al, al ! 32: je 3f / End of scan no match means done ! 33: cmpb ah, al ! 34: jne 2b / Try next in String2 ! 35: inc di / Try next in String1 ! 36: jmp 1b ! 37: 3: mov ax, di ! 38: sub ax, dx ! 39: Leave
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.