include	clib.inc
include	string.inc
include	dos.inc

PPROC	wfindfirst, fmask:DPTR, fblk:DPTR, attr:word
	push	si
	push	di
	stc
	MPUSH	ds
	mov	ax,714Eh
	mov	si,1
	mov	cx,attr
	MLES	di,fblk
	MLDS	dx,fmask
	int	21h
	MPOP	ds
	jc	wfindfirst_error
    wfindfirst_toend:
	pop	di
	pop	si
	ret
    wfindfirst_error:
	call	@dosmaper
	mov	ax,-1
	jmp	wfindfirst_toend
PEND	wfindfirst

PPROC	wfindnext, fb:DPTR, handle:word
	push	si
	push	di
	stc
	mov	ax,714Fh
	mov	bx,handle
	mov	si,1
	MLES	di,fb
	int	21h
	jc	wfindnext_error
	xor	ax,ax
    wfindnext_toend:
	pop	di
	pop	si
	ret
    wfindnext_error:
	call	@dosmaper
	mov	ax,-1
	jmp	wfindnext_toend
PEND	wfindnext

PPROC	wcloseff, hndl:word
	mov	ax,71a1h
	mov	bx,hndl
	int	21h
	ret
PEND	wcloseff

	END