	.TITLE *** STOP TDV OVERLAY ***

/

/ COPYRIGHT (C) 1976

/ DIGITAL EQUIPMENT CORPORATION, MAYNARD, MASS.

/

/ THIS SOFTWARE IS FURNISHED UNDER A LICENSE FOR USE ONLY

/ ON A SINGLE COMPUTER SYSTEM AND MAY BE COPIED ONLY WITH

/ THE INCLUSION OF THE ABOVE COPYRIGHT NOTICE.  THIS

/ SOFTWARE, OR ANY OTHER COPIES THEREOF, MAY NOT BE PRO-

/ VIDED OR OTHERWISE MADE AVAILABLE TO ANY OTHER PERSON

/ EXCEPT FOR USE ON SUCH SYSTEM AND TO ONE WHO AGREES TO

/ THESE LICENSE TERMS.  TITLE TO AND OWNERSHIP OF THE

/ SOFTWARE SHALL AT ALL TIMES REMAIN IN DEC.

/

/ THE INFORMATION IN THIS DOCUMENT IS SUBJECT TO CHANGE

/ WITHOUT NOTICE AND SHOULD NOT BE CONSTRUED AS A COM-

/ MITMENT BY DIGITAL EQUIPMENT CORPORATION.

/

/ DEC ASSUMES NO RESPONSIBILITY FOR THE USE OR RELIABILITY

/ OF ITS SOFTWARE ON EQUIPMENT WHICH IS NOT SUPPLIED BY

/ DEC.

/
	.TITLE EDIT LEGEND					/(001)
								/(001)
/ 001	13-MAY-76 (RCHM)	HAVE STOPIT RUNDOWN ALL OUT-	/(001)
/				STANDING TTY I/O.		/(001)
/ 002	2-JUNE-76 (SCR)		MISSING .INH
/ 003	14-JUL-76 (RCHM)	SPECIAL CASE FOR BATCH DEVICE.	/(003)
	.TITLE  STOPIT MAIN ROUTINE.				/(001)
CURTSK=135

TTMCTT=200

TTDVTT=201

ECLA=641000

.INH=705522

.ENB=705521

LUN1=142

LUN2=143

LUFD1=304

DUFD1=306

AFTP1=144

FAC=174

IDX=ISZ

PENP=115

R1=101

R2=102
SPRI=126

X10=10
PDVL=252
TTYS=176		/ POINTER TO THE NUMBER OF TTY UNITS ON
			/ THE SYSTEM.
MA.UCA=221		/ POINTER TO THE UCA BASE ADDRESS.
MA.BLU=224		/ BASE OF THE MULTI ACCESS LUNS.
MA.ELU=225		/ END OF THE MULTIACCESS LUNS.
MA.CT=226		/ POINTER TO THE ^T WORD.
MA.CST=230		/ ADDRESS OF THE BASE OF THE CONTROL AND
			/ STATUS TABLE.
	.GLOBL STOPIT,BEGBUF,ENDBUF				/(001)
