	.TITLE RCVD
	.IDENT /110883/


;	File:[22,310]RCVD.MAC
;	Author: Jim Bostwick 1-Nov-83 (P2UTIL clone)
;	History: 8-Nov-83 JMB -- remove IDS parameter
;                12-Feb-87  PTH  -- corrected external file dec
;
;	Last Edit: 12-FEB-1987 18:26:39 
;

.REM |


PROCEDURE RCVD(VAR Task_Name:Rad56; 
		Var Buff:CH26
		);External;

{*USER*
 Pascal-3 procedure to receive a 26-byte data packet.
If Task_Name[1]=0, then the first pending
receive data packet is returned, and Task_Name is set to the name
of the sender of that packet. If Task_Name is non-zero on entry, then
only packets sent by that task will be returned. In this case, an
I$DSW indicating 'no packet pending' means no packet FROM THE SPECIFIED
TASK is pending. 

Task_Name must be in RAD50 format.
  
This procedure directly implements executive directive RCVD$. 
Return status is available in $DSW
} 

|

;
; Assemble with PASMAC.MAC as prefix file.
;

	.MCALL RCVD$S
	
	PROC RCVD
	PARAM TKN, ADDRESS	;TASK NAME IN RAD50
	PARAM BUFF, ADDRESS
	VAR IBUFF,15.*INTEGER	;INTERNAL BUFFER
	SAVE <R0, R1, R2>
	BEGIN
  	MOV SP,R0		;R0=ORIGINAL STACK POINTER
	MOV R0,R1		;R1->RECEIVE BUFFER (INTERNAL)
	ADD #IBUFF,R1
	MOV TKN(SP),R2		;R2->TASK NAME
	RCVD$S R2,R1
	MOV (R1)+,(R2)+		;COPY TASK NAME
	MOV (R1)+,(R2)
	MOV BUFF(SP),R2		;COPY BUFFER
	MOV #26.,R0		;R0=BUFFER COUNT
3$:	MOVB (R1)+,(R2)+	;COPY TO EXTERNAL BUFFER
	SOB R0,3$	
	ENDPR
	.END

