File:  [MW Coherent from dump] / coherent / b / lib / libc / string / i8086 / strlen.m
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Wed May 29 04:56:35 2019 UTC (7 years ago) by root
Branches: MarkWilliams, MAIN
CVS tags: relic, HEAD
coherent

//////////
/ i8086 C string library.
/ strlen()
/ ANSI 4.11.6.3.
//////////

//////////
/ size_t
/ strlen(String)
/ char *String;
/
/ Find length of String.
//////////

#include <larges.h>

String	=	LEFTARG

	Enter(strlen_)
	Les	di, String(bp)	/ String address to ES:DI
	cld
	mov	dx, di		/ Save start
	mov	cx, $-1		/ Max count to CX
	sub	ax, ax
	repne
	scasb			/ Scan to NUL
	dec	di		/ Back up to match
	mov	ax, di
	sub	ax, dx		/ &NUL - &start = length
	Leave

unix.superglobalmegacorp.com

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