; a0 - pool
; a1 - source string

	xdef	_DupStr

_DupStr	movem.l	d2/a2/a6,-(a7)

	movea.l	a1,a2		; store str
	move.l	a1,d1
.loop1	tst.b	(a1)+
	bne.s	.loop1
	move.l	a1,d0
	sub.l	d1,d0		; source string length

	addq.l	#4,d0		; add header and zero byte
	move.l	d0,d2
	movea.l	$4.w,a6
	jsr	(-708,a6)		; AllocPooled()
	tst.l	d0
	beq.s	.finish
	addq.l	#2,d0		; shift by header
	movea.l	d0,a1
	move.w	d2,(-2,a1)	; this is private, and can be used only with RemStr()
	move	a1,d0

.loop	move.b	(a2)+,(a1)+	; copy src to dst
	beq.s	.finish
	dbf.s	d2,.loop
	clr.b	(-1,a1)

.finish	movem.l	(a7)+,d2/a2/a6
	rts
