Google
 

Trailing-Edge - PDP-10 Archives - BB-H348C-RM_1982 - swskit-v21/debugging-tools/dts/dtsdis.mac
There are no other files named dtsdis.mac in the archive.


;THIS SOFTWARE IS FURNISHED UNDER A LICENSE AND MAY ONLY BE USED
;  OR COPIED IN ACCORDANCE WITH THE TERMS OF SUCH LICENSE.
;
;COPYRIGHT (C) 1978 BY DIGITAL EQUIPMENT CORPORATION
;
	TITLE DTSDIS - DTS DISCONNECT TEST EXECUTION MODULE

	SEARCH DTSUNV,MACSYM,MONSYM
	SALL
	LIST

	ENTRY DTSDIS

	PRINT==200		;PRINT OPTION
	DSCTOT==^D10		;WAIT 10 SEC FOR DISCONNECT/ABORT

	PAGE
	SUBTTL DTSDIS - DTS DISCONNECT TEST 

;+
;DTSDIS - THIS ROUTINE PERFORMS THE DTS DISCONNECT TEST TO A DTR SERVER ON
; ANOTHER NODE IN THE NETWORK. THE ROUTINE IS CALLED BY THE DTS DRIVER
; AFTER THE CONNECT INTERRUPT HAS OCCURED AND THE LINK HAS A ZERO
; REASON CODE. THE CONNECT INTERRUPT COULD HAVE BEEN THE RESULT OF THE
; MONITOR RECEIVING EITHER AN NSP DISCONNECT CONFIRM OR DISCONNECT INITIATE.
;
;ACCEPTS:	T1/ ADDRESS OF ARGUMENT BLOCK
;		LCBPTR/ ADDRESS OF LCB
;
;	ARGUMENT BLOCK/ (.DTTIM) ELAPSED TIME TO RUN TEST
;			(.DTBUF) NUMBER OF SEND BUFFERS TO USE
;			(.DTBAU) BAUD RATE
;			(.DTNOD) POINTER TO NODE NAME
;			(.DTCNT) OPTIONAL DATA BYTE COUNT
;			(.DTTYP) TEST TYPE + PRINT OPTION
;			(.DTSUB) TEST SUBTYPE
;				 USER DATA
;
;CALLED BY: CALL DTSDIS
;
;RETURNS+1: SUCCESS
;	+2: FAILURE
;-



DTSDIS:				;ENTRY ON CONNECT INTERRUPT
	TRVAR <ARGPTR>		;MAKE A STACK VARIABLE TO SAVE ARGUMENT
	MOVEM T1,ARGPTR		;SAVE ADDRESS OF ARGUMENT BLOCK
	CALL DTSPRT		;PRINT MESSAGE
	SETZM DIFAIL		;CLEAR FAIL FLAG


;MAKE SURE WE GOT CONNECTED
; SEE THE NOTE IN THE MAINLINE DRIVER SOURCE CODE RELATIVE TO
; THE VERACITY OF WHETHER THE LINK WAS ACCPETED BY DTR

	LOAD T1,LCBSTS		;GET LINK STATUS
	TXNN T1,MO%LWC		;EVER CONNECTED ?
	PRTERR <LINK NEVER CONNECTED>,,<$GOTO(ABTDIS)> ;NO....
				; THEN ASSUME NOT ACCEPTED BY DTR


;WAIT UNTIL WE GET A DISCONNECT OR ABORT

	MOVEI T1,DSCTOT		;DISCONNECT TIMEOUT
	LOAD T2,LCBSTS
	TXNN T2,<MO%ABT!MO%SYN>	;ABORTED OR DISCONNECTED ALREADY ?

	CALL SLEEP		;NO, SLEEP UNTIL WE GET DISCONNECT

	LOAD T2,LCBSTS
	TXNE T2,MO%CON		;STILL CONNECTED ?
	PRTERR <DISCONNECT TIME OUT EXPIRED>,,<$GOTO(ABTDIS)> ;NO,
				; THEN WE TIMED OUT

;IF WE GOT A DATA INTERRUPT, WE ASSUME THAT IT OCCURRED DUE TO
; A DISCONNECT OR ABORT OF A CONNECTED LINK


;GET CURRENT LINK STATUS AND OPTIONAL DATA RETURNED FROM DTR

