	.title	$fdbta
	.ident	/x01/
 
	.enabl	lc
	.nlist	bex
 
;
; Utility Routines
; Filename (in FDB) to Ascii
;
; Version x01
;
; David G. Conroy	12-Dec-77
;
 
	.globl	$fdbta
 
	.mcall	call
	.mcall	callr
	.mcall	return
	.mcall	nbof$l
 
	nbof$l
 
;+
; ** $fdbta -- filename (in FDB) to ascii
;
; Inputs:
;	r0=fdb pointer
;	r1=pointer to buffer
;
; Outputs:
;	r1=updated
;
; Caveat:
;	The directory name is not converted. The filename block
; contains only the directory ID. This could perhaps be used to
; perform a QIO$ Read Attributes to get the name, but this  has
; not been done yet.
;-
 
$fdbta:	mov	r0,-(sp)	;Save
	mov	r2,-(sp)	;$C5TA uses r2
	mov	r3,-(sp)
	mov	r0,r3		;Get fnb pointer in r3
	add	#f.fnb,r3
	movb	n.dvnm(r3),(r1)+;Move device name
	movb	n.dvnm+1(r3),(r1)+
	mov	n.unit(r3),r0	;Unit number
	call	$itoc
	movb	#':,(r1)+	;Syntactic colon
	mov	r1,r0		;Setup for $c5ta
	mov	n.fnam(r3),r1	;Convert file name
	call	$c5ta
	mov	n.fnam+2(r3),r1
	call	$c5ta
	mov	n.fnam+4(r3),r1
	call	$c5ta
	call	20$		;Trim off blanks
	movb	#'.,(r0)+	;The dot
	mov	n.ftyp(r3),r1	;The file type
	call	$c5ta
	call	20$		;Trim blanks
	mov	r0,r1		;Put pointer back
	mov	n.fver(r3),r0	;Version number
	bmi	10$		;Assume any -ve is -1
	movb	#';,(r1)+	;Convert version number
	call	$itoc
10$:	mov	(sp)+,r3	;Restore
	mov	(sp)+,r2
	mov	(sp)+,r0
	return			;Done
 
20$:	cmpb	#' ,-(r0)	;Subroutine to trim blanks
	beq	20$
	inc	r0
	return
 
	.end
