Google
 

Trailing-Edge - PDP-10 Archives - decuslib10-08 - 43,50512/chkcon.b36
There are no other files named chkcon.b36 in the archive.
MODULE CHKCON=
!TOPS-10 Monitor version dependant routine to determine whether a connect has
!been completed for a task.
BEGIN
!
! Table of Contents
!
FORWARD ROUTINE
CHKCON,		!Given a NDB, return true if connection confirmed.
GET_S,		!Get all of the GETSTS bits, even the left half
PEEK;		!PEEK at a location in the monitor

!
!
! Externals


EXTERNAL ROUTINE
	TSK;

! Monitor locations we depend on (change this if they move)
!
GLOBAL LITERAL
	USRJDA=%O'340646';	!Address of JDA
LITERAL DEVIOS=2;

MACRO
	IOSCON=29,1 %;	!'Connected' bit

!
! Literals
!

LITERAL	_TKFRS=1,	!"Read Status" function
	_TKSID=0,	!Idle state (i.e after connect was rejected)
	_TKSCI=1,	!Waiting for connect initiate
	_TKSCC=2,	!Waiting for connect confirm
	_TKSOK=3,	!Connected OK
	_TKSDC=4;	!Waiting for disconnect confirm

!
! Require files
!
REQUIRE 'INTR.REQ';

!
! Macros
!

!
!Builtin declarations
!

BUILTIN	MACHOP;

!
! Routines
!

GLOBAL ROUTINE CHKCON(NB)=	!Check for connect confirmed
BEGIN
MAP NB: REF NDB;	!Address of NDB to check
REGISTER F;
IF700
THEN	BEGIN
	LOCAL	TSKBLK: VECTOR[5],
		REMPID: VECTOR[20],
		LOCPID: VECTOR[20];

	TSKBLK[0]=_TKFRS;	!Read status
	TSKBLK[3]=LOCPID; (TSKBLK[3])<LH>=100; !NPD1
	TSKBLK[4]=REMPID; (TSKBLK[4])<LH>=100; !NPD2
	TSK(NB[FILE$START],5,TSKBLK);	!Get the status

	IF .TSKBLK[2] EQL _TKSID
	THEN ERROR(RMTREJ,NB[FILE$START]); !Connect was rejected

	.TSKBLK[2] EQL _TKSOK  !Return true if connected
	END

ELSE	BEGIN	!6.03
	!Get status bits & return the state of the 'connected' bit
	F=(GET_S(NB[FILE$START]));
	.F<IOSCON>		!Return the bit as our value
	END
END;
GLOBAL ROUTINE GET_S(NB)=
BEGIN
MAP NB: REF NDB;	!Address of NDB to check

!First peek at USRJDA+channel # to get address of DDB
!Then peek at the status bits & return those
PEEK(
     (PEEK	(USRJDA+.NB[FILE$CHANNEL])	AND %O'777777') +DEVIOS
    )
END;
GLOBAL ROUTINE PEEK(ADDR)=
BEGIN
REGISTER F;
F=.ADDR;			!Put the address in the register
MACHOP(%O'047',F,%O'33');	!Do the PEEK UUO
.F				!Return the result
END;	!PEEK
END ELUDOM