;%%%%%% REALLY SHOULD NOT HAVE TO DO THIS, SINCE GOT STATUS AT 
; INTERRUPT LEVEL
	CALL RLSLNK		;GO READ LINK STATUS
	RETBAD ERXLNK

	CALL RDALNK		;GO READ OPTIONAL DATA
	RETBAD ERXLNK

;DISPATCH BASED ON DISTYPE, FIRST CHECK FOR DISCONNECT/ABORT

	MOVE T1,ARGPTR		;GET POINTER TO ARGUMENT BLOCK
	MOVE T2,.DTSUB(T1)	;GET DISTYPE
	IDIVI T2,2		;GET DISCONNECT/ABORT IN T3
				;AND NODATA/STDATA/USDATA IN T2
	CALL @DISTB1(T3)
	SETOM DIFAIL		;HERE IF WE FAILED

;CHECK OPTIONAL DATA RETURNED

;DISPATCH BASED ON DISTYPE DATA TEST NODATA=0, STDATA=1, USDATA=2

	MOVE T1,ARGPTR		;GET POINTER TO ARGUMENT BLOCK
	MOVE T2,.DTSUB(T1)	;GET DISTYPE
	IDIVI T2,2		;GET DISCONNECT/ABORT IN T3

	LOAD T1,LCBROC		;GET NUMBER OF BYTES READ

	CALL @DISTB2(T2)	;GO VERIFY RETURNED OPT DATA
	SETOM DIFAIL		;HERE IF WE FAILED
	CALL ABTDIS
	SKIPE DIFAIL
	RET
	RETSKP

;ABORT THE LINK

ABTDIS:				;HERE ON DETECTED FAILURE TO ABORT LINK
	SETZRO LCBRJF		;RELEASE THE JFN
	SETONE LCBABT		;ABORT THE LINK
	CALL CLZLNK		;ABORT THE LINK AND GET RID OF JFN
	RETBAD ERXLNK		;FAILED, GO TELL WHY
	RET			;DONE, RETURN

DISTB2:				;DISCONNECT DATA TYPE DISPATCH TABLE
	DISNOD
	DISSTD
	DISUSD

DISTB1:				;DISCONNECT TEST DISPATCH TABLE
	DISSYN			;SYNCHRONOUS DISCONNECT
	DISABT			;ABORT

	PAGE
	SUBTTL DISSYN - SYNCHRONOUS DISCONNECT TEST

DISSYN:				;HERE TO CHECK FOR DISCONNECT OPTION
	LOAD T1,LCBSTS		;GET THE CURRENT LINK STATUS
	TXNE T1,.RHALF		;NON-ZERO REASON CODE ?
	PRTDCX (<T1>,<LINK ABORTED>,,<$RET>) ;YES, ABORTED...
	TXNE T1,^-<MO%LWC!MO%SYN!.RHALF> ;ANY EXTRANEOUS STATUS BITS ON ?
	PRTERR <INVALID LINK STATUS>,,<$RET> ;YES, ERROR....
	TXNN T1,MO%LWC		;LINK ACCEPTED & SYNCH DISCONNECTED ?
	PRTERR <LINK NOT ACCEPTED>,,<$RET> ;NO, ERROR....
	TXNN T1,MO%SYN
	PRTERR <LINK NOT SYNCHRONOUSLY DISCONNECTED>,,<$RET>

	RETSKP			;RETURN

DISABT:				;HERE TO CHECK ABORT TEST OPTION
	LOAD T1,LCBRSN		;GET THE ERROR REASON CODE
	CAIE T1,0		;ZERO ?
	CAIN T1,.DCX9		;OR NINE ? (USER ABORT)
	SKIPA			;YES, OK
	PRTDCX (T1,<ABORT TEST FAILED>,,<$RET>) ;NO, GO PRINT OUT ERROR TEXT
	LOAD T1,LCBSTS		;GET THE CURRENT LINK STATUS
	TXNE T1,^-<MO%LWC!MO%ABT!.RHALF> ;ANY EXTRANEOUS STATUS BITS ON ?
	PRTERR <INVALID LINK STATUS>,,<$RET> ;YES, ERROR....
	TXNN T1,MO%LWC		;LINK ACCEPTED & ABORTED ?
	PRTERR <LINK NOT ACCEPTED>,,<$RET> ;NO, ERROR....
	TXNN T1,MO%ABT
	PRTERR <LINK NOT ABORTED>,,<$RET>

	RETSKP			;RETURN


	PAGE

