; Output File
;
; Entry:	DX:AX	Pointer to File
;		EX:BX	Pointer to WORD
;		CX	Length of line
; Regs:		DS,ES,SI,DI,AX,DX,BX,CX
; Note:		'The Long Filename.ext' is truncated to
;		'/../Long Filename.ext' if no drive letter, else to
;		'C:/../ng Filename.ext'
; Return:	SI and DI updated if to long: '/../' or 'C:/../' output
;		CX set to chars left in SI

include	clib.inc
include	string.inc

	public	@wcpath

_TEXT	SEGMENT

@wcpath PROC
	mov	si,ax
	mov	ds,dx
	mov	di,es
	MPUSH	dx
	push	ax
	mov	dx,cx
	call	strlen
	mov	es,di
	mov	cx,ax
	mov	di,bx
	jz	wcpath_01
	cmp	ax,dx
	jbe     wcpath_01
	mov	cx,dx
	mov	bx,[si]
	add	si,ax
	sub	si,dx
	add	si,4
        mov	ax,'./'
        cmp	bl,':'
        jne	wcpath_00
	mov	ah,[si+2]
	mov	es:[di],bl
	mov	es:[di+2],bh
	add	di,4
	add	si,2
	sub	cx,2
    wcpath_00:
	mov	es:[di],al
	mov	es:[di+2],ah
	mov	es:[di+4],ah
	mov	es:[di+6],al
	add	di,8
	sub	cx,4
	mov	ax,dx
    wcpath_01:
	ret
@wcpath ENDP

_TEXT	ENDS

	END
