/
/ Special header reading routine for
/ new lc.
/ This is a kludge. There should be
/ a routine (like stat) to get these
/ things in a nice manner.
/

	.globl	gethea

rpl:	.byte	-12, 0
	.blkw	1
	.word	0

iosb:	.blkw	2

fid:	.blkw	2
	.word	0

/
/ getheader(hp, fnum, fseq, dfp);
/ hp is a pointer to a file header buffer.
/ fnum and fseq are the file id.
/ dfp is the FILE pointer of the directory.
/ We know that the lun in this FILE is
/ therefore, assigned to the correct device
/ in the system.
/ Ugh.
/

gethea:	jsr	r0,_save

	mov	12(r5),rpl+2
	mov	14(r5),fid
	mov	16(r5),fid+2
	mov	20(r5),r4

	mov	_nluns,r0
	mov	$_luns,r1
0:	tst	(r1)+
	beq	0f
	dec	r0
	bne	0b
	br	1f

0:	sub	$_luns,r1
	asr	r1

	mov	V_UNIT(r4),-(sp)
	mov	V_DVNM(r4),-(sp)
	mov	r1,-(sp)
	mov	$7.+[4.<<8.],-(sp)
	emt	377
	bcs	1f

	clr	-(sp)
	clr	-(sp)
	clr	-(sp)
	clr	-(sp)
	mov	$rpl,-(sp)
	mov	$fid,-(sp)
	clr	-(sp)
	mov	$iosb,-(sp)
	mov	$1,-(sp)
	mov	r1,-(sp)
	mov	$IO.RAT,-(sp)
	mov	$1.+[12.<<8.],-(sp)
	emt	377
	bcs	1f

	mov	$1,-(sp)
	mov	$41.+[2.<<8.],-(sp)
	emt	377
	bcs	1f

	cmpb	iosb,$IS.SUC
	bne	1f
	mov	$1,r0
	br	2f

1:	clr	r0
2:	jmp	_ret
