	.TITLE	QIO
	.PSECT	.PROG.
	.IDENT	/01/
	.ENABLE	LC
;
; P. Hays		2 April 79
;
; General queue i/o directive.
; int qio(func, lun, efn, isbadr, astadr, p1, ...p6)
; int func, lun, efn, p1, p2, p3, p4, p5, p6;
; isbx *isbadr;
; int (*astadr)();
;
; Qio returns the value 0 if the directive is accepted,
; but otherwise it returns the value in $dsw, the directive status word.
;
	.mcall dir$

qio::
	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 QIO call to exec:
	.byte	1, 12.		; DIC is 1, DPB size is 12 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
