	.TITLE	RCVAST SPECIFY RECIEVE DATA AST SUBR.
	.IDENT	/02DEC81/
;
; THIS SUBROUTINE ALLOWS A FORTRAN CALLER TO SPECIFY THE
; RECIEVE DATA AST AND ALLOWS HIM TO ALSO CLEAR THE
; RECIEVE DATA AST.
;
; FORTRAN CALLING SEQUENCE:
;
;	CALL RCVAST(IEFN,IDS)
;
;	IEFN= EVENT FLAG TO SET WHEN PACKET HAS
;	      BEEN QUEUED TO THIS TASK.
;	      NOTE: IF ZERO, THEN THE AST IS CANCELED.
; 	 IDS= DIRECTIVE STATUS OF "SRDA$" DIRECTIVE
;
	.PAGE
;
; SYSTEM MACRO CALLS
;
	.MCALL	SRDA$	; SPECIFY RECIEVE DATA AST
	.MCALL	ASTX$S	; AST EXIT
	.MCALL	DIR$	; DIRECTIVE CALL
	.MCALL	SETF$	; SET SINGLE EVENT FLAG
	.PAGE
;
; DPB'S
;
ASTSET:
	SRDA$	GOTDAT		; SET AST
;
ASTCLR:
	SRDA$			; CLEAR AST
;
SETEFN:
	SETF$			; SET TASK'S LOCAL EFN
	.PAGE
;
; SEE IF THE TURKEY GAVE US THE CORRECT NUMBER OF PARAMETERS
;
RCVAST::
	CMP	#2,(R5)+	; DID WE GET TWO PARAMETERS
	BEQ	1$	; YES
	TRAP	<80.+128.>	; NO, DO A TRAP "80" INVALID NO. ARGUMENTS
	RETURN
;
; SAVE THE USER'S EVENT FLAG IN "SETF$" DPB
;
1$:
	TST	@(R5)	; IS EVENT FLAG ZERO
	BEQ	RESET	; YES, USER WANTS TO CANCEL THE AST
;
;
	MOVB	@(R5)+,SETEFN+S.ETEF	; EVENT FLAG TO DPB
	DIR$	#ASTSET	; SET THE AST
	MOVB	$DSW,R1	; SIGN EXTEND THE DIRECTIVE STATUS
	MOV	R1,@(R5)	; RETURN TO CALLER
	RETURN		; EVERYTHIING OK
;
; USER WANTS TO CLEAR AST RECOGNITION
;
RESET:
	TST	(R5)+	; SKIP OVER EFN ADDR.
	DIR$	#ASTCLR	; CLEAR THE AST
	MOVB	$DSW,R1	; SIGN EXTEND THE DIRECTIVE STATUS
	MOV	R1,@(R5)	; RETURN IT TO THE CALLER
	RETURN
	.PAGE
;
; RECIEVE DATA AST
;
GOTDAT:
	DIR$	#SETEFN	; SET THE TASK LOCAL EVENT FLAG
	ASTX$S		; EXIT AST
	.END
