	.TITLE	*** TDV OVERLAY DEV ***

/

/ 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.

/

	.EJECT

/

/

/ EDIT 011	15-APR-76 (SCR) WRITE FROM SCRATCH
/ EDIT 012	15-APR-76 (SCR) COPYRIGHT
/ EDIT 013	16-APR-76 (SCR) BUG FIX

/

/ OVERLAY NAME "DEV..." TO PRINT OUT USER'S MAPPED LUNS

/

ECLA=641000

LUN1=142

LUFD1=304

IDX=ISZ

X10=10

	.IFUND	MA.NLU		/# OF MAPPED LUNS PER USER

MA.NLU=31

	.ENDC

/

/

/ MACRO TO DEFINE OFFSETS INTO THE USER CONTEXT AREA.

/

	.DEFIN UCAOFF

U.JSW=0				/OFFSET TO JOB STATUS WORD.

U.MAEV=1			/OFFSET TO EVENT VARIABLE

U.MAMTE=2			/OFFSET TO MARK TIME EVENT VARIABLE.

U.OEV=3				/OFFSET TO OVERLAY EVENT VARIABLE.

U.DSK=4				/OFFSET TO DISK NAME

U.DUN=5				/OFFSET TO DISK UNIT NUMBER

U.UFD=6				/OFFSET TO UFD NAME.

U.CTSK=7			/OFFSET TO CURRENT TASK NAME

U.PSC=11			/OFFSET TO PARTITION SELECTION CRITERIA.

U.ULOF=14			/OFFSET TO USER NUMBER AND LUN OFFSET.

U.TTYN=15			/OFFSET TO USER TERMINAL NUMBER.

U.TB=16				/OFFSET TO USER TERMINAL BUFFER.

U.CPB=62			/OFFSET TO MULTI-ACCESS CPB.

U.SSM=74			/SECONDS SINCE MIDNIGHT INTO STATE 11

				/ OR 12 (HUNG ON PARTITION)

U.TW=75				/TOTAL TIME IN SECONDS SPENT IN STATE 11

				/ OR 12.

U.OVID=76			/OVERLAY IDENTIFIER (LAST OVERLAY CALLED)

U.CKS=77			/CHECKSUM OF INPUT BUFFER FOR TIMED READ.

U.LEN=100			/LENGTH OF UCA.

	.DEFIN UCAOFF

	.ENDM

	.ENDM

/

	UCAOFF

/

	.GLOBL	DEV,TDVTYP

/

/

UCAXR	0		/SAVE POINTER TO USER CONTEXT AREA

XADJ	0		/XR ADJUSTMENT FOR THIS PAGE

SAVXR	0		/CORE COPY OF XR FOR OUTER LOOP

TABPNT	0		/POINT TO TABLE OF FOUND FLAGS

LUTPNT	0		/POINT TO USER LUN '0' PDVL NODE

UFDPNT	0		/POINT TO USER LUN '0' UFD NAME

UFDNAM	0		/UFDNAME OF DEVICE,UFD IN OUTER LOOP

PDVLND	0		/PDVL NODE OF DEVICE OUTER LOOP

TTYNUM	0		/TTY NUMBER OF USER

BUFF	.BLOCK	40	/BUFFER FOR OUTPUT TTY LINE

	.IFPNZ	MA.NLU-31

ZOT=MA.NLU-31

	.BLOCK	ZOT/5+ZOT	/MORE SPACE IF MORE LUNS

	.ENDC

FOUND	.BLOCK	MA.NLU+1	/TABLE OF FOUND FLAGS FOR LUNS

/

