Annotation of coherent/b/lib/libc/string/i8086/strcspn.m, revision 1.1

1.1     ! root        1: //////////
        !             2: / i8086 C string library.
        !             3: / strcspn()
        !             4: / ANSI 4.11.5.3.
        !             5: //////////
        !             6: 
        !             7: //////////
        !             8: / size_t
        !             9: / strcspn(String1, String2)
        !            10: / char *String1, *String2;
        !            11: /
        !            12: / Return the length of the initial segment of String1 which consists of
        !            13: / characters not in String2
        !            14: //////////
        !            15: 
        !            16: #include <larges.h>
        !            17: 
        !            18: String1        =       LEFTARG
        !            19: String2        =       String1+DPL
        !            20: 
        !            21:        Enter(strcspn_)
        !            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:        inc     di
        !            27:        orb     ah, ah
        !            28:        je      3f              / If equal done
        !            29: 
        !            30:        Lds     si, String2(bp) / address of String2 DS:SI
        !            31: 2:     lodsb                   / From character String1 AL
        !            32:        orb     al, al
        !            33:        je      1b              / End of scan get next from String1
        !            34:        cmpb    ah, al
        !            35:        jne     2b              / Try next in String2
        !            36: 
        !            37: 3:     dec     di
        !            38:        mov     ax, di
        !            39:        sub     ax, dx
        !            40:        Leave

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.