.TITLE SRDA .IDENT /25AU87/ ; ; File:[22,310]SRDA.MAC Last edit: 16-SEP-1988 10:07:26 ; Author: Philip Hannay ; History: ; ; 25-Aug-87. Philip Hannay. Created. ; 18-Mar-88. Philip Hannay. Fixed clear EFN part, was not ; clearing flag before arming AST. Also cleared SAVEFN ; prior to storing value to insure that high byte clear. ; .rem | Procedure SRDA( EFN:Event_Flag );External; {*USER* Pascal-3 procedure to specify or clear a Receive Data AST. The action of this routine has been restricted to setting a specified event flag when the AST fires (a message packet is queued for this task). You arm the AST by calling this routine with an event flag f1 thru f96. (Naturally, if you use group globals, they must have been created already.) After the AST is armed, the event flag specified will be set whenever a new packet is queued. To disarm the AST, call the routine with the null event flag f0. This routine must reside in memory whenever a packet may arrive, as it contains code that is executed immediately, regardless of where your current point of execution is. In most cases, this means the routine must reside in the root of your task. The specified event flag is cleared before AST is set up. Make sure you check the $DSW on exit to confirm that your AST was indeed set up or cleared. } {*WIZZARD* The permanent data base for this routine is located in data PSECT PPRDAD. The AST routine code is located in instruction PSECT PPRDAI. The non-AST code is located in the BLANK PSECT. This routine will work fine for I/D space tasks also. On entry to SRDA, if the event flag is non-zero (non-null f0), it will be cleared. This will validate the event flag. If the event flag clears okay, then the AST will be set up. Status codes are returned in $DSW, and can be any status code for either CLEF or SRDA directives. If the AST exit routine fails, the program will be crashed. It will terminate on an odd address trap, and will have a decimal 11 in R0 and the $DSW value in R2. } | ; ; Assemble with PASMAC.MAC as prefix file. ; ; .MCALL SRDA$S,SETF$S,ASTX$S,CLEF$S ; Permanent database for AST - hold specified event flag number .PSECT PPRDAD,RW,D,GBL,OVR SAVEFN: .WORD 0 ; Event flag number to set - in low byte ; AST routine - note we test for zero, just in case AST is called just ; as we are clearing AST .PSECT PPRDAI,RO,I,GBL,OVR PPRDAI: TST SAVEFN ; See if event flag is zero BEQ 3$ ; Branch if it is zero, ignore, not normal SETF$S SAVEFN ; Set specified event flag 3$: ASTX$S ; Exit the AST state MOV #11.,R0 ; AST exit failed, crash program MOV $DSW,R2 ; Identifier of 11. in R0, DSW saved in R2 CLR 1 ; Crash with odd address trap ; AST specify or clear routine, executed a normal task state, called from ; Pascal. Note that we clear the specified event flag - not that we have ; to, but it is convenient for the caller, and more importantly, lets us ; validate the event flag. .PSECT ,I PROC SRDA PARAM EFN, CHAR BEGIN CLR SAVEFN ; Clear EFN store area, insuring high byte clr MOVB EFN(SP),SAVEFN ; Copy event flag num to low byte of data area TST SAVEFN ; See if a null event flag (f0) specified BNE 2$ ; Branch if not null event flag SRDA$S ; Clear AST service - AST no longer occurs BR 1$ ; Exit 2$: CLEF$S SAVEFN ; Clear specified event flag BCS 1$ ; Branch if failed (probably invalid flag) SRDA$S #PPRDAI ; Specify AST service - AST done from now on 1$: ; Exit ENDPR .END