/
/ Get control typewriter name.
/ gettty(b); char *b;
/ This function obtains the physical device name of
/ the TI: device and packs it into the supplied
/ buffer.
/ It is assumed that the standard error stream is
/ assigned to TI:
/ -1 is returned on error.
/ 
 
	.globl	gettty
 
gettty:	jsr	r0,__csav
	sub	$14,sp
 
	mov	12(r5),r4
	clrb	(r4)
 
	mov	sp,r0
	mov	r0,-(sp)
	mov	stderr,r0
	mov	V_LUN(r0),-(sp)
	mov	$5.+[3.<<8.],-(sp)
	emt	377
	bcc	0f
	mov	$-1,r0
	br	1f
 
0:	mov	sp,r3
	movb	(r3)+,(r4)+
	movb	(r3)+,(r4)+
	movb	(r3),r2
	bic	$!70,r2
	asr	r2
	asr	r2
	asr	r2
	bis	$'0,r2
	movb	r2,(r4)+
	movb	(r3),r2
	bic	$!7,r2
	bis	$'0,r2
	movb	r2,(r4)+
	movb	$':,(r4)+
	clrb	(r4)
	clr	r0
 
1:	jmp	__cret
