	.title	stddir
;+
;	subroutine stddir(buf, desc)
;-
ap=%5
buf=2
desc=4
	.psect	$r.rwd,con,rw,rel,lcl,d
set:	.ascii	"set /uic="
uic:	.blkb	10.
	.even
	.psect	$r.roi,con,ro,rel,lcl,i
	.enabl	lsb
stddir::
	mov	#r$ddir,r3		; address of buffer for storage
	mov	buf(ap),r2		; source address
10$:
	movb	(r2)+,(r3)+		; copy character
	bne	10$			; if not EOS, do next char
	movb	r$ddir+1,r1		; first character of directory
	cmpb	r1,#'0			; see if [g,m]
	blt	20$			; NO
	cmpb	r1,#'7			; ...
	bgt	20$			; NO
	mov	buf(ap),r2		; source address
	mov	#r$duic,r3		; destination address
15$:
	movb	(r2)+,(r3)+		; copy character
	bne	15$			; while not EOS, do again
	br	50$
20$:
	mov	@desc(ap),r1		; RFDB address
	mov	r.fdb(r1),r1		; FDB address
	call	r$guic			; ask ACP for UIC
	mov	r0,r3			; place returned value in r3
	bcc	40$			; c clear => success
	mov	#177400,r3		; default to [377,0]
40$:
	mov	#r$duic,r2		; address to receive uic
	clr	r4			; desire separators, no leading 0's
	call	.ppasc			; format UIC
	clrb	(r2)			; terminate string
50$:
	mov	#r$duic,r0		; address of uic string
	mov	#uic,r1			; destination address
60$:
	movb	(r0)+,(r1)+
	bne	60$
	mov	#set,r1			; address of MCR command
	call	r$spwn			; spawn it
	return
	.end
