Annotation of coherent/b/lib/libc/string/i8086/memcmp.m, revision 1.1.1.1

1.1       root        1: //////////
                      2: / i8086 C string library.
                      3: / memcmp()
                      4: / ANSI 4.11.4.1.
                      5: //////////
                      6: 
                      7: //////////
                      8: / memcmp(String1, String2, Count)
                      9: / char *String1, *String2;
                     10: / int Count;
                     11: /
                     12: / Compare Count bytes of String2 and String1.
                     13: //////////
                     14: 
                     15: #include <larges.h>
                     16: 
                     17: String1        =       LEFTARG
                     18: String2        =       String1+DPL
                     19: Count  =       String2+DPL
                     20: 
                     21:        Enter(memcmp_)
                     22:        mov     cx, Count(bp)   / Count to CX
                     23:        sub     ax, ax          / Result 0 to AX, set Zero flag in case CX==0
                     24:        Lds     si, String2(bp) / String2 address to DS:SI
                     25:        Les     di, String1(bp) / String1 address to ES:DI
                     26:        cld
                     27:        repe
                     28:        cmpsb
                     29:        je      2f              / String1 == String2
                     30:        ja      1f
                     31:        inc     ax              / String1 > String2
                     32:        jmp     2f
                     33: 
                     34: 1:     dec     ax              / String1 < String2
                     35: 
                     36: 2:     Leave

unix.superglobalmegacorp.com

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