	assume cs:_text
_text	segment public byte 'code'
	public _jzstrpos

_jzstrpos proc near

	push bp
	mov bp,sp
	push si
	push di

	mov si,[bp+4]			; address of object
	mov di,[bp+6]			; address of target

	dec di
next1:
	inc di
	mov bl,[si]			; source index
	mov bh,[di]			; destin index
	cmp bh,0			; end of string ?
	jz notfound			   ; yes , exit
	cmp bh,bl			; are they equbl ?
	jnz next1			; keep looping until eos or equbl

	mov ax,di			; get pointer to possible match
	dec si
	dec di
next2:					; found a match so now check for match
	inc si
	inc di
	mov bl,[si]
	mov bh,[di]
	cmp bl,0
	jz found		       ; go back and look for more
	cmp bh,0
	jz notfound
	cmp bh,bl
	jz next2
	mov si,[bp+4]			; point back to first char of string
	jmp next1

notfound:
	mov ax,0			; return null pointer
found:
	pop di
	pop si
	mov sp,bp
	pop  bp
	ret
_jzstrpos  endp
_text	ends
	end
