Google
 

Trailing-Edge - PDP-10 Archives - BB-H348C-RM_1982 - swskit-v21/debugging-tools/dntask.mac
There are no other files named dntask.mac in the archive.
	.TITLE	INTTST - TEST OF TASK-BUILDING INTO DN20
;
	.MCALL	CRBDF$,CNBDF$,QIOSY$,NSSYM$,ALUN$S,OPNW$,OPNW$E
	.MCALL	GNDW$,GNDW$E,ACCW$,ACCW$E,RECW$,RECW$E
	.MCALL	SNDW$,SNDW$E,DSCW$,DSCW$E,CLSW$,CLSW$E
	.MCALL	EXIT$S
;
	CRBDF$
	CNBDF$
	QIOSY$
	NSSYM$
;
	.PSECT PROC,D
	.EVEN
LBEND:	.WORD 0
NETLUN=2
LNKLUN=3
MAXLNK=2
EVW=10		;UNUSED EVENT FLAG FOR SYNCH WITHIN EXEC
MLLEN=200
MLBUF:	.BLKB MLLEN
	.EVEN
MLALEN=200
MLABUF:	.BLKB MLALEN
	.EVEN
ERRBLK:	.BLKW 10
OPNSTS:	.BLKW 2
GNDSTS:	.BLKW 2
ACCSTS:	.BLKW 2
RECSTS:	.BLKW 2
SNDSTS:	.BLKW 2
SNDLEN:	.WORD 0
CLSSTS:	.BLKW 2
DSCSTS:	.BLKW 2
MSGLEN=4000
MSGBUF:	.BLKB MSGLEN
	.EVEN
;
;ARGUMENT BLOCKS FOR DIRECTIVES
;
OPNBLK:	OPNW$	NETLUN,EVW,OPNSTS,,MAXLNK
GNDBLK:	GNDW$	NETLUN,EVW,GNDSTS,,<MLBUF,MLLEN>
ACCBLK:	ACCW$	LNKLUN,EVW,ACCSTS,,<MLBUF,MLLEN>
RECBLK:	RECW$	LNKLUN,EVW,RECSTS,,<MSGBUF,MSGLEN>
SNDBLK:	SNDW$	LNKLUN,EVW,SNDSTS,,<MSGBUF,MSGLEN>
DSCBLK:	DSCW$	LNKLUN,EVW,DSCSTS
CLSBLK:	CLSW$	NETLUN,EVW,CLSSTS
;
; CODE
;
BEGIN:	CLR LBEND		;DETECT LAST MESSAGE WITH THIS FLAG
INIT:
GNTLUN:	ALUN$S	#NETLUN,#"NS,#0
	BCS ERRGL
	ALUN$S	#LNKLUN,#"NS,#0
	BCS ERRGL
;
INITNT:	OPNW$E OPNBLK		;SETUP NETWORK DATA QUEUE
	BCS ERROPN
GNTCON:	GNDW$E GNDBLK		;WAIT FOR CONNECT MESSAGE
	BCS ERRCON
	CMPB #IE.NDA,GNDSTS	;ANY MESSAGE ?
	BEQ GNTCON		;NO.. TRY AGAIN.
	CMPB #NT.CON,GNDSTS+1	;CONNECT REQUEST MESSAGE ?
	BNE GNTCON		;NO.. KEEP LOOKING.
;
;HAVE CONNECT REQUEST.. CHECK FOR VALIDITY.
;
ACCCON:	ACCW$E ACCBLK		;CONNECT REQUEST OKAY - ACCEPT
	BCS ERRACC
;
NTLOOP:
NTINP:	RECW$E RECBLK		;GET MESSAGE WHEN IT ARRIVES
	BCS ERRREC
	CMPB #'$,MSGBUF	;GOT MESSAGE
	BNE NTOUT
	CMPB #'$,MSGBUF+1	;FIRST 2 BYTES = $  ?
	BNE NTOUT		;NO, MORE MESSAGES ON THE WAY
	COM LBEND		;YES, LAST MESSAGE - SET FLAG
			;NOW FIND OUT HOW LONG RETURN MESSAGE IS ..
ntout:	MOV RECSTS+2,SNDLEN	;GET MESSAGE LENGTH
	SNDW$E SNDBLK,,,,,<#MSGBUF,SNDLEN>	;RETURN MESSAGE (ECHO)
	BCS ERRSND
	TST LBEND		;IS FLAG SET ?
	BEQ NTLOOP		;NO, SO LOOK FOR MORE MESSAGES
;
				;FLAG IS SET, SO FINISH UP.
NTDISC:	DSCW$E DSCBLK		;DISCONNECT LINK
	BCS ERRDSC
NTCLS:	CLSW$E CLSBLK		;CLOSE DOWN NETWORK ACTIVITY FOR THIS TASK
	BCS ERRCLS
	JMP BEGIN		;GO WAIT FOR ANOTHER CONNECT REQUEST
;
;ERROR HANDLING
;
ERRGL:
ERROPN:
ERRCON:
ERRACC:
ERRREC:
ERRSND:
ERRDSC:
ERRCLS:	EXIT$S			;GIVE UP
;
	.END	BEGIN