include	clib.inc
include	dos.inc

PPROC	chdir,  path:DPTR
  ifdef __LFN__
	mov	al,_ifsmgr
	test	al,al
  endif
	MPUSH	ds
	MLDS	dx,path
	mov	ah,3Bh
  ifdef __LFN__
	jz	chdir_21
	stc
	xchg	al,ah
    chdir_21:
  endif
	int	21h
	MPOP	ds
	jc	chdir_err
	xor	ax,ax
    chdir_end:
	ret
    chdir_err:
	call	@dosmaper
	mov	ax,-1
	jmp	chdir_end
PEND	chdir

	END
