File:  [MW Coherent from dump] / coherent / b / lib / libc / string / i8086 / streq.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.
/ streq()
/ Not in ANSI draft standard.
//////////

//////////
/ streq(String1, String2)
/ char *String1, *String2;
/
/ Compare String1 and String2 for equality, return 1 or 0.
//////////

#include <larges.h>

String1	=	LEFTARG
String2	=	String1+DPL

	Enter(streq_)
	Lds	si, String2(bp)	/ String2 address to DS:SI
	Les	di, String1(bp)	/ String1 address to ES:DI
	mov	cx, $0		/ Result to CX
	cld

1:	lodsb			/ String2 character to AL
	scasb			/ Compare to String1 character
	jne	2f		/ Mismatch, return 0
	orb	al, al
	jne	1b		/ Not done yet
	inc	cx		/ Matched, return 1

2:	mov	ax, cx		/ Result to AX
	Leave

unix.superglobalmegacorp.com

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