include	clib.inc

_TEXT	SEGMENT

	public	@putstr

@putstr PROC
	push	si
	push	di
	cld
	test	cl,cl
	jnz	putstr_02
	dec	cl
	jmp	putstr_02
    putstr_00:
	add	di,16
	and	di,0FFF0h
	jmp	putstr_02
    putstr_01:
	pop	di
	add	di,dx
	push	di
    putstr_02:
	lodsb
	test	al,al
	jz	putstr_05
	cmp	al,10
	je	putstr_01
	cmp	al,9
	je	putstr_00
	cmp	al,'&'
	je	putstr_06
	test	ah,ah
	jz	putstr_03
	stosw
	jmp	putstr_04
    putstr_03:
	stosb
	inc	di
    putstr_04:
	dec	cl
	jnz	putstr_02
    putstr_05:
	mov	ax,si
	pop	di
	pop	si
	sub	ax,si
	ret
    putstr_06:
	test	ch,ch
	jz	putstr_03
	mov	es:[di+1],ch
	jmp	putstr_02
@putstr ENDP

_TEXT	ENDS

	END
