	.TITLE NTDSC
	.ENABLE LC
	.IDENT /010688/
;
;     Description: Disconnect a DECnet Logical Link
;	     File: [22,310]NTDSC.MAC
;	   Author: Jim Bostwick   1-JUN-1988
;	Last Edit: 15-NOV-1988 12:20:19 
;	  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. 
; 		 23-JUN-1988 21:17:29  - JMB PA3UTL upgrade.
;

.REM |
{*CALL*}

Procedure NTDSC (
	Lun: Integer;
	EFN: Event_flag;
	MSG: CH16;
	VAR IOSB: IO_Status_block
	);External;

{*USER*

Disconnect the network logical link active on LUN, and free the LUN. Unlike
NTABT, pending transmits are allowed to complete before the link is shut down. 
Pending receive messages continue to be delivered until all transmits are 
gone, then any remaining are aborted. MSG is user data sent to remote task.
 } 

{*WIZARD*

AST not implemented. DSCW$S synchronous call used. 
 }

|

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

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

	.MCALL DSCW$S

	PROC NTDSC
	PARAM LUN, Integer;
	PARAM EFN, Char
	PARAM MSG, 16.*Char
	PARAM IOSB, Address
	SAVE <R0,R1,R2,R3>
	BEGIN
	mov	sp, r0
	mov	efn(r0), r1
	bic	#^C377, r1
	mov	#16., r3	; assume message length
	mov	sp, r2
	add	#MSG, r2
	tstb	(r2)		; null message?
	bne	10$		; no -br
	clr	r2		; use null params
	clr	r3
10$:	DSCW$S lun(r0),r1,iosb(r0),,<r2,r3>

	ENDPR

	.END