DEV	0		/CALL WITH UCA ADDRESS IN AC

	DAC	UCAXR	/HOLD UNCORRECTED ADDR

	LAC	(FOUND	/ADDR OF TABLE OF FOUND FLAGS

	PAX		/XR LATER IN CLEAR LOOP

	DAC	TABPNT	/INDERECT POINTER TO TABLE FOR MAIN LOOP
	AAC	MA.NLU+1 /LR FOR CLEAR LOOP

	PAL

	AND	(70000	/MAKE XR CORRECTION

	CMA!IAC

	DAC	XADJ

DEVZER	DZM	0,X	/CLEAR FOUND FLAG TABLE

	AXS	1

	JMP	DEVZER

/

	LAC	UCAXR	/GET BACK UCA ADDR

	TAD	XADJ	/CORRECT FOR PRESENT PAGE

	DAC	UCAXR	/SAVE CORRECTED VALUE

	PAX		/SET UP XR TO FETCH DATA FROM UCA

	777000		/DESIRED BITS IN LEFT HALF

	AND	U.ULOF,X /LUN OFFSET FOR THIS USER

	SWHA

	AAC	-3	/TAB STARTS AT 1 + LUNOFF IS 2

	TAD*	(LUN1	/ADDR OF LUT TO BE 0 IN USER'S

	DAC	LUTPNT	/LUN SPACE. POINTER

	TAD*	(LUFD1	/ADDR OF UFD TABLE ADDED IN

	CMA!IAC		/SET UP TO SUBTRACT OFF

	TAD*	(LUN1	/THE LUT TABLE ADDR

	CMA!IAC		/BACK TO + AGAIN TO GIVE ADDR

	DAC	UFDPNT	/OF UFD WHICH IS 0 IN USER'S LUN SPACE

	LAC	U.TTYN,X /TELETYPE NUMBER

	DAC	TTYNUM

	LAC	(MA.NLU+1 /LIMIT REG CONTROLS INNER AND OUTER

	PAL		/LOOPS; XR GOES UP TO MA.NLU

	LAC	(2	/OUTER LOOP XR GOES 2 TO MA.NLU

	DAC	SAVXR	/THE FIRST TIME, 3 TO MA.NLU THE

	PAX		/SECOND TIME, ETC.

/
DEVL00	LAC*	TABPNT,X /START OUTER ON NEXT LUN

	SZA		/SKIP IF THIS LUN NOT YET PRINTED OUT

	JMP	DEVL20	/HAS BEEN PRINTED, MOVE OUTER LOOP TO NEXT
	LAC*	LUTPNT,X /FETCH PDVL NODE POINTER FOR LUN
	DAC	PDVLND	/(013)SAVE NODE ADDR FOR INNER LOOP COMPARE
	SNA!IAC		/SKIP IF NOT NONE, POINT TO NODE+1
	JMP	DEVL20	/'NONE' MOVE OUTER LOOP TO NEXT
	DAC*	(X10	/FETCH DEVICE NAME THRU X10
	LAC	(PACK1	/INIT ASCII PACKER TO MAKE THIS LINE

	DAC	PACKX	/DISPATCHER POINTS TO CHAR #1 OF 5

	LAC	(BUFF+1	/DATA POINTER TO DATA-1 (HEADER)

	DAC	PACKPT

	LAC*	X10	/DEVICE NAME, NODE+2

	JMS	PAKNAM	/PLACE NAME IN OUTPUT LINE

	LAC*	X10	/MOVE POINTER TO GET

	LAC*	X10	/UNIT NUMBER FROM

	LAC*	X10	/NODE+5

	JMS	DECOMP	/BREAK INTO ASCII AND PLACE IN LINE

	LAC*	UFDPNT,X /GET UFD FOR THIS DEVICE

	DAC	UFDNAM	/SAVE FOR COMPARES .FOR NON DISKS

/			/THIS IS ALWAYS 0, COMPARE WILL MATCH.

	JMS	PAKUFD	/INTO OUTPUT LINE, IF IT EXISTS, THAT IS.

	LAC	(40	/SPACE BEFORE LUNS

	JMP	DEVENT	/ENTER INNER LOOP

/

/  INNER LOOP

/

/  CHECK ALL LUNS ABOVE THE LUN OF THE OUTER LOOP TO SEE

/  IF NAME AND UFD MATCH. IF THEY MATCH, SET THE FOUND

/  FLAG FOR THIS LUN, AND ENTER THE LUN NUMBER INTO THE

/  OUTPUT LINE FOR THIS DEVICE, UFD PAIR.

/

DEVL01	LAC*	LUTPNT,X /PDVL NODE ADDR

	SAD	PDVLND	/SAME?

	SKP		/YES, KEEP CHECKING

	JMP	DEVL10	/NO, INCREMENT INNER LOOP FOR NEXT

	LAC*	UFDPNT,X /UFD NAME

	SAD	UFDNAM	/SAME?

	SKP		/YES

	JMP	DEVL10	/NO, INCREMENT INNER LOOP

	IDX*	TABPNT,X /SET THE FOUND FLAG, SO OUT LOOP

/			/DOESN'T DO THIS DEVICE AGAIN

	LAC	(54	/COMMA BEFORE ADDITIONAL LUN #

DEVENT	JMS	PACK	/FIRST TIME ENTERS HERE TO DO BLANK

	PXA		/LUN NUMBER

	JMS	DECOMP	/PLACE NUMBER IN OUTPUT STRING

DEVL10	AXS	1	/INNER LOOP CONTROL

	JMP	DEVL01	/MORE

	JMS	OUTMES	/PRINT THIS DEV,UFD AND ITS LUNS

	LAC	(MA.NLU+1 /RESTORE LR

	PAL

	LAC	SAVXR	/SET UP XR FOR OUTER LOOP

	PAX

DEVL20	IDX	SAVXR	/MOVE TO NEXT FOR SAVE

	AXS	1	/OUTER LOOP DONE

	JMP	DEVL00	/NO

/

DONE	LAC	UCAXR	/XR TO POINT TO UCA AREA

	PAX

	LAC	(6	/TASK STATE

	DAC	U.JSW,X	/

	AAC	-5	/NO ERROR RETURNS POSSIBLE

	DAC	U.OEV,X	/OVERLAY STATUS

	JMP*	DEV

/

/
	.TITLE	*** UTILITY ROUTINES ***

/

/  PACK

/

/  IOPS ASCII PACKING ROUTINE

/

/  CALL WITH THE ASCII CHAR IN THE AC

/
/  INITIALIZE BY PLACING ADDRESS PACK1 INTO PACKX,
/  AND PLACING STARTING ADDRESS-1 OF DATA BUFFER INTO PACKPT
/
/  NOT NECESSARY TO CLEAR DATA BUFFER BEFORE USE.
/
/  MODIFIED REGISTERS  AC AND LINK

/

PACK	0

	AND	(177	/STRIP TO ASCII SIZE

	JMP*	PACKX	/DISPATCH TO CORRECT ACTION

PACKX	XX		/ADDRESS OF ROUTINE

	DAC*	PACKPT	/ALL 5 ACTIONS FINISH WITH THIS

	JMP*	PACK

/

PACKT	JMS	PACKX	/LEAVING POINTER FOR FIRST ACTION

/

PACK1	IDX	PACKPT	/MOVE POINTER TO NEXT PAIR

	CLL!SWHA	/1ST CHAR, LEFT JUSTIFY

	RTL

	JMS	PACKX	/LEAVING POINTER FOR SECOND

/

PACK2	RTL!CLL		/2ND CHAR, MOVE LEFT FOUR

	RTL		/TO FIT ONTO FIRST

	XOR*	PACKPT	/MERGE WITH FIRST

	JMS	PACKX	/LEAVING POINTER FOR THIRD

/

PACK3	RTR!CLL		/MOVE DOWN 3 FOR FIRST HALF CHAR

	RAR

	DAC	PACKX	/SAVE FOR SECOND HALF

	AND	(17	/FOUR BITS INTO FIRST WORD

	XOR*	PACKPT

	DAC*	PACKPT

	IDX	PACKPT	/MOVE POINTER TO SECOND WORD OF PAIR

	LAC	PACKX	/YES, THIS REALLY IS A SAFE TEMPORARY

	RAR		/TWO BITS ON TOP OF AC, AND THE LINK

	AND	(700000	/TO MAKE UP THE TOP THREE BITS

	JMS	PACKX	/LEAVING POINTER FOR FOURTH

/

PACK4	CLL!SWHA	/MOVE LEFT 8

	RAR

	XOR*	PACKPT

	JMS	PACKX	/LEAVING POINTER FOR FIFTH

/

PACK5	CLL!RAL		/LEFT ONE FOR FIFTH CHAR

	XOR*	PACKPT

	JMP	PACKT	/BACK TO TOP TO LEAVE POINTER FOR 1ST

/

PACKPT	XX		/PACK POINTER, ONLY GOOD UP TO 32K

/

/  DECOMP

/

/  THE NUMBER IN THE AC IS PACKED INTO THE ASCII

/  STRING, USING THE PACK SUBROUTINE.

/

/  MAX VALUE CORRECTLY DECOMPOSED IS 999. LEADING

/  ZEROS ARE NOT PRINTED.

/

/  MODIFIED REGISTERS  AC, LINK, MQ

/

/

DECOMP	0

	DZM	DECOMS	/LEADING ZERO SWITCH

	IDIV		/DIVIDE BY 100 FIRST

	144

	JMS	DECOML	/PRINT FIRST, RETURN REMAINDER IN AC

	IDIV		/DIVIDE BY 10

	12

	JMS	DECOML	/PRINT SECOND. RETURN REMAINDER IN AC

	AAC	60	/THIRD DIGIT ALWAYS GOES OUT

	JMS	PACK	/INTO STRING

	JMP*	DECOMP

/

/  SUBROUTINE DECOML

/

/  CALL WITH REMAINDER IN AC, TO BE SAVED AND RESTORED

/  CALL WITH DIGIT TO BE PRINTED IN MQ

/  CALL WITH DECOMS=0 IF A ZERO IS NOT TO BE PRINTED

/

/  DECOML WILL SET DECOMS NON0 WHEN IT PRINTS A CHAR

/

DECOML	0

	DAC	DECOMT	/SAVE AC

	LACQ		/DIGIT TO GO OUT

	SAD	DECOMS	/EQUAL ONLY IF BOTH 0

	JMP	DECOMZ	/JUST GO RESTORE AC

	AAC	60	/MAKE ASCII

	DAC	DECOMS	/MAKE COMPARE ON DECOMS FAIL!!

	JMS	PACK	/CHARACTER OUT

DECOMZ	LAC	DECOMT	/FETCH BACK THE AC

	JMP*	DECOML

/

DECOMS	0		/LEADING ZERO SWITCH

DECOMT	0		/TEMPORARY TO SAVE AC

/

/  PAKUFD

/

/

/  CALL WITH UFD NAME IN AC

/

/  IF UFD NAME IS NULL, NO ACTION IS TAKEN

/  OTHERWISE , THE STRING " <NNN>" IS PACKED INTO

/  THE BUFFER, USING THE PACKER "PACK"

/

/  MODIFIED REGISTERS   AC, LINK, MQ

/

PAKUFD	0

	SNA		/SKIP IF THERE IS ONE

	JMP*	PAKUFD

	LMQ		/GRAB CHAR'S OUT OF MQ

	LAW	-3	/SET UP COUNTER

	DAC	PAKUFC

	LAC	(40	/BLANK TO SEPARATE FROM NAME

	JMS	PACK

	LAC	(74	/OPEN ANGLE

	JMS	PACK

PAKUFL	ECLA!LLS!6	/SPIN OUT NEXT SIXBIT CHAR

	XOR	(40	/CONVERT BACK TO ASCII

	AAC	40

	JMS	PACK	/PLACE IN OUTGOING TEXT STRING

	ISZ	PAKUFC	/GOT THREE YET

	JMP	PAKUFL	/KEEP GOING

	LAC	(76	/CLOSE ANGLE

	JMS	PACK

	JMP*	PAKUFD

/

PAKUFC	0		/CONTROL COUNT 3 CHAR'S PER UFD

/

/

/  PAKNAM

/

/  THE FIRST TWO CHARACTERS OF THE SIXBIT NAME 

/  DELIVERED IN THE AC ARE PLACED INTO THE OUTPUT

/  STRING USING THE PACKING ROUTINE "PACK"

/

/  MODIFIED REGISTERS  AC, LINK, MQ

/

PAKNAM	0

	LMQ		/FETCH SIXBIT FROM MQ

	ECLA!LLS!6	/SIXBIT CHAR INTO AC

	AAC	100	/ALPHA'S NEED MERELY ADD 100

	JMS	PACK

	ECLA!LLS!6	/SECOND CHAR OF NAME

	AAC	100

	JMS	PACK

	JMP*	PAKNAM

/

/

/  OUTMES

/

/  SEND OUT ACCUMULATED MESSAGE FOR THIS DEVICE

/

/  ALL REGISTERS ARE DESTROYED

/

OUTMES	0

	LAC	(15	/TERMINATE MESSAGE WITH CR

	JMS	PACK

	LAC	(BUFF-2 /MAKE WORD PAIR COUNT

	CMA!IAC

	TAD	PACKPT

	ALSS	10	/INTO POSITION

	AND	(377000	/CLEAR EXTRA BITS

	AAC	2	/MAKE ASCII

	DAC	BUFF

	JMS*	TDVTYP

	LAC	TTYNUM	/XCT'D FROM TDVTYP; TERMINL #

	LAC	(BUFF	/XCT'D FROM TDVTYP; WHERE

	LAC	(2	/XCT'D ; ASCII

	JMP*	OUTMES	/SOMEONE ELSE INIT'S PACKER.

/

	.END
