	.TITLE	alun
	.PSECT	.PROG.
	.IDENT	/wrg/
	.ENABLE	LC
;
; Wayne R. Graves	11 Mar 80
;
; General asn lun directive.
; int alun(lun, dev, unt)
; int lun, dev, unt;
; dev='M'*256+'M'; /* assign mm: */
;
; alun returns the value 0 if the directive is accepted,
; but otherwise it returns the value in $dsw, the directive status word.
;
	.mcall dir$

alun::
	mov	sp,r1		; r1 <- pointer to new DPB on the stack.
	mov	(r1),-(sp)	; Save return address

	mov	(pc)+,(r1)	; Craft a DPB for a ALUN call to exec:
	.byte	7, 4.		; DIC is 7, DPB size is 4 words.

	clr	r0		; Clear for successful return
	dir$	r1		; Call the exec.

	bcc	1$
	mov	@#$dsw,r0	; If rejected, return directive status word
1$:
	mov	(sp)+,(sp)	; Restore the return address
	return

.end