DISNOD:				;DISCONNECT WITH NO DATA RETURNED
	CAIE T1,0		;RECEIVED OPTIONAL DATA BYTE COUNT MUST BE ZERO
	PRTERR <NODATA FAILED>,,<$RET>
	RETSKP			;GOOD RETURN

DISSTD:				;DISCONNECT WITH STANDARD DATA RETURNED
	CAIE T1,^D16		;MUST GET 16 BYTES
	PRTERR <INVALID OPTIONAL DATA LENGTH RECEIVED>,,<$RET>
	MOVE T3,T1		;GET COUNT IN T3
	LOAD T1,LCBOPT		;GET POINTER TO OPTIONAL DATA
	MOVE T2,STDPAT		;AND POINTER TO STANDARD DATA
	CALL STRCMP		;COMPARE THE STRINGS
	PRTERR <INVALID OPTIONAL DATA RECEIVED>,,<$RET>
	RETSKP			;GOOD RETURN

DISUSD:				;DISCONNECT WITH USER DATA RETURNED
	MOVE T2,ARGPTR		;GET POINTER TO ARGUMENT BLOCK
	CAME T1,.DTCNT(T2)	;SAME # BYTES WE SENT ?
	PRTERR <INVALID OPTIONAL DATA LENGTH RECEIVED>,,<$RET>
	MOVEI T1,.DTTYP(T2)	;GET ADDRESS OF WHAT WE SENT
	HRLI T1,(POINT 36,0)	;MAKE IT A 36 BIT BYTE POINTER
	MOVE T3,.DTCNT(T2)	;GET COUNT OF BYTES
	LOAD T2,LCBOPT		;GET POINTER TO OPTIONAL DATA RECEIVED
	CALL STRCMP		;COMPARE THE TWO STRINGS
	PRTERR <INVALID OPTIONAL DATA RETURNED>,,<$RET>
	RETSKP			;GOOD RETURN


	PAGE
	SUBTTL STRCMP - STRING COMPARISON ROUTINE
;
;STRCMP - STRING COMPARE FOR ANY BYTE SIZE STRING, STRICTLY EQUAL COMPARE
;	  NO UPPER/LOWER CASE STUFF
;
;ACCEPTS: T1/ BYTE POINTER TO STRING 
;	  T2/ BYTE POINTER TO STING TO COMPARE WITH
;	  T3/ LENGTH TO COMPARE
;
;	CALL  STRCMP
;
;RETURNS+1: STRINGS UNEQUAL, T1,T2/ UPDATED
;	+2: STRINGS EQUAL
STRCMP:				;ENTRY
	STKVAR <STRPT1,STRPT2> ;VARIABLES
	MOVEM  T1,STRPT1	;SAVE POINTER TO FIRST STRING
	MOVEM  T2,STRPT2	;AND SECOND ALSO
STRCM1:				;LOOP THRU HERE FOR EACH BYTE OF STRINGS
	ILDB   T1,STRPT1	;GET BYTE FROM FIRST STRING
	ILDB   T2,STRPT2	;AND BYTE FROM SECOND
	CAME   T1,T2		;COMPARE THEM
	RET			;NOT EQUAL, RETURN +1
	SOJG   T3,STRCM1	;EQUAL, LOOP FOR NEXT BYTE
	MOVE   T1,STRPT1	;RESTORE UPDATED POINTERS
	MOVE   T2,STRPT2
	RETSKP			;DONE, RETURN

	PAGE
	SUBTTL LITERAL POOL AND CONSTANTS

	XLIST
LTPOOL:	LIT			;BEGINNING OF LITERAL POOL
	LIST

DIFAIL:	BLOCK 1			;DISCONNECT TEST FAIL FLAG

STDPAT:				;STANDARD DATA PATTERN FOR DTR
STDINT:	POINT 8,.+1		;POINTER TO STANDARD INTERRUPT MESSAGE
	BYTE (8)"A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P"
	BYTE (8)"Q","R","S","T","U","V","W","X","Y","Z","0","1","2","3","4","5"
	BYTE (8)"6","7","8","9"

	PAGE
	SUBTTL VARIABLE DATA STORAGE

	VAR


	END