þ a‹R þ d 
þ w ÿÿÿÿÿÿÿÿþ m
Y<     þ hý	 oP    þ nSystem-wide	NAME	Utility

CGROUP	GROUP	CODE

	PUBLIC	FindByteFwdIC

LCa	EQU	61H
LCz	EQU	7AH
SHIFT	EQU	20H

CODE	SEGMENT	PUBLIC 'CODE'

ASSUME	CS:CGROUP

UpperCase:
	CMP	AL,LCa		; 'a'
	JL	UCokay
	CMP	AL,LCz		; 'z'
	JG	UCokay
	SUB	AL,SHIFT		; convert to upper case
UCokay:	
	RET

$EJ

; This routine takes a pointer, a target, and a count. It searches forward thru
; memory. It returns the offset if the target is found else it returns -1.
; It is case independent for alphabetic chars.

FindByteFwdIC	PROC NEAR

	PUSH	BP
	MOV	BP,SP

	LES	SI,DWORD PTR [BP+08H]
	MOV	CX,[BP+04H]
	MOV	AL,[BP+06H]

	CALL	UpperCase
	MOV	AH,AL		; target char is now upper case
	MOV	DX,CX
	CLD
FwdLoop:
	LODS	BYTE PTR ES:[SI]
	CALL	UpperCase
	CMP	AL,AH
	JE	FwdMatch
	LOOP	FwdLoop
	MOV	AX,-1
	POP	BP
	RET	8

FwdMatch:
	SUB	DX,CX
	MOV	AX,DX
	POP	BP
	RET	8

FindByteFwdIC	ENDP

CODE	ENDS

	END
