	.TITLE NTSPA
	.ENABLE LC
	.IDENT /010988/

;
;     Description: DECNET Special AST Routine
;	     File: [22,310]NTSPA.MAC
;	   Author: Jim Bostwick    2-SEP-1988 
;	Last Edit: 15-NOV-1988 12:28:31 
;	  History: 
;		 3-AUG-1989 10:50:29 - JMB - changed location of PASMAC (again)
;		15-NOV-88 12:00:00 - JMB - Conform to AMI Header specs. 
;

.REM |
{*CALL*}

Procedure NTSPA (
	lun: Integer;
	EFN: Event_flag;
	VAR IOSB: IO_Status_block
	);External;

{*USER*

This routine uses the SPA$ routine to set up a network data AST. The
AST routine executes each time data is posted to the task network
data queue (Network Mailbox).  For the Pascal environment, the AST
routine is hidden here, and only sets the specified event flag. 

LUN specifies the network queue LUN (the one used in NTOPN). 

To disable AST service, call NTSPA with a null event flag (f0). 

Upon return, IOSB[2] contains the number of pending network data
messages (assuming IOSB[1]=1). NTSPA may be called repeatedly to 
determine this number. NTSPA may be called with f0, resulting
in no AST service, but still returning the data count. 

NOTE: Because it contains the AST service routine, and local storage
for the EFN, this module may not be placed in an overlay segment or
resident library. 

 } 

{*WIZARD*

 }

|

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

	.library /lb:[1,1]netlib.mlb/
	.include /pas$utl:pasmac.mac/

	.mcall SPAW$S,SETF$S,ASTX$S

	.Psect Data,D
sefn:	.word 0			; efn to set from AST routine
	.psect

	PROC NTSPA
	PARAM lun, integer
	PARAM efn, Char
	PARAM iosb, Address

	SAVE <R0,R1,R2>
	BEGIN
	mov	sp, r0
	movb	efn(sp), r1			; get efn
	bic	#^C377, r1
	beq	10$				; if eq, disable AST
	mov	r1, sefn
	SPAW$S lun(r0),r1,iosb(r0),,<#spaast>	; enable AST
	br	20$				; and exit

10$:	SPAW$S lun(r0),r1,iosb(r0)		; disable AST

20$:

	ENDPR

;
; SPAAST - AST service routine
;
; pretty simple - just set the saved EFN, and exit. 
;

SPAAST:	
	SETF$S 	sefn		
	ASTX$S

	.END

