	.TITLE RCST
	.IDENT /110183/


;	File:[22,310]RCST.MAC
;	Author: Jim Bostwick 2-Nov-83 
;	History:  Phil Hannay 6-Jan-83  Remove IDS variable from call site
;                   as it was mistakenly left in.
;
;	Last Edit:
;

.REM |

{------------------- Receive Data or Stop -----------------------------}

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

{*USER*
 Pascal-3 procedure to receive a 26-byte data packet.
If no packet available, the task enters the 'STOPPED' state,
from which it returns only through an UNSTOP directive (USTP$).
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 RCST$. 
Return status is available in $DSW.
} 

|

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

	.MCALL RCST$S
	
	PROC RCST
	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
	RCST$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

