Annotation of os2sdk/demos/apps/lqh/stringsa.asm, revision 1.1.1.1

1.1       root        1: ; This is the same as the C runtime version of strlen, except that it takes
                      2: ; a far pointer to the string. It returns the length of the string.
                      3: 
                      4: .MODEL SMALL
                      5: .CODE
                      6:         PUBLIC _Dstrlen
                      7: _Dstrlen    PROC FAR
                      8:         push bp
                      9:         mov bp,sp
                     10:         push di
                     11:         push es
                     12:         mov es,[bp+8]           ; str selector
                     13:         mov di,[bp+6]           ; str offset
                     14:         xor     ax,ax           ; null byte
                     15:        mov     cx,-1
                     16:         repne   scasb           ; scan for null, CX = -(1 + strlen(str))
                     17:        not     cx
                     18:        dec     cx
                     19:        xchg    ax,cx           ; AX = strlen(str)
                     20:         pop     es
                     21:         pop     di
                     22:         pop     bp
                     23:        ret
                     24: _Dstrlen ENDP
                     25:         END

unix.superglobalmegacorp.com

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