include	clib.inc
include	conio.inc
include	tinfo.inc
include	string.inc

	extrn	tiseto:		NEAR
	extrn	titoend:	NEAR
	extrn	timodal:	NEAR
	extrn	tiputs:		NEAR
	extrn	tiinitcursor:	NEAR

PPROC	dledit, b:dword, rc:dword, bz:word, oflag:word
local	ti:S_TINFO
local	cursor:dword
	push di
	invoke getcursor, addr cursor
	mov di,tinfo
	lea ax,ti
	mov tinfo,ax
	invoke memzero, ss::ax, SIZE S_TINFO
	mov al,rc.rc_x
	mov ti.ti_xpos,ax
	mov al,rc.rc_y
	mov ti.ti_ypos,ax
	mov al,rc.rc_col
	mov ti.ti_cols,ax
	mov al,rc.rc_row
	mov ti.ti_rows,ax
	movmw ti.ti_bcol,bz
	movmx ti.ti_bp,b
	mov ax,_T_OVERWRITE
	.if oflag & _O_CONTR
	    or ax,_T_USECONTROL or _T_SHOWTABS
	.endif
	mov ti.ti_flag,ax
	call tiinitcursor
	mov bx,ti.ti_cursor.cr_xy
	call @getxya
	mov ti.ti_clat,al		; save text color
	mov ti.ti_clch,250
      ifdef __CLIP__
	.if oflag & _O_DTEXT
	    call tiseto
	    call titoend
	    mov ax,ti.ti_boff
	    add ax,ti.ti_xoff
	    mov ti.ti_cleo,ax
	.endif
      endif
	call tiseto
	call timodal
	push ax
	call tiputs
	invoke setcursor, cursor
	pop ax
	mov tinfo,di
	pop di
	ret
PEND	dledit

	END
