File:  [OS/2 SDKs] / os2sdk / demos / apps / lqh / stringsa.asm
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Thu Aug 9 12:26:06 2018 UTC (7 years, 9 months ago) by root
Branches: msft, MAIN
CVS tags: os2sdk-1988, HEAD
Microsoft OS/2 SDK 03-01-1988

; This is the same as the C runtime version of strlen, except that it takes
; a far pointer to the string. It returns the length of the string.

.MODEL SMALL
.CODE
        PUBLIC _Dstrlen
_Dstrlen    PROC FAR
        push bp
        mov bp,sp
        push di
        push es
        mov es,[bp+8]           ; str selector
        mov di,[bp+6]           ; str offset
        xor     ax,ax           ; null byte
	mov	cx,-1
        repne   scasb           ; scan for null, CX = -(1 + strlen(str))
	not	cx
	dec	cx
	xchg	ax,cx		; AX = strlen(str)
        pop     es
        pop     di
        pop     bp
	ret
_Dstrlen ENDP
        END

unix.superglobalmegacorp.com

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