/
STOPIT	0		/CALL WITH UCA ADDRESS IN AC
	LAC	(LUNTAB	/SET UP LAST POINTER
	DAC	LASTUN	/CALL WITH ONE LUN AT A TIME
	AND	(70000	/CONSTRUCT PAGE OFFSET
	DAC	MXADJ	/PAGE ADJUST XR BACK TO AC
	CMA!IAC
	DAC	XADJ	/PAGE ADJUST AC TO XR
 
/ REENTERED HERE IN CASE OF "FATAL" ERROR.
 
OVER	LAC* (MA.ELU)	/ FETCH THE END OF THE MULTIACCESS LUNS.
	TAD* (LUN1)	/ ADD IN LUT TABLE ADDRESS. THE OFF BY 1 PROBLEM
			/ HAS JUST CORRECTLY ADJUSTED THE LUT TABLE
			/ POINTER.
	DAC LUNTAB	/ BASE OF THE FIRST LUN.
	DZM	UNIT	/NEW UNIT # IS ZERO FOR NONE
	DZM	UFDNAM	/NEW UFD NAME IS ZERO FOR NONE
	LAC	(56	/NEW DEV IS NUL + . IN SIXBIT
	DAC	REQNAM
	LAC* (TTYS)	/ FETCH THE NUMBER OF DEVICES TO BE DEASSIGNED.
	CMA		/ SET UP FOR LOOP CONTROL.		/(003)
	DAC	COUNTR	/ASSIGN EVERYONE BACK TO NONE
OFFLOO	LAC	LASTUN	/ENDING LUN
	DAC	LUNADR	/MAKE IT ALSO THE FIRST ONE
	JMS	ASGWRK	/ACTUAL ASSIGNMENT WORK
	ISZ	LUNTAB	/TO NEXT LUT ENTRY ADDREESS
	ISZ	COUNTR	/MORE?
	JMP	OFFLOO
	.INH		/ INHIBIT INTERRUPTS DURING RESET PROCESS.
	DZM* (MA.UCA)
	DZM* (MA.BLU)
	DZM* (MA.ELU)
	DZM* (MA.CT)
	DZM* (MA.CST)
	.ENB
	LAC* BEGBUF	/ INITIALIZE POINTERS FOR TTY RUNDOWN	/(001)
	DAC BEGIN						/(001)
	LAC* ENDBUF						/(001)
	DAC END							/(001)
	JMS RUNDOWN	/ GO RUNDOWN ALL TTY I/O ON SYSTEM.	/(001)
	CAL (10)	/ KILL MULTIACCESS.
/

/

/  SUBROUTINE SETXR  --  ADJUST THE XR

/
SETXR	0

	TAD	XADJ

	PAX
	JMP*	SETXR
	.EJECT							/(001)
								/(001)
/ SUBROUTINE TO RUNDOWN OUTSTANDING TTY I/O.			/(001)
								/(001)
RUNDOWN	XX		/ENTRY POINT.				/(001)
	LAC BEGIN	/ FETCH START OF TTY BUFFERS.		/(001)
R.0010	SAD END		/ DONE YET?				/(001)
	JMP* RUNDOWN	/ YES, EXIT.				/(001)
	DAC P1		/ SAVE POINTER.				/(001)
	IAC		/ POINT TO WORD COUNT.		/(001)
	DAC P2		/ SAVE POINTER.				/(001)
	LAC* P1		/ I/O ACTIVE ON THIS BUFFER?		/(001)
	SNA		/ AC >< 0 IF NO.			/(001)
	CAL WAIT	/ WAIT FOR I/O TO COMPLETE.		/(001)
	LAC* P2		/ FETCH WORD COUNT.			/(001)
	AND (7777)	/ REMOVE TTY NUMBER FROM HIGH BITS.	/(001)
	TAD P1		/ ADVANCE POINTER TO NEXT ENTRY.	/(0019)
	JMP R.0010	/ CONTINUE WITH LOOP.			/(001)
	.TITLE *** ASSIGN WORKING ROUTINE ***

/

/  THIS ROUTINE TAKEN FROM ASSIGN, HAS BEEN MODIFIED

/  FOR OFF. ONLY ONE LUN AT A TIME IS SENT, SO THAT

/  LUNTAB IS A SINGLE LOCATION, RATHER THAN A BLOCK.

/  THE NEW DEVICE IS ALWAYS 'NONE'. THE OLD DEVICE

/  IS THAT FOUND IN THE TABLES. CHANGES MADE FOR OFF

/  WILL BE FLAGGED WITH /(OFF).

/

/  INPUT ARGUMENTS FOR ASGWRK

/

LASTUN	0		/POINTER TO LAST OF LIST OF LUT POINTERS

LUNADR	0		/POINTER FOR FIRST OF LIST

OLDNAM	0		/OLD DEVICE NAME

OLDUNT	0		/OLD UNIT NUMBER

UNIT	0		/NEW UNIT NUMBER

UFDNAM	0		/NEW UFD NAME

/

/  NEW DEVICE NAME IS IN A CAL UNDER NAME 'REQNAM'

/  THE DEVICE NAME HAS A '.' APPENDED TO IT

/

LUNTAB	0		/(OFF)LUT ENTRY ADDR

/

/

/  WORK REGISTERS FOR ASGWRK

/

TMPA	0

TMPB	0

TMPC	0

CNT	0

NEWPVD	0

TRGGR	0

/

TTA	.SIXBT	"TT"

DSK	.SIXBT	"DK@"

/
ASGWRK	0
	LAC*	LUNADR	/PICK UP THE POINTER TO THE PDVL
	DAC	CNT
	LAC*	CNT
	SNA		/SKIP IF NOT NONE
	JMP*	ASGWRK	/(OFF)NONE ALREADY, JUST GO BACK
/			/(OFF) REMOVE CHECKS
NOTNON	JMS	SETXR	/ USE XR TO CHECK OLD DEV,#
	LAC	2,X	/NAME CHECK
	DAC	OLDNAM	/(OFF)FETCH OLD NAME
	SAD (020400)	/ IS THE DEVICE NAME "BD@"???		/(003)
	JMP ASGSPC	/ YES, TAKE SPECIAL EXIT.		/(003)
	LAC	5,X	/ NUMBER
	DAC	OLDUNT	/(OFF)FETCH OLD UNIT
/			/(OFF) REMOVE I/O QUEUE BUSY CHECK
/
	LAC 10,X	/ CHECK IF THE HANDLER HAS INITIALIZED.
	SNA		/ AC = 0 IF NOT.
	JMP ERR7	/ WAIT FOR A SIGNIFICANT EVENT AND TRY AGAIN.
LUNCK=.			/(OFF)SECTION NOT NEEDED
UPDLUN=.		/SPECIAL CASE TTY STULFF NO LONGER NEEDED
STORNO	CLLR		/(OFF)NEW DEVICE

	LAC	(LUNTAB) /SET UP TO INSERT NODE POINTER

	DAC	LUNADR

SETUP	LAC*	LUNADR	/PICK UP THE LUNT TABLE POINTER

	DAC	TMPA

	LAC*	(LUN1)

	TCA

	DAC	TEMP

	TAD*	LUNADR	/DETERMINE THIS LUN NUMBER

	TAD*	(AFTP1)	/FIND THE  AFT TABLE POINTER

	DAC	TMPB

	LAC	TEMP	/FIND LUN-UFD POINTER

	TAD*	LUNADR

	TAD*	(LUFD1

	DAC	TMPC

	LAC*	LUNADR

	DAC	CNT

	LAC*	CNT	/POINT TO ASSING INHIBIT FALG
	AAC	11
	DAC	CNT
/			/(002)ELIMINATE FILES OPEN MESSAGE
/			/(002)HAPPENS OFTEN; OTHER USER'S FILES.
	.INH		/(002)
	PLA		/PICK UP NEW ASSIGNMENT
	DAC*	TMPA	/PUT IT IN THE TABLE
	LAC	UFDNAM	/ENTER UFD NAME IN LUN-UFD TABLE
	.ENB
	DAC*	TMPC
	LAC	LUNADR

	SAD	LASTUN

	JMP	REQOK	/YES SEARCH FOR CARRTN

	ISZ	LUNADR	/NO CHECK NEXT LUN IN TABLE

	JMP	SETUP	/NO LOOK UNTIL ARE SET

REQOK	LAC	OLDNAM	/IS THE DEV NAME NONE?

	SNA!CLL

	JMP*	ASGWRK	/NO FURTHER WORK FOR NONE

	LAC*	(LUN1)	/PICK UP LUN POINTER

	SKP

NXTNOD	IAC		/CHECK NEXT LUN

	TAD	XADJ	/SET UP XR TO LOOK AT LUN SLOTS

	PAX

	LAC	0,X	/LOOK AT A LUN POINTER

	AAC	2	/POINT TO PDVL NAME

	DAC	CNT

	LAC	OLDNAM	/LOOK FOR A NAME MATCH

	SAD*	CNT

	JMP*	ASGWRK	/ASSIGNMENT FOUND DON'T REQUEST HANDLER TO EXIT

	PXA		/CHECK FOR THE END OF THE TABLE

	TAD	MXADJ	/SUBTRACT PAGE BITS

	SAD*	(LUN2)	/ARE WE AT THE END OF THE TABLE ?

	SKP

	JMP	NXTNOD	/NO TRY ANOTHER ENTRY

	LAC	(400004)	/RAISE TO LEVEL 5 TO PREVENT HANDLER

	ISA		/FROM EXITING BEFORE ALL NODES HAVE BEEN FOUND

	LAC*	(PDVL)

	TAD	XADJ	/ADD PAGE BITS

	PAX		/SAVE IT IN XR

NXTND	LAC	2,X	/PICK UP THE DEVICE NAME

	SAD	OLDNAM	/IS IT THE OLD NAME?

	SKP		/YES SET ASSIGN INHIBIT FLAG

	JMP	NOASGN	/NO DON'T FLAG IT

	PXL		/SAVE LAST NODE ADDRESS

	LAC	11,X	/SET REASSIGN INHIBIT FLAG

	AND	(377777)

	XOR	(400000)

	DAC	11,X	/RESTORE WORD

	LAC	10,X	/SAVE TRIGGER EVENT VARIABLE ADDRESS

	DAC	TRGGR

	DZM	10,X	/CLEAR THE TRIGGER EVENT VARIABLE ADDRESS

NOASGN	LAC	0,X	/IS THIS THE END OF THE TABLE?

	SAD	(PDVL)

	JMP	EXNOD	/YES EXIT

	TAD	XADJ	/ADD PAGE BITS

	PAX

	JMP	NXTND	/SEARCH NEXT NODE
EXNOD	JMS*	(PENP)	/PICK UP A NODE FOR 777 REQUEST

	JMP	ERR5	/EMPTY POOL ERROR

	DAC*	(R2)	/SAVE NODE ADDRESS FOR SPRI

	TAD	XADJ

	PAX

	LAC*	(CURTSK)

	AAC	6	/FIND A GOOD STL NODE ADDRESS

	DAC	CNT

	LAC*	CNT

	DAC	2,X

	DZM	3,X	/CLEAR UNUSED WORDS

	DZM	7,X

	DZM	10,X

	DZM	11,X

	LAC	(1002)	/SET PRIORITY TO 514

	DAC	4,X

	AAC	-3

	DAC	5,X	/SET REQUEST TYPE TO 777

	DZM	6,X	/CLEAR EVENT VARIABLE ADDRESS

	PLA		/PICK UP LAST NODE FOUND FOR 777 REQUEST

	TAD	MXADJ	/SUBTRACT PAGE BITS

	AAC	6	/POINT TO THE QUEUE

	DAC*	(R1)

	JMS*	(SPRI)	/PUT NODE IN REQUEST QUEUE

	DBK		/DEBREAK FORM LEVEL 5

	LAC	(401000)	/SET SIGNIFICANT EVENT

	ISA

	.INH		/INHIBIT INTERRUPTS

	LAC*	TRGGR	/LOOK AT TRIGGER

	AND	(377776)	/MASK OFF BITS

	XOR	(400001)	/SET Q I/O
	.ENB		/ENABLE INTERRUPTS
	DAC*	TRGGR
	JMP*	ASGWRK	/DONE!
 
ASGSPC	DZM* CNT	/ CLEAR LUT ENTRY.			/(003)
	JMP* ASGWRK	/ DONE !!!				/(003)

	.TITLE	*** STORAGE, CAL'S, MESSAGES, ETC. ***

/

REQCPB	1

	EV

REQNAM	0

	.SIXBT	"..."

	0

/
P2	0		/ ADDRESS OF WORD COUNT FOR A TTY BUFFER/(001)
/
WAIT	20		/ WAIT FOR TTY I/O.			/(001)
P1	0		/ TTY BUFFER EVENT VARIABLE.		/(001)
/
BEGIN	0		/ BEGINNING OF TTY BUFFER POOL.		/(0019)
END	0		/ END OF BUFFER POLL.			/(001)

/

EV	0

/
ERR5=.
ERR7=.
ERR10=.
	CAL (5)		/ WAIT FOR THE NEXT SIGNIFICANT EVENT.
	JMP OVER	/ AND RESTART THE TERMINATION PROCESS.
/
XADJ	0

MXADJ	0

TEMP	0

UCAXR	0

TTYNUM	0

MESSET	0

USERNO	0

COUNTR	0

STATUS	0
	.END
