	.TITLE VRCDPA
	.IDENT /070387/


;	File:[22,310]VRCDPA.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
;		 17-APR-87 PJS -- converted rcvd to vrcd
;
;	Last Edit: 3-JUL-1987 12:07:26 
;

.REM |


PROCEDURE VRCDPA(VAR Task_Name:Rad56; 
		Var Buff:CH512
		);External;

{*USER*
 Pascal-3 procedure to receive a variable 512-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.

The length of the data packet received is encoded in the $DSW. Subtract
two from the integer value of $DSW and this will be the number of words
received. 

This procedure directly implements executive directive VRCD$. 
Return status is available in $DSW
} 

|

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

	.MCALL VRCD$S
	
	PROC VRCDPA
	PARAM TKN, ADDRESS	;TASK NAME IN RAD50
	PARAM BUFF, ADDRESS
	VAR IBUFF,258.*INTEGER	;INTERNAL BUFFER
	SAVE <R0, R1, R2, R3>
	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
	MOV #256.,R3
	VRCD$S R2,R1,R3
	MOV (R1)+,(R2)+		;COPY TASK NAME
	MOV (R1)+,(R2)
	MOV BUFF(SP),R2		;COPY BUFFER
	MOV #512.,R0		;R0=BUFFER COUNT
3$:	MOVB (R1)+,(R2)+	;COPY TO EXTERNAL BUFFER
	SOB R0,3$	
4$:	ENDPR
	.END

