.TITLE VRCD .IDENT /14MR88/ ; File:[22,310]VRCD.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 ; 14-Apr-88 PTH -- changed BUFF param to address, ; added LEN length parameter. ; ; Last Edit: 19-JUL-1989 11:28:15 ; .REM | PROCEDURE VRCD(Buff: Address; Len: integer );External; {*USER* Pascal-3 procedure to receive a variable max 512-byte data packet. Caller supplies a buffer BUFF that is word aligned and is two words larger than the maximum possible packet received. The first two words of the buffer are the sender task name in Rad50. If the first two words are null (0), then the first packet queued by a sender will be received. If the first two words are non-null, then the first packet queued by the specified task (sender) will be received. IMPORTANT NOTE: The variable passed in the BUFF parameter (as an address) cannot be noted by the Pascal compiler in some cases, and it may make a mistake when it optimizes code, based on the assumption that the VRCDb call does not use that variable. To avoid a problem, be sure to make global any variable that is passed in BUFF (as an address). The variable will be modified by the VRCD routine when the message packet received is placed in that variable. By making the variable a global variable, the compiler will do no further optimization, and thus avoid a potential mistake. The length LEN in words of the user buffer BUFF is supplied to insure that the received message does not exceed that buffer. The value of LEN is that of the message packet and must be between 13. and 256. The length of BUFF (in words) must be at least LEN + 2 to insure there is room for both task name (first two words) and message packet. Task_Name must be in RAD50 format. The actual 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 in the message packet received. This procedure directly implements executive directive VRCD$. Return status is available in $DSW } {*WIZZARD* We check the buffer for word alignment. The directive will crash on an odd address if the buffer address is odd. We return a -98. (IE.ADP) in $DSW, which is the same error returned by VSDA directive is the buffer is not word aligned. } | ; ; Assemble with PASMAC.MAC as prefix file. ; .MCALL VRCD$S PROC VRCD PARAM BUFF, ADDRESS ; ADDRESS OF CALLER BUFFER, WORD ALIGNED PARAM LEN, INTEGER ; MAXIMUM LENGTH (DO NOT EXCEED) OF BUFF SAVE BEGIN BIT #1,BUFF(SP) ; SEE IF BUFFER ADDRESS EVEN (WORD ALIGNED) BEQ 1$ ; BRANCH IF EVEN MOV #-98.,$DSW ; IE.ADP INTO DSW BR 2$ 1$: MOV SP,R0 ;R0=ORIGINAL STACK POINTER VRCD$S BUFF(0),BUFF(0),LEN(0) 2$: ENDPR .END