	.TITLE	VT
/ 
/ 
/                   FIRST PRINTING, FEBRUARY 1974
/ 
/ THE INFORMATION IN THIS DOCUMENT IS SUBJECT TO 
/ CHANGE WITHOUT NOTICE AND SHOULD NOT BE CONSTRUED
/ AS A COMMITMENT BY DIGITAL EQUIPMENT CORPORATION.
/ DIGITAL EQUIPMENT CORPORATION ASSUMES NO RESPON-
/ SIBILITY FOR ANY ERRORS THAT MAY APPEAR IN THIS
/ DOCUMENT.
/ 
/ THE SOFTWARE DESCRIBED IN THIS DOCUMENT IS FUR-
/ NISHED TO THE PURCHASER UNDER A LICENSE FOR USE ON
/ A SINGLE COMPUTER SYSTEM AND CAN BE COPIED (WITH
/ INCLUSION OF DIGITAL'S COPYRIGHT NOTICE) ONLY FOR 
/ USE IN SUCH SYSTEM, EXCEPT AS MAY OTHERWISE BE PRO-
/ VIDED IN WRITING BY DIGITAL.
/ 
/ DIGITAL EQUIPMENT CORPORATION ASSUMES NO RESPONSIBILITY
/ FOR THE USE OR RELIABILITY OF ITS SOFTWARE ON EQUIP-
/ MENT THAT IS NOT SUPPLIED BY DIGITAL.
/ 
/ COPYRIGHT (C) 1974, BY DIGITAL EQUIPMENT CORPORATION
/ 
/ 
        .EJECT
/
/ EDIT #22	7/16/73		S. ROOT
/	UPDATE COPYRIGHT
/ EDIT #23	8/20/74		S. ROOT
/	IMPLEMENT TRACKING FOLLOW FEATURE
/
/ PROGRAM CODE UNKNOWN
/
/ COPYRIGHT 1972, DIGITAL EQUIPMENT CORP., MAYNARD, MASS., 01754
/
/	VT-15 HANDLER UNDER RSX-PLUS
/
/ ASSUME A MAXIMUM CONFIGURATION OF 4 SCOPES ON TWO VT-15
/ PROCESSORS. VT0 AND VT1 ARE ON THE FIRST PROCESSOR. VT2 AND VT3
/ ARE ON THE SECOND PROCESSOR.
/
	.DBREL
/
/	RSX EQUALITIES
/
R1=101
R2=102
R3=103
R4=104
POOL=240
PDVL=252
NADD=107
ALAD=325
DLAD=332
DQRQ=337
IOCD=345
VJAX=342
PICK=120
DMTQ=361
VTINFO=13			/DEVICE 13. NO INPUT,OUTPUT, DIRECT.
.INH=705522
.ENB=705521
/
/	GRAPHICS EQUALITIES
/
LEN=400	/DIFFERENCE BETWEEN VT0 AND VT2 IOT'S
DJMP=600000
DJMPI=620000
DJMS=640000
DJMSI=660000
DSKP=235000
DNOP=200000
PX=144000
PY=140000
INT=20000
V0=400000
V1=402000
V2=404000
V3=406000
V4=410000
V5=412000
V6=414000
V7=416000
LPENL=40000
LDNM=234400
RESTR=260000
INSTP=204000
/
/	ASSEMBLY PARAMETERS
/
/	WITH NO PARAMETERS PROVIDED, THE ASEMBLY WILL
/  BE FOR ALL FOUR TUBES. IF ANY ARE PROVIDED, THE
/  ASSEMBLY WILL BE ONLY FOR THOSE PROVIDED.
/
	.IFDEF	SCOPE0
TUBE0=1
NODFLT=1
	.ENDC
	.IFDEF	SCOPE1
TUBE1=1
NODFLT=1
	.ENDC
	.IFDEF	SCOPE2
TUBE2=1
NODFLT=1
	.ENDC
	.IFDEF	SCOPE3
TUBE3=1
NODFLT=1
	.ENDC
	.IFUND	NODFLT
TUBE0=1
TUBE1=1
TUBE2=1
TUBE3=1
	.ENDC
/
/	TUBE0 AND 1 ARE ON THE FIRST VT-15 PROCESSOR, WHICH HAS
/  7030XX  IOT'S. IF A TUBE IS NOT PRESENT, REMOVE IT'S DEFINING
/  EQUALITY. TUBE1 MAY NOT BE PRESENT WHEN TUBE0 IS ABSENT!
/  TUBE2 AND 3 ARE ON THE SECOND VT-15 PROCESSOR, WHICH HAS 7034XX
/  IOT'S. LIKEWISE, TUBE3 MAY NOT BE PRESENT WHEN TUBE2 IS MISSING.
/
/     NOW FOR THE TRACKING SYMBOL.
OSIZE=140
SIZE=100
ITER=3
/
/	OSIZE IS THE SIZE OF THE OUTER SINGLE SQUARE, WHICH MOVES
/  THE TRACKING SYMBOL IN LARGE STEPS WHEN IT RECEIVES A HIT. IT IS
/  PROBABLY OK AS IS. SIZE IS THE SIZE OF THE INNER SQUARE, WHICH
/  GIVES FINE CONTROL. FOR A LARGER SCOPE THIS SHOULD PERHAPS
/  BE SLIGHTLY SMALLER TO REDUCE THE 'DEAD' SPOT IN THE MIDDLE OF
/  THE INNER SQUARE.  IF THE DEAD SPOT DISSAPPEARS ENTIRELY, THE
/  SYSTEM LOADING IS INCREASED SINCE THE LIGHT PEN CAN "SEE" ALL
/  FOUR SIDES OF THE INNER SQUARE AT ONCE, RATHER THAN JUST TWO.
/  ITER IS HOW MANY TIMES THE INNER SQUARE IS DRAWN. EACH DRAWING
/  INCREASES THE FINE CONTROL BUT GENERATES A HIGHER PROCESSOR LOAD.
/
/
/
/
/		INITIALIZATION CODE.
/
VTA	LAC	(VTEV	/GET EVENT ADDRESS FOR THIS PAGE CALCULATION
	AND	(70000	/KEEP ONLY PAGE BITS
	CMA!IAC		/MAKE NEGATIVE FOR INDEX REGISTER CORRECTION
	DAC	NEGPAG	/FOR 0,X TYPE OF ADDRESSING
CONNCT	CAL	VTCON	/CONNECT TRAP ADDRESS (!BOTH VT'S ON SAME!)
	LAC	VTEV	/NOW TO SEE IF IT WORKED
	SPA		/SKIP ON YES
	CAL	(10	/DIDN'T WORK, EXIT . . . 
VTPDVL	LAC*	PDVLIT	/GET FIRST NODE ADDRESS
VTPDL	DAC	XTRA+2	/SAVE RAW ADDRESS
	TAD	NEGPAG	/SUBTRACT HANDLER OCCUPIED PAGE BITS
	PAX		/TO POINT TO NODE WITH INDEX
	LAC	2,X	/GET DEVICE NAME, SHOULD BE VT.   
	SAD	VTSXBT	/SKIP UNLESS IT'S A VT
	JMP	VTFND	/GOT ONE! GO DO SETUP
NOPE	LAC	0,X	/GET POINTER TO NEXT NODE
	SAD	PDVLIT	/IF POINTS TO FIRST, WE'RE DONE
	JMP	SCNFIN	/IT DOES, SCAN OF NODES DONE
	JMP	VTPDL	/MORE TO DO , BACK TO LOOP
/
/  LITERAL FOR PDVL DEQUE HEAD ADDR.
/
PDVLIT	PDVL
/
/
/		SAVE VT NODES IN TABLE ORDERED BY UNIT
/
VTFND	LAC	5,X	/GET UNIT NUMBE
	TAD	(VTTAB	/ADD TABLE TOP ADDRESS
	DAC	XTRA+1	/PUT INTO TEMPORARY
	LAC	XTRA+2	/RETURN RAW ADDR. OF DEVICE NODE
	DAC*	XTRA+1	/PUT IT INTO TABLE.
	LAC	(VTEV	/GET HANDLER EVENT VARIABLE ADDRESS
	DAC	10,X	/AND PUT INTO PHYSICAL TABLE,SO IT CAN "CALL" US
	JMP	NOPE	/GO GET NEXT NODE
/
SCNFIN	LAC	XTRA+1	/NOW TO SEE IF WE GOT ANY
	SNA!CLA		/SKIP WHEN YES. CLA FOR COMING AAC.
	JMP	DISC	/WE DIDN'T FIND ANY, DISCONNECT
	AAC	WAIT-VTA-3	/WILL THIS WORK?
	PAL		/INTO LIMIT FOR LOOP CONTROL
	CLX		/ZERO XR FOR VT0 FOR CLEAN-UP LOOP
	JMS	CLEAN	/MAKE SURE VT-15 PROCESSOR IS BEHAVING
	AXR	2	/FOR VT2, SECOND PROCESSOR
	JMS	CLEAN	/CLEAN LEAVES THE LIMIT REG. ALONE
	CLX		/SET UP LOOP FOR CLEARING
	DZM	VTA,X	/FOR CLEARING OF INIT CODE
	AXS	1	/DONE?
	JMP	.-2	/NOPE
WAIT	CAL	VTWAIT	/WAIT FOR EVENT VARIABLE
	.INH		/? BECAUSE BOB DOES IT
	LAC	VTEV	/FIND OUT IF ABORT REQ.
	AND	(100000	/LEAVE ONLY I/O RUNDOWN BIT
	SZA		/SKIP ON REGULAR
	JMP	ABORT	/GO DO ALL HAIRY STUFF TO CLEAN UP USER.
	.ENB		/ALLOW INTERRUPTS AGAIN
WAITR	DZM	VTEV	/HEY, SOMETHING HAPPENED.CLEAR VARIABLE FOR NEXT
	DZM	UNITXR	/WILL SCAN BY UNIT NO. START WITH 0
	SKP		/GO OVER INCREMENT ON LOOP TOP
VTNXT	ISZ	UNITXR	/GO TO NEXT UNIT # TO LOOK FOR ACTION
	LAC	UNITXR	/NOW TO GET INTO XR
	PAX
	LAC	VTTAB,X	/GET NODE ADDR FOR THIS UNIT
	SPA		/SKIP ON REAL OR EMPTY NODE
	JMP	LEAVE	/MINUS AS END OF TABLE "STOPPER"
/			/GO CHECK TO SEE IF HANDLER MUST LEAVE CORE
	SNA		/SKIP ON REAL NODE
	JMP	VTNXT	/EMPTY NODE (I.E. NO DEVICE) IS ZERO, GET NEXT.
	DAC*	(R1	/REAL NODE ADDR. TO GET REQUEST
	LAC	POST0,X	/FIND OUT IF WAITING FOR INTERRUPT
	SZA		/IF NOT, SKIP AND TRY TO DE-QUEUE
	JMP	BAKDWN	/WE ARE WAITING, GO CHECK FURTHER
	JMS*	(DQRQ	/GET ADDR OF REQUEST NODE
	JMP	VTNXT	/WASN'T ONE FOR THIS DEVICE, CHECK NEXT DEVICE
	DAC	ZOT	/SAVE TEMPORARILYWHILE GET UNITXR BACK
	LAC	UNITXR	/GET BACK UNIT #
	PAX		/FOR TABLES INDEXED BY IT
	LAC	ZOT	/GET BACK NODE ADDRESS
	DAC	RWNOD,X
	AAC	4	/POINTER TO GO INTO AUTO-INCR
	DAC*	(10	/TO GET 5,X AND 7,X WITHOUT USING XR
	AAC	-1	/NODE+3 POINTS TO PBDL NODE (FOR NORMAL MODE)
	DAC	ZOT3	/SUPER TEMPORARY
	LAC*	ZOT3	/NOW HAVE ADDR OF PBDL NODE
	SZA		/EXCEPT IS ZERO FOR EXEC MODE
	AAC	7	/NOW HAVE ADDR OF THE COUNT DOWN WORD
	DAC	IOCADD	/AND SAVE THAT ADDR IN CASE NEEDED
	LAC*	10	/GET CAL CODE AT "5,X"
	AND	(777	/STRIP EXTRA BITS OFF CODE
	DAC	ZOT	/HOLD IN TEMPORARY
	SAD	(36	/IS IT HINF
	JMP	HINF
	SAD	(777	/EXIT REQUEST
	JMP	ELEX	/MAYBE WE HAVE TO DO IT THIS WAY?!?
	CLL!RAR		/CODE/2. WITH REMAINDER IN LINK
	SAD	(12	/ATTACH OR DETACH (24 OR 25)
	JMP	ATTACH
	SAD	(14	/GET OR PUT
	JMP	GORP	/GET AND PUT REMAIN IN COMMON FOR A WHILE
VTUNIM	LAW	-6	/UNIMPLEMENTED FUNCTION
	JMP	ERRREQ	/SENDS PRESENT AC TO USER EVENT VARIABLE
FINREQ	CLA!IAC		/REGULAR SEQUENCE. 1 INTO VARIABLE
ERRREQ	DAC	GIVEEV	/EVENT VARIABLE CONTENTS FOR "GIVE"
	LAC	UNITXR	/BRING BACK UNIT # TO XR
	PAX
	LAC	RWNOD,X	/GET NODE ADDR FOR CALLS TO IOCD, NADD
	DZM	CNTAB,X	/CONTROL TABLE ADDR SERVES AS FLAG THAT AN
/			/OPERATION IS OUTSTANDING. RESET THE FLAG.
	DZM	RWNOD,X /SO DOES NODE ADDR.
	JMS	GIVE	/ROUTINE GIVES USER EV THE CONTENTS OF GIVEEV
/			/DECLARES EVENT, DOES IOCD, RETURNS NODE.
	JMP	VTNXT	/MAY STILL BE OTHER REQUESTS
/
BAKDWN	SAD	VT0W,X	/IF THIS SAME, NO INTERRUPT YET
	JMP	VTNXT	/NOPE, GO LOOK FOR MORE WORK TO DO
	DZM	POST0,X	/INTERRUPT, ZERO GUY SAYING WE'RE WAITING.
	LAC	CNTAB,X	/SET UP AUTO #11 WITH RETURN BUFFER ADDR
	DAC*	(11	/
	JMP	HOLD,X	/DISPATCH TO WAITING ROUTINE
/
/
LEAVE	LAC	(VTTAB-1 /SCAN VTTAB FOR PDVL  NODE
	DAC	UNITXR	/USE THIS FOR POINTER
LLL	ISZ	UNITXR	/MOVE TO NEXT TABLE ENTRY
	LAC*	UNITXR	/FIND OUT IF REAL NODE ADDR HERE.
	SNA		/SKIP IF REAL ONE
	JMP	LLL	/NOPE(TABLE MAY HAVE HOLES)
	TAD	NEGPAG	/CORRECT FOR PAGE BITS OF HANDLER
	PAX		/NOW WE CAN ACCESS NODE ENTRIES
	LAC	11,X	/REASSIGN INHIBIT FLAG.
	SMA		/WHEN NEGATIVE, HANDLER HAS NO UNITS,
	JMP	WAIT	/OK, JUST BACK TO WAIT LOOP
ELEX	LAC	(400004	/, AND WE MUST LEAVE. RAISE LEVEL TO 5
	ISA		/SO NO ONE MESSES US UP
	CLX		/XR 0 FOR VT0 TO STOP IT CLEANLY
	JMS	CLEAN
	AXR	2	/FOR VT2, NO-OP IF DEVICE IS MISSING
	JMS	CLEAN
	LAW	-24	/CODE TO SAY HANDLER ASSIGNED AWAY!
	DAC	GIVEEV	/RETURN TO WAITING NODES BY "GIVE"
	LAC	(VTTAB-1 /SCAN ALL REAL DEVICES TO CLEAN UP
	DAC	UNITXR	/USE THIS AS POINTER TO DEVICE TABLE
	LAC	(RWNOD-1 /SCAN ALL UNACTED ON NODES TO RETURN
	DAC	IOCADD	/AND THIS LOC CAN BE USED AS POINTER
ELL	ISZ	UNITXR	/MOVE TO NEXT TABLE ENTRY
	ISZ	IOCADD	/MOVE TO NEXT SAVED NODE TABLE ENTRY
	LAC*	UNITXR	/GET IT
	SPA		/SKIP IF REAL, OR EMPTY
	JMP	FAKER	/GO CLEAN UP IOCD'S WE'VE FUNDGED
	SNA		/SKIP ON REAL ONE
	JMP	ELL	/EMPTY ONE, GO GET NEXT
	AAC	6	/ADDR OF HEAD OF WAIT Q NOW IN AC
	DAC	ZOT	/SAVE IT
	TAD	NEGPAG	/NODE+6 NOW CORRECTED FOR OUR PAGE
	PAX		/IN XR SO WE CAN GET OTHER NODE LOC'S
	DZM	2,X	/CLEAR TRIGGER
	DZM	3,X	/CLEAR ASSIGN INHIBIT
	LAC*	IOCADD	/DOES THIS UNIT HAVE OUTSTANDING NODE??
	SZA		/IF NO, SKIP TO JOIN EEL LOOP
	JMS	GIVE	/WE ALREADY DQ'D THIS NODE, BUT INTERRUPT
/			/NEVER HAPPENED, GO DO CLEAN UP
EEL	LAC	ZOT	/LOOP TO GIVE BACK ALL NODES
	DAC*	(R1	/SET UP FOR CALL TO PICK
	JMS*	(PICK	/GET ANOTHER NODE FOR THIS DEVICE
	JMP	ELL	/NO MORE, MOVE TO NEXT DEVICE
	JMS	GIVE	/TELL WAITING NODE -24, WE'RE GONE!
	JMP	EEL	/GET NEXT NODE FOR DEVICE
/
FAKER	LAC	(IOCDS-1 /LOOP TO DECREMENT ALL
/			/IOCD'S WE HAVE EXTRA INCREMENTED
	DAC	UNITXR	/USE HIM AS POINTER AGAIN
FAKL	ISZ	UNITXR	/GET NEXT ONE
	LAC*	UNITXR	
	SPA		/SKIP IF EMPTY OR REAL
	JMP	EXIT	/MINUS IS END. (IOCD ADDR'S <32K)
	JMS	VTIOCD	/OUR COUNTDOWN ROUTINE. SEND ADDR IN AC!
/			/IT IGNORES ZERO 'ADDRESS'
	JMP	FAKL	/GO GET MORE
/
EXIT	DBK		/KICK DOWN FROM LEVEL 5 TO 7
DISC	ISZ	VTCON	/CONVERT CONNECT CODE TO DISCONNECT
	CAL	VTCON	/AND DISCONNECT VT FROM API TRAP
	CAL	(10)	/EXIT
/
/	ABORT CODE
/
/
ABORT	XOR	VTEV	/CLEAR OUT ABORT BIT
	DAC	VTEV	/AND REPLACE
	.ENB		/ENABLE INTERRUPTS AGAIN
	CLX		/SET UP TO LOOK FOR FIRST DEVICE
ALL	AXR	1	/MOVE TO NEXT
	LAC	VTTAB-1,X  /GET NEXT UNIT #
	SNA		/SKIP IF REAL ONE
	JMP	ALL	/NOPE, GO CHECK NEXT ONE
	DAC*	(R1	/SET UP TO DEQUEUE ABORT NODE
	JMS*	(DQRQ	/CALL MONITOR ROUTINE TO DO IT
	JMP	WAITR	/IF WE COME HERE, THIS IS BAD. SHOULD ????
	DAC	ZOT	/SAVE ADDR OF ABT NODE
	TAD	NEGPAG	/ADJUST FOR PRESENT PAGE LOCATION
	PAX		/SO WE CAN ACCESS ABORT NODE
	LAC	5,X	/CHECK REQUEST TYPE
	SAD	(17	/ABORT FOR LUN 0!
	SKP		/CHECKS OUT
	JMP	VTUNIM	/CALL IT AN UMINPLIMENTED CALL ERROR
	LAC	3,X	/GET NODE ADDR FOR PARTITION TABLE
	TAD	NEGPAG	/CORRECT FOR PAGE. GOING TO GET LIMITS
	PAX		/FOR PARTITION SO WE CAN KEEP VT-15
/			/FROM EXECUTING THERE
	LAC	4,X	/PARTITION BASE ADDR
	CMA!IAC		/NEGATIVE FOR TESTING
	DAC	ZOT1	/TEMPORARY
	LAC	5,X	/PARTITION SIZE
	CMA!IAC		/NEGATIVE FOR TESTING
	DAC	ZOT2	/AGAIN TO HOLD IT
	LAW	-4	/UNITXR WILL GO -4 TO 0, WHILE XR 0-3
	DAC	UNITXR
ALL1	LAC	UNITXR	/GET UNIT XR LOOP CONTROL
	AAC	4	/CONVERT TO XR
	PAX		/AND PUT THERE
	LAC	CNTAB,X /CONTROL TABLE ADDR IN PART. (ZEROED ON
/			/COMPLETION OF REQUEST
	JMS	LIMCK	/GO TO SUBROUTINE TO CHECK ADDR IN AC. ADDR
/
/  DESTROYED. A SKIP RETURN IF ADDR IN PARTITION DEFINED BY
/  THE QUANTITIES IN ZOT1 AND ZOT2. (-START, AND -SIZE RESP.)
/
	JMP	ALL2	/GO CHECK NEXT TABLE
	DZM	VT0W,X	/CLEAR INTERRUPT LOCATION TO LET ONE IN
	DZM	POST0,X	/AND CLEAR FLAG, SAYING ONE COMING
	DZM	CNTAB,X	/AND OTHER FLAG SAYING ONE COMING
	LAC	DUMYS,X /IN CASE THIS REQUEST HAPPENED TO 
	DAC	TRCK0,X /BE TRACKING, WIPE OUT THE LINKAGE
	LAC	LPSS,X	/GET ADDR OF LIGHT PEN ENABLE SWITCH
	DAC	ZOT3	/ADDRESS DOWN
	DZM*	ZOT3	/SO WE CAN KILL FLAG AT THE ADDRESS
	LAC	RWNOD,X /GET NODE ADDR FOR ONE WE DQ'D EARLIER
	DZM	RWNOD,X /AND CLEAR OUT ENTRY FROM OUR TABLE
	JMS	GIVE	/SET EV, DO IOCD, RETURN NODE
	LAC	UNITXR	/RESTORE XR FOR ADDITIONAL TESTS
	AAC	4	/MAKE RANGE 0-3
	PAX		/TO XR
ALL2	LAC	SELF0,X	/CHECK ON 'MAIN' FILES IN PARTITION
	JMS	LIMCK	/AGAIN IS THIS LINKAGE IN ABORTED PARTITION?
	JMP	ALL3	/NO, CHECK NEXT
	LAC	DUMYS,X	/GET DUMMY LOOP TO REPLACE OLD ONE
	DAC	SELF0,X	/NOW MAIN LOOP NO LONGER CALLS PARTITION.
	LAC	IOCDS,X /GET ADDR OF COUNTDOWN WE'VE BUMPED
	DZM	IOCDS,X /AND KILL ENTRY SINCE ITS ABOUT TO BE DONE
	JMS	VTIOCD	/AND CORRECT IT
ALL3	LAC	BOTH0,X	/CHECK FOR COMMON LOOPS IN PARTITION
	JMS	LIMCK	/SAME AGAIN HERE. IS VT-15 GOING FROM LOOP
	JMP	ALL4	/PARTITION. MUST STOP IT.
	LAC	DUMYS,X
	DAC	BOTH0,X
	LAC	IOCDB,X /ADDR OF COUNTDOWN WE'VE BUMPED
	DZM	IOCDB,X /KILL SAVED ADDRESS, SO WE DON'T DO IT AGAIN!
	JMS	VTIOCD	/AND DECREMENT BACK
ALL4	LAC	STAD0,X	/ADDR OF START TYPE OF PUT, IF ANY
	JMS	LIMCK	/THIS PARTITION?
	JMP	ALL4E	/NOPE
	DZM	STAD0,X	/ZERO THE ENTRY
	LAC	IOCDX,X /NOW TO DECREMENT IOCD FOR PARTITION FOR START
	DZM	IOCDX,X /AS BEFORE
	JMS	VTIOCD
ALL4E	ISZ	UNITXR	/UP TO 0 YET
	JMP	ALL1	/GO CHECK NEXT ENTRY IN ALL TABLES
	CLX		/XR POINT TO FIRST VT-15
	JMS	RETOP	/RESTART TUBE IN HANDLER LOOP SO OUT OF
/			/PARTITION TO BE ABORTED
	JMS	ALLOFF	/BUT STOP TUBE IF NO USEFUL LINKS FROM HANDLER
/			/LOOP TO USER. ALL THIS SEEMS LIKE IT COULD HAVE
/			/BEEN ARRANGED BETTER, BUT, OH WELL.
	AXR	2	/NOW POINT TO THE SECOND TUBE
	JMS	RETOP	/SAME AS BEFORE
	JMS	ALLOFF
	LAC	(VTTAB-1 /TO SCAN ALL PHYSICAL DEVICES.
	DAC	UNITXR	/MAY AS WELL KEEP USING THIS LOCATIONS
DQLP	ISZ	UNITXR	/MOVE TO NEXT DEVICE
	LAC*	UNITXR	/AND GET ITS NODE IF ANY.
	SPA		/SKIP IF REAL OR EMPTY
	JMP	DQLAS	/ON MINUS, DONE WITH THIS, GO TO NEXT
	SNA		/SKIP ON REAL
	JMP	DQLP	/EMPTY SLOT, GO BACK TO LOOP
	DAC*	(R1	/INTO SYSTEM REG. FOR DMTQ
	LAC	ZOT	/REMEMBER ADDRESS OF ABORT NODE IN HERE
	DAC*	(R2	/INTO SYSTEM REG
	JMS*	(DMTQ	/REMOVE ALL QUEUED I/O FROM PARTITION FOR DEVICE
	JMP	DQLP	/BACK TO LOOP FOR MORE
DQLAS	CLA!IAC		/NOW TO RETURN NODE OF ABORT REQUEST
	DAC	GIVEEV	/1 FOR EVENT VARAIBLE OF ABORTER
	LAC	ZOT	/HERE IS SAVED ADDRESS OF NODE
	JMS	GIVE	/THIS GUY DOES WORK FOR US.
	JMP	WAITR	/??GUESS HAVE TO GO BACK TO LOOP TOP TO LOOK
/			/FOR OTHER WORK TO DO.
/
/	LIMCK IS A ROUTINE TO CHECK WHETHER THE ADDR IN AC IS 
/ IN THE PARTITION DEFINED BY THE QUANTITIES IN ZOT1 AND ZOT2.
/  ZOT1 HAS MINUS THE STARTING ADDR, AND ZOT2 MINUS THE SIZE. THE
/ AC IS DESTROYED BY THE ROUTINE. A SKIP EXIT INDICATES THE ADDR
/ IS IN THE PARTITION.
/
LIMCK	0
	TAD	ZOT1	/SEE IF ADDR TOO SMALL
	SPA		/SKIP IF NOT
	JMP*	LIMCK	/ADDR TOO SMALL, REGULAR EXIT
	TAD	ZOT2	/SEE IF TOO BIG
	SPA		/SKIP IF TOO BIG TO REGULAR EXIT
	ISZ	LIMCK	/AHA! GOT ONE! INCREMENT TO SKIP RETURN
	JMP*	LIMCK	/BYE.
/
/	ROUTINE TO CONVERT RELOCATED ADDR'S TO REAL ONES
/	XR IS RESTORED FROM UNITXR UPON EXIT.
/
REAL	0
	DAC*	(R3	/ADDR IN AC AT CALL TIME
	LAC	RWNOD,X	/REQUEST NODE. THESE GOING TO ARBITRARY LOC'S
	DAC*	(R2	/FOR ARGUMENT PASSING IN SYSTEM
	LAC	(10	/ASSUME THIS MAX TABLE SIZE!?!?!?
	DAC*	(R4	/
	JMS*	(VJAX	/ROUTINE PUTS REAL ADDR IN R3
	JMP	REALRR	/ERROR EXIT, SET UP CODE IN AC
	LAC	UNITXR	/RESOTRE UNIT # INTO XR
	PAX
	LAC*	(R3	/GET REAL ADDR TO PASS BACK TO CALLER
	JMP*	REAL
REALRR	LAW	-30	/ERROR CODE FOR VJAX
	JMP	ERRREQ	/GO SEND IT TO CALLER
/
/	ALLOFF IS ENTERED WITH XR 0 OR 2. IF ALL SUBROUTINE CALLS
/  FOR THAT VT-15 LOOP ARE TO THE DUMMY ROUTINE, THE VT-15 IS STOPPED.
/ #####?????THIS DOES BAD THINGS TO START TYPE OF PUT.
/
ALLOFF	0
	CLL		/SO WE LATER KNOW IF WE CARRY INTO HERE.
	LAC	SELF0,X	/ADD TOGETHER FOUR. DIVIDE BY 2. ADD 2.
/			/THE DIVIDE BY FOUR==SIX SAD'S
	TAD	SELF1,X	/OTHER 'MAIN' FILE FOR OTHER TUBE.
	TAD	TRCK0,X	/TRACKING FOR 0(2)
	TAD	TRCK1,X	/TRACKING FOR 1(3)
	SZL!SPA!CLL!RAR	/DIVIDE BY 2.IF EITHER TOP BIT ON, WE IN
	JMP*	ALLOFF	/DANGER OF 32K WRAP, SO EXIT
	TAD	BOTH0,X	/(COMMON FILE FOR 0(2)
	TAD	BOTH1,X	/COMMON FILE FO 1(3)
	RTR		/DIVIDE BY FOUR FOR ORIGINAL
	SAD	DUMYS,X	/COMPARE TO DUMMY FOR THIS VT-15
	JMS	CLEAN	/STOP PROCESSOR, TURN OFF ALL INTERRUPTS
	JMP*	ALLOFF	/THAT'S ALL
/
RETOP	0		/CALL WITH XR 0 OR 2. RESTARTS VT
/			/AT TOP OF HANDLER LOOP
	XCT	XSTOP,X	/STOP IT WHERE IT IS
	LAC	SIC0,X	/GET SIC WORD FOR THIS TUBE
	XCT	XSIC,X	/SET INTIAL CONDITIONS IOT
	LAC	INITD,X	/LOOP START FOR THIS TUBE
	XCT	XSTRT,X	/AND START UP TUBE IOT
	JMP*	RETOP
/
/	THE CLEAN ROUTINE STOPS VT, STARTS IT TO CLEAR FLAGS
/	THE VT THEN HITS A STOP, WE THEN CLEAR OTHER FLAGS
/
CLEAN	0
	DZM	VT0W,X	/TELL INTERRUPT ROUTINE, TAKE NO
	DZM	VT1W,X	/WOODEN NICKELS FROM THIS SCOPE
	XCT	XSTOP,X	/STOP VT-15
	LAC	(17400	/SIC SO WE CAN RESTART IN EXIT CODE
	XCT	XSIC,X	/EXECUTE SIC, NO-OP IF SCOPE MISSING
	LAC	(RETIRE	/ADDR OF BEGINNING OF SCOPE EXIT CODE
	XCT	XSTRT,X	/START SCOPE
	ALSS	6	/RANDOM XTRA INSTRUCTION TO GIVE SCOPE TIME
	LAC	(17400	/CLEAR INTERNAL STOP FLAG
	XCT	XSIC,X	/TIME TO HALT BEFORE FLAG CLEARED
	JMP*	CLEAN	/WHEW!
/
/
VTIOCD	0		/CALL WITH ADDR OF IOCD WORD IN
/			/PARTITION BLOCK IN AC.
	DAC	ZOT3	/SUPER TERMPORARY. WE CAN'T USE XR, ATUO!!
	SNA!SPA!CLA!CMA	/THIS ADDR HAS TO POSITIVE AND >0 TO BE
/			/ANY GOOD! -1 TO DECREMENT COUNT.
	JMP*	VTIOCD	/ADDR. A PHONEY, JUST EXIT.
	.INH		/PLEASE NO INTERRUPTS NOW
	TAD*	ZOT3	/ADD IT IN. PARTITION BLOCK <32K
	SMA		/IF NEG, LEAVE ALONE
	DAC*	ZOT3	/REPLACE IT
	.ENB		/ALLOW INTERRUPTS AGAIN
	JMP*	VTIOCD
/
/
/ THE ENTER ROUTINE IS CALLED BY PUT'S OF SELF, BOTH, AND START TYPE
/   THE CORRESPONDING IOCD TABLE (IOCDS,X FOR SELF; IOCDB,X FOR BOTH;
/  IOCDX,X FOR START) IS LOADED TO AC (CONTENTS OF TABLE THAT IS)
/  ENTER RETURNS WITH CONTENTS OF IOCADD IN AC, SO CALLER THEN
/  DOES A DAC INTO SAME IOCD TABLE.
/
ENTER	0
	SAD	IOCADD	/IF SAME PARTITION AS LAST ONE
	JMP*	ENTER	/TAKE NO ACTION AT ALL
	JMS	VTIOCD	/IF LAST DIFFERENT, COUNT IT DOWN
	LAC	IOCADD	/LOAD AC FOR CALLER CONVENIENCE
	SZA!SMA		/COUNT-UP ONLY IF ADDR + AND >0.
	ISZ*	IOCADD	/AND COUNT UP SO THAT WHEN PARTITION ABORTS
/			/WE WILL GET CALLED SO WE CAN GET VT-15 OUT
/			/OF THE PARTITION!!!
	JMP*	ENTER
/
/  THE CLOSE ROUTINE IS CALLED A DETACH SELF OR DETACH BOTH
/ TYPE OF PUT IS ISSUED.  IF WE DON'T THINK THAT THE CALLING
/ PARTITION HAS SUCH A REQUEST OUTSTANDING (IOCADD NOT= TO
/ THE PROVIDED IOCDS,X OR IOCDB,X IN AC) WE ISSUE A NON-SKIP
/ RETURN, AND THE CALLER TAKES NO ACTION. IF THERE IS SUCH A
/ REQUEST, WE CALL VTIOCD TO COUNT DOWN OUR FAKE XTRA COUNT, AND
/ GENERATE A SKIP RETURN FROM THE SUBROUTINE.
/
CLOSE	0
	SAD	IOCADD	/DOES THIS USER HAVE RIGHT TO DO THIS
	SKP		/YES, CONTINUE
	JMP*	CLOSE	/NO, JUST EXIT!
	JMS	VTIOCD	/AC STILL HAS WHAT VTIOCD WANTS
	ISZ	CLOSE	/MAKE A SKIP RETURN FOR CALLER
	JMP*	CLOSE	/THAT'S IT
/
/	GIVE IS A SUBROUTINE TO DO CLEANUP FOR THE NODE WHOSE
/ ADDRESS IS PROVIDED IN AC.  THE QUANTITY IN GIVEEV IS PLACED
/ IN USER EV (IF ONE) AND AN EVENT DECLARED (IF EV). IOCD (HTE
/ SYSTEM ONE, THAT IS) IS DONE FOR NODE, AND NODE IS RETURNED TO
/ POOL. ROUTINE CLOBBERS AC AND XR!!
/
GIVEEV	0		/ARGUMENT PLACED HERE BY CALLER
GIVE	0
	DAC*	(R2	/NODE ADDR IN AC TO SYSTEM REG. FOR IOCD & NADD
	TAD	NEGPAG	/PAGE CORRECTION SO WE CAN GET
	PAX		/USER EV, USING XR
	LAC	6,X	/ADDR OF EV.
	SNA		/SKIP IF REALLY ONE
	JMP	GIVE1	/WASN'T SKIP OVER SOME WORK
	TAD	NEGPAG	/AGAIN PAGE CORRECTION SO WE CAN 0,X
	PAX
	LAC	GIVEEV	/HERE'S CONTENTS TO GIVE HIM
	DAC	0,X	/THERE THEY GOOOOOOOOO
	LAC	(401000	/DECLARE A SIGNIFICANT EVENT
	ISA
GIVE1	LAC	(POOL	/SAY TO PLACE NODE IN POOL
	DAC*	(R1	/IN SYSTEM REG.
	JMS*	(IOCD	/COUNT DOWN THIS REQUEST
	JMS*	(NADD	/AND GIVE BACK THE NODE
	JMP*	GIVE	/DONE
/
/
/
/		ATTACH AND DETACH SAME CODE
/	LINK=1 FOR DETACH AND 0 FOR ATTACH ON ENTRY
/
ATTACH	LAC	VTTAB,X	/GET ADDRESS OF PDVL NODE
	DAC*	(R1	/TO SYSTEM ARGUMENT ACCEPTOR
	LAC	RWNOD,X	/GET ADDRESS OF REQUEST NODE
	DAC*	(R2	/TO ARGUMENT ACCEPTOR
	CLA!RAL		/GET LINK INTO XR
	PAX		/SO WE CAN
	XCT	ATDT,X	/CORRECT CALL TO SYSTEM
	JMP	ERRREQ	/ERROR EXIT, AC CONTENT TO GO TO USER
	JMP	FINREQ	/OK EXIT, +1 TO BE SENT TO USER VARIABLE
ATDT	JMS*	(ALAD	/ATTACH ROUTINE
	JMS*	(DLAD	/DETACH ROUTINE
/
HINF	PXA		/UNIT # PRESENTLY IN XR, GET IT
	ALSS	6	/SHIFT LEFT 6 TO FILED POSITION. AC0=0, SO
/			/0'S WILL MOVE IN AT BOTTOM OF WORD
	AAC	VTINFO	/GET REST OF BITS TO SEND BACK
	JMP	ERRREQ	/USE MECHANISM OF ERROR RETURN.
/
/		GET AND PUT COMMON CODING TO START
/
GORP	LAC*	10	/MOVE AUTO INCR TO CONTROL TABLE ADDR
	LAC*	10	/ NODE+7
	JMS	REAL	/CALL ROUTINE TO GIVE US BACK REAL ADDR.
/			/NOT THE USER'S RELATIVE ONE
	DAC	CNTAB,X	/SAVE(REAL KEPT XR OK)CNTAB USED LATER
/			/BY GET FOR BUFFER ADDR INSTEAD.
	AAC	-1	/ADDR-1 SO WE CAN AUTO INCR TO CONTENTS
	DAC*	(10	/USE OF 10 ARBITRARY
	LAC	ZOT	/REESTABLSISH LINK 1 FOR PUT, 0 FOR GET
	RAR		/SINCE ZOT HAD 30 TO GET, 31 FOR PUT
	LAC*	10	/TYPE CODE FOR GET OR PUT
	DAC	ZOT1	/GET NEEDS IT LATER
	SPA		/HAS TO BE POSITIVE
	JMP	VTUNIM	/IF NOT UNIMPLEMENTED CODE ERROR
	SNL		/PUT SKIPS TO ITS CODE
	JMP	GET	/AND GET JUMPS OFF TO ITS
/		PUT HANDLER
/
	AAC	-10	/HIGHST LEGAL FUNCTION 7
	SMA		/SKIP IF LEGAL
	JMP	VTUNIM	/CODE TOO LARGE, AGAIN ERROR
	TAD	(JMP VTDISP+10) /MAKE INSTRUCTION FOR TABLE DISPATCH
	DAC	.+1	/AND PUT THE INSTRUCTION DOWN TO EXECUTE
	HLT		/THIS LOCATION FILLED BY THE INSTRUCTION
VTDISP	JMP	STOPIT	/STOP DISPLAY CODE
	JMP	RSUMIT	/RESUME DISPLAY CODE
	JMP	LINKS	/LINK SELF-ONLY DISPLAY FILE TO VT-15
	JMP	LINKB	/LINK BOTH SCOPE DISPLAY FILE
	JMP	DECHS	/TAKE AWAY SELF-ONLY FILE FROM EXECUTION
	JMP	DECHB	/SAME FOR BOTH SCOPE DISPLAY FILE
	JMP	SICIT	/CAL TO LET USER PROVIDE SIC WORD
STRTIT	LAC	IOCDX,X /GET PREVIOUS START, IF ANY
	JMS	ENTER	/THIS DOES COUNT FUDGING
	DAC	IOCDX,X /PLACE OUR START POINTER
	XCT	XSTOP,X /HALT VT-15 SO WE CAN GRAB IT.
	LAC	SIC0,X	/GET WHO'S EVER SIC
	XCT	XSIC,X	/ISSUE SIC IOT
	LAC*	10	/GET USER'S OWN DISPLAY FILE ADDR
	JMS	REAL	/CONVERT TO ABSOLUTE ADDR
	DAC	STAD0,X /PLACE ABS ADDR AS MARKER WHICH PARTITION
/			/WE IN FOR START ON THIS TUBE#.
	JMP	LINKEX	/FINISH UP WITH LINKSB
SICIT	LAC*	10	/LET USER SET SIC WORD. GET THE WORD
	DAC	SIC0,X	/LIST OF WORDS IS SAVED HERE
	JMP	FINREQ	/COMMON FINISH UP CODE FOR USER CAL TO US
STOPIT	XCT	XSTOP,X	/EXECUTE CORRECT IOT FROM LIST TO STOP VT-15
	JMP	FINREQ	/THAT'S ALL THERE IS TO DO
RSUMIT	LAC	SIC0,X	/GET SAVED SIC WORD (EITHER USER OR US)
	XCT	XSTOP,X	/STOP IT IF NOT ALREADY STOPPED (SHOULD BE)
	XCT	XSIC,X	/EXECUTE PROPER IOT FROM TABLE
	XCT	XRSUM,X	/AND SAME FOR THE RESUME IOT
	JMP	FINREQ
LINKS	LAC	IOCDS,X /GET PREVIOUS LINK SELF PARTITION
/			/IOCD POINTER
	JMS	ENTER	/AND CALL GUY TO DO ALL THE WORK
	DAC	IOCDS,X /AND PLACE OUR CORRESPONDING POINTER
	LAC*	10	/GET DISPLAY FILE ADDR FROM CONTRL TABLE
	JMS	REAL	/CONVERT TO REAL ADDR FOR VT-15 PROCESSOR
	DAC	SELF0,X	/ADDRESS IF REFERENCED INDIRECT BY VT-15 LOOP
/			/THE FOUR ADDRESSES SELF0-SELF3 IN STACK FOR
/			/CONVENIENCE.
LINKSB	XCT	XSTOP,X /STOP IN CASE GOING
	LAC	SIC0,X	/COMMON FOR STARTUP SELF OR BOTH
	XCT	XSIC,X	/SET INITIAL CONDITIONS
	LAC	INITD,X /STARTING ADDR OF LOOP0 OR LOOP2
LINKEX	XCT	XSTRT,X	/TABLE OF IOT'S TO START UP THE TUBE.
	JMP	FINREQ
LINKB	LAC	IOCDB,X /LINK A FILE FOR BOTH TUBES
	JMS	ENTER	/SETUP LIKE LINK TO SELF TUBE
	DAC	IOCDB,X
	LAC*	10	/AND AGAIN THE DISPLAY FILE ADDR
	JMS	REAL	/CONVERT TO REAL ADDR FOR VT-15 PROCESSOR
	DAC	BOTH0,X	/AND AGAIN A STACK OF ADDRESSES
	JMP	LINKSB	/COMMON FINISH-UP WITH THE LINK SELF CODE
/
DECHS	LAC	IOCDS,X /GET POINTER TO IOCD ADDR
	JMS	CLOSE	/CLEAR OUR FUDGED IOCD, IF WE ARE RIGHT PARTITION
	JMP	FINREQ	/NON-SKIP IF WRONG, EXIT WITH NO ACTION
	DZM	IOCDS,X	/CLOSE DID IT, SO CLEAR POINTER TO IOCD WORD
	LAC	DUMYS,X	/RIGHT PARTITION, KILL OFF LINKAGE
	DAC	SELF0,X	/AND REPLACE IT
DECHSB	XCT	ANDXR2,X /AGAIN MAKE XR 0 OR 2 (0 OR 1 GO TO 0, ETC.)
	JMS	RETOP	/RESTART AT LOOP TOP TO ENSURE VT-15
/			/NOT LOST IN PARTITION!
	JMS	ALLOFF	/SUBROUTINE TO KILL VT-15 IF ALL LINKS OFF
	JMP	FINREQ
/
DECHB	LAC	IOCDB,X /ARE WE THE RIGHT PATITION
	JMS	CLOSE	/SKIP IF YES
	JMP	FINREQ	/NO, TAKE NO ACTION
	DZM	IOCDB,X /CLEAR OUT PARTITION BLOCK IOCD WORD POINTER
	LAC	DUMYS,X	/YES, KILL LINKAGE TO BOTH TUBE FILE.
	DAC	BOTH0,X	/BANG!
	JMP	DECHSB	/FINISH UP IN COMMON WITH SELF-VIEW KILL.
/			/BASIC GAME, TURN OFF VT-15 IF NOTHING TO BE
/			/SHOWN, BECAUSE IT EATS CYCLES.
/
/		GET HANDLER
/
GET	AAC	-13	/12 IS HIGHEST LEGAL FUNCTION
	SMA!CLL		/SKIP IF LEGAL, CLEAR LINK FOR ALL
	JMP	VTUNIM	/NUMBER TOO BIG, IS ILLEGAL FUNCTION
	LAC*	10	/GET BUFFER ADDR
	PAL		/THIS IS NON-REAL ADDR, HOLD,,
	LAC*	10	/WHILE WE FINISH WITH AUTO-
/			/INCR. BEFORE KILLING IT 
	DAC	XTRA,X	/THIRD ARGUMENT FROM CONTROL TABL
	PLA		/GET BACK THE FAKE ADDR
	JMS	REAL	/THIS GUY MAKES IT REAL ADDR,
/			/RESTORES XR, KILLS AUTO-INCR
	AAC	-1	/MAKE ADDR -1 FOR AUTO INCR.
	DAC*	(11	/INTO AUTO-INCR 11 FOR NOW
	DAC	CNTAB,X	/PLACE USER BUFFER ADDR IN CNTAB. WORKS JUST
/			/AS WELL AS CONTROL TABLE AS PARTITION FLAG.
	LAC	ZOT1	/GET BACK TYPE TO SEPARATE TO RIGHT CODE
	SNA!CLL		/IF ZERO, GO READ REG'S NOW
	JMP	DONOW	/
	SAD	(12	/IS SPECIAL FUNCTION TO GET LIGHT PEN
	JMP	GETLTP	/SUBROUTINE ADDR FOR MACRO PROGRAMS?
	SAD	(11	/IF 11 GO SET UP DRAW (TRACK WITH PATH DISPLAY)
	JMP	VTUNIM	/DRAW NOT IMPLEMENTED.
	SAD	(10	/IF 10 GO SET UP LIGHT PEN TRACKING
	JMP	STRACK
	SAD	(7	/GO TO SPECIAL FUNCTION (GENERALIZED GET)IF 7
	JMP	GENER
	SAD	(6	/IF 6, GO TO LTORPB, SPECIAL FOTRAN FUNCTION
	JMP	LTORPB	/GO THERE EVEN
SNGLE	CMA!CLL!CML	/ALL OTHERS A SINGLE INTERRUPT REQUEST
	TAD	(ALS 6	/MAKE BITS SHIFT INSTRUCTION FROM TYPE CODE
/			/NOTE FIRST TWO OP'S LEAVE ZERO LINK
	DAC	.+2	/PUT DOWN FOR EXECUTION
	LAC	(20000	/HERE IS BIT TO END UP IN AC TO SHOW WHICH INT.
	HLT		/THIS WRITTEN OVER BY THE DAC   .+2
	TAD	(17700	/THESE BITS SAY T READ ALL REGISTERS
	DAC	XTRA,X	/PRETEND USER GAVE THIS GENERALIZED GET
	JMP	GENER	/AND DO IT AS SUCH
/
GETLTP	LAW	-1	/SINCE LPSS RETURN SWITCH ADDR
/			/NOT ADDR OF ENTRY POINT
	TAD	LPSS,X	/HERE IS ADDR FOR USER
	DAC*	11	/INTO HIS BUFFER
	JMP	FINREQ	/THAT'S ALL TO DO
/
DONOW	LAC	(17700	/DESCRIPTOR WORD TO LOOK LIKE OTHER GET'S
	DAC	XTRA,X	/WHICH HAVE BIT PATTERNS HERE.
DOGEN0	XCT	XSTOP,X	/STOP VT-15.ENTRY GENERAL GET RIGHT NOW
	PXA		/GET INDEX TO SAY WHICH IOT'S TO EXECUTE
	RTR		/LINK 0 FOR VT0, 1 FOR VT2.
	LAC	(XPC-1	/ADDR-1 OF READ PC IOT SCOPE 0 INTERRUPT CODE
	SZL		/SKIP IF SCOPE 0
	TAD	(RD25-RD05 /SCOPE 2, ADJUST POINTER TO SCOPE 2 CODE
	DAC*	(16	/INTO AUTO INCR #16
	AAC	RD035-XPC /POINTER TO READ STATUS 2 IOT
	DAC*	(17	/INTO AUTO INCR #17
	XCT*	16	/READ PC FOR CORRECT SCOPE
	DAC	PC0,X	/PLACE IN LOCATION AS IF INTERRUPT CODE READ IT
	ISZ*	(16	/MOVE POINTER TO READ STATUS 1 IOT
	XCT*	16	/READ STATUS 1 IOT
	DAC	RS10,X	/FAKE INTERRUPT READ SO WE CAN FINISH AT GENCOM
	XCT*	17	/READ STATUS 2 IOT
	DAC	RS20,X
	ISZ*	(17	/MOVE POINTER TO READ X
	XCT*	17
	DAC	X0,X
	ISZ*	(17
	XCT*	17
	DAC	Y0,X	/THERE ARE ALL FIVE READS
	XCT	XRSUM,X	/RESUME THE VT-15
	LAC	XTRA,X	/GET BACK BITS FOR WHICH REG'S TO USER
	JMP	GENCOM	/AND FINISH UP WITH GENERALIZE GET AS IF
/			/INTERRUPT  OCCURED . AC NOW SAYS WHICH
/			/DATA TO RETURN
/
STRACK	LAC	LTRX,X	/GET ADDR-1 OF SET POINTS IN TRACKING SYMBOL
	DAC*	(12	/TEMPORARILY FOR NOW TO AUTO #12
	LAC*	11	/GET X POSITION FROM USER BUFFER
	AND	(1777	/TRUNCATE TO SCREEN SIZE
	XOR	(PX	/PUT IN OP CODE FOR PPOINT
	DAC*	12	/INTO PLACE
	LAC*	11	/SAME THING FOR Y POSITIONING
	AND	(1777
	XOR	(PY!INT	/EXCEPT THAT THE FINAL POINT IS INTENSIFIED
	DAC*	12
	LAC	ASW,X	/GET ADDR OF JUMP TO TRACKING IN INTERRUPT
	DAC	ZOT	/USE TEMPORARY BECAUSE POST-INDEXING WRONG HERE
	LAC	TRCKS,X	/GET JMP TO TRACKING ROUTINE
	DAC*	ZOT	/INTO PLACE IN INTERRUPT HANDLER
	LAC	(JMP TRKCON	/GET POINTER TO THIS ROUTINE WHEN DONE
/			/WITH INTERRUPT LEVEL, AND COME BACK
	DAC	HOLD,X	/INTO A STACK BY UNIT # AS USUAL
	LAC	DTRCK,X	/GET ADDR OF TRACKING ROUTINE THIS UNIT
	DAC	TRCK0,X	/AND PLACE FOR DJMSI IN MAIN VT-15 LOOP
	CLL		/ZERO LINK SAYS NOT TO ENABLE LIGHT PEN
	JMP	LTCOM	/REST OF PROCESSING IN COMMON WITH LTORPB
/ ######WARNING MAY NOT WORK WHEN HALIO FIXES BITS
/
/		HERE WE COME WHEN DONE WITH INTERRUPT
/
TRKCON	LAC	DUMYS,X	/REPLACE ADDR OF TRACKING WITH A DUMMY TO
	DAC	TRCK0,X	/TURN OFF THE TRACKING SYMBOL
	LAC	LTRX,X	/GET ADDR OF X AND Y POINT
	DAC*	(12	/USE AUTON CR #12 AGAIN
	LAC*	12	/GET FINAL X POSITION
	AND	(1777	/GET RID OF OP CODE FOR VT-15 POINT INSTRUCT.
	DAC*	11	/TO THE USER
	LAC*	12	/SAME FOR FINAL Y POSITION
	AND	(1777	/
	DAC*	11	/THAT'S ALL THAT IS REQUIRED
	JMP	FINREQ	/CAL IS FINISHED ONLY NOW, GO RELEASE
/
/	SPECIAL FORTRAN FUNCTION, LIGHT PEN OR PUSH BUTTONS
/
LTORPB	LAC	ASW,X	/GET ADDRESS FOR SWITCH IN INTERRUPT HANDLER
	DAC	ZOT	/TO GO INDIRECT THRU A TEMPORARY
	LAC	TORPS,X	/GET JUMP TO CORRECT HANDLER
	DAC*	ZOT	/INTO (CODE MODIFIED) INTERRUPT HANDLER
	LAC	(JMP TRPCON	/ADDRESS WHERE TO GO ON INTERRUPT EXIT
	DAC	HOLD,X	/INTO STACK BY UNIT #, SINCE ALL MAY HAPPEN
	CLL!CML		/TO TURN ON THE LIGHT PEN
LTCOM	LAC	LBIT,X	/GET BITS FOR RS3, TOP AND BOTTOM OF WORD
	TAD	PBIT,X	/ADD IN SIMILAR BITS FOR PUSH BUTTONS
	AND	(777	/KILL OFF BITSIN TOP OF WORD
RELCOM	DAC	POST0,X	/SHOW WE WNAT INTERRUPT
	LAC	LPSS,X	/GET ADDR OF LIGHT PEN ENABLE SWITCH
	DAC	ZOT	/SAVE FOR INDIRECT PLACEMENT
	LAC	(210014	/GET INSTRUCTION TO TURN IT ON
	SZL		/SKIP IF WE DON'T WANT IT
	DAC*	ZOT	/PUT IT IN PLACE
	LAC	POST0,X	/GET BACK MASK TO ENABLE INTERRUPT
/			/LEVEL CODE
	DAC	VT0W,X	/AND PLACE IT
	JMP	VTNXT	//GO SCAN FOR MORE WORK TO DO
/
TRPCON	LAC	RS30,X	/GET WHICH INTERRUPT INFO
	JMS	PFLIP	/UBROUTINE TO FLIP PB BIT FROM RIGHT TO
/			/LEFT OR VICE VERSA
	JMS	LFLIP	/SAME FOR THE PUSH BUTTON BIT.
	TAD	(16100	/THESE ARE BITS TO SHOW WHICH
/			/IOT READS WE HAVE SENT BACK.
	JMP	GENCOM	/FINISH UP IN COMON WITH GENERALIZED GET
/
/	SUBROUTINE TO FLIP PUSH BUTTON BITS FOR WORD IN AC
/		X REGISTER IS ASSUMED SET TO UNIT.
/
FZOT	0		/TEMPORARY FOR FLIPPING ROUTINES
PFLIP	0
	DAC	FZOT	/SAVE AC, IT MUST BE RETURNED
	AND	PBIT,X	/SAVE ONLY THE TWO BITS IN QUESTION
/			/FOR THIS PARTICULAR UNIT
	SZA		/WHEN NO BITS, FALL DOWN SZA CHAIN TO
/			/MERELY RESTORE ORIGINAL WORD
	XOR	PBIT,X	/MAKE AC 0 IF BOTH BITS WERE ON.
	SZA		/IN THIS CASE ALSO DOWN SZA'S TO 
/			/JUST GET BACK ORIGINAL
	LAC	PBIT,X	/TWO BITS WERE DIFFERENT, THIS MASK
/			/WILL FLIP THEM WHEN WE XOR
	XOR	FZOT	/LEAVE ANSWER IN AC FOR CALLER
	JMP*	PFLIP	/YEAH
/
/	SAME THING FOR THE LIGHT PEN BITS
/	EXCPT LINK RETURNED 0 IF NEITHER BIT, 1 IF EITHER (BOTH)
LFLIP	0
	DAC	FZOT
	AND	LBIT,X
	SNA!CLL		/SKIP IF STILL WORK TO DO. DEFAULT LINK 0
	JMP	LFLIPE	/NONE, JUST GO EXIT RESTORING ROIGINAL
	XOR	LBIT,X
	SZA!CLL!CML	/TURN ON LINK WHEN WE GOT SOME BITS
	LAC	LBIT,X
LFLIPE	XOR	FZOT
	JMP*	LFLIP
/
GENER	LAC	ASW,X	/GET ADDR TO PLACE JUMP TO 5 IOT READ
	DAC	ZOT	/PLACE HERE FOR INDIRECT
	LAC	RGRDS,X	/GET JMP TO INTERRUPT SERVICE FOR UNIT #
	DAC*	ZOT	/INTO PLACE IN INTERRUPT HANDLER
	LAC	(JMP GENCON	/WHERE TO GO AFTER INTERRUPT
	DAC	HOLD,X	/TO DISPATCHING TABLE BY UNIT #
	LAW	0	/MASK FOR TOP FIVE INTERRUPT BITS
	AND	XTRA,X	/THIS WORD SAYS WHICH ONES TO RESPOND TO
	SNA		/SKIP IF ANY AT ALL
	JMP	DOGEN0	/OTHERWISE TREAT AS IMMEDIATE READ SO WE
/			/WON'T WAIT FOREVER!
	JMS	PFLIP	/FLIP PUSH BUTTON BIT TO UNIT SELECTIVE
/			/POSITION IN WORD
	JMS	LFLIP	/SAME FOR LIGHT PEN
	JMP	RELCOM	/FINISH UP IN COMMON
/
GENCON	LAC	RS30,X	/GET WORD WHICH SAYS WHICH INT.
/			/WE GOT
	JMS	LFLIP	/MOVE BITS BACK TO ORGINAL SPOTS FOR
/			/BENEFIT OF USER
	JMS	PFLIP	/SAME FOR PUSH BUTTON
	TAD	(17777	/SO COMING AND LEAVES 'WHICH READ' BITS
	AND	XTRA,X	/THIS IS WHAT USER WANTS, WHICH INT'S
/			/AND WHICH IOT READS
GENCOM	DAC*	11	/REMEMBER, THIS SET TO RETURN BUFFER
	LMQ		/HANG "WHICH READ" BITS IN TO MQ FOR RETREIVAL
	LLS	6	/FIRST DECISION BIT TO AC17
	RAR		/AND NOW TO LINK, WHERE SAFE
	LAW	10000	/MASK TO KEEP PUSH BUTTON BITS
	AND	RS20,X	/AND IN SAVE READ STATUS 2
	JMS	HELP	/SEND TO USER IF LINK ON, SET NEXT BIT TO LINK
	LAC	X0,X	/GET X POSITION
	JMS	HELP	/AGAIN, THIS GUY DECIDES WHETHER TO SEND IT
	LAC	Y0,X	/AND Y POSITION
	JMS	HELP
	LAC	PC0,X	/AND SCOPE PC
	JMS	HELP
	LAC	RS10,X	/AND READ STAUTS 1
	JMS	HELP
	LAC	RS20,X	/GET BACK READ STATUS 2
	JMS	HELP	/SEND UNCHANGED?
	AND	(177	/HELP DESTROYS JUST AC0, DON'T NEED TAHT HERE
	JMS	HELP	/LAST CHOICE
	JMP	FINREQ	/FINISH CAL PROCESSING HERE
/
/	SUBROUTINE DOES AN AC TO USER BUFFER VIA AUTO INCR #11 ON
/	NON0 LINK, AND GETS NEXT BIT FROM LMQ 0 TO LINK FOR NEXT TIME
/
HELP	0
	SZL		/ON ZERO LINK NO ACTION
	DAC*	11	/THIS AUTO INCR POINTS TO USER BUFFER
	LLS	1	/MQ0 TO AC17
	RAR		/AC17 TO LINK, WHERE NEXT CALL TO HELP GETS
	JMP*	HELP
/
/	USE INITIALIZATION CODE FOR STORAGE
PC0=VTA
PC1=PC0+1
PC2=PC0+2
PC3=PC0+3
RS10=VTA+4
RS11=RS10+1
RS12=RS10+2
RS13=RS10+3
RS20=VTA+10
RS21=RS20+1
RS22=RS20+2
RS23=RS20+3
X0=VTA+14
X1=X0+1
X2=X0+2
X3=X0+3
Y0=VTA+20
Y1=Y0+1
Y2=Y0+2
Y3=Y0+3
VT0W=VTA+24
VT1W=VTA+25
VT2W=VTA+26
VT3W=VTA+27
POST0=VTA+30
POST1=VTA+31
POST2=VTA+32
POST3=VTA+33
RS30=VTA+34
RS31=RS30+1
RS32=RS30+2
RS33=RS30+3
CNTAB=VTA+40		/GET:RETURN BUFFER POINTER
/			/PUT:CONTROL TABLE ADDR.
/			/BOTH:PARTITION IDENTIFIER
/			/AND:OUTSTANDING OPERATION FLAG
ZOT=VTA+44		/TEMPORARIES FOR CAL LEVEL.
ZOT1=ZOT+1
ZOT2=ZOT+2
ZOT3=ZOT+3	/SUPER TEMPORARY DIRECT DOWN INDIRECT UP
IOCADD=ZOT+4	/TO HOLD ADDR OF IOCD WORD IN PARTITION BLOCK
/
/	INTERRUPT HANDLER
/
/  INTERRUPT TEMPORARIES
/
SAVAC	0		/SAVE INTERRUPTED AC
SAVRS3	0		/HOLD OBTAINED READ STATUS 3
/
/		THIS SECTION IS SPREAD OUT TO SAVE TIME. WITH 4
/	LIGHT PENS RUNNING SIMULTANEOUSLY, MAYBE 1/4 OF THE
/	PDP-15 PROCESSOR WILL BE USED UP.
/
VTINT	0		/API ENTRY. BOTH SCOPES ON SAME LINE
	DBA		/INTO PAGE ADDRESSING IN CASE LAST GUY WASN'T
	DAC	SAVAC	/SAVE THE AC
	.IFDEF	TUBE0
	.IFDEF	TUBE2
	703121		/SKIP ON ANY FLAG FOR PORCESSOR 0. HALIO
/			/ASSURES US THAT EXACTLY 1 PROCESSOR WILL 
/			/INTERRUPT AT ONCE.
	JMP	DO2	/GO DO THE SECON PROCESSOR
	.ENDC
	703152		/READ STATUS 3 TO FIND WHICH INTERRUPT
	DAC	SAVRS3	/WILL NEED IT AGAIN LATER...
	AND	VT0W	/AND WITH MASK OF BITS "WANTED" BY VT0
	SZA!SWHA!CLL	/SKIP WHEN DIDN'T GET RIGHT ONE. SWHA SO
/			/TRACKING ROUTINE CAN GET PUSH BUTTON EASIER
SW0	HLT		/SET UP PUT CORRECT JUMP HERE
	.IFDEF	TUBE1
RET0	LAC	SAVRS3	/BRING BACK ORGINAL TO CHECK SECOND SLAVE
RET01	AND	VT1W	/AND IN ITS BITS
	SZA!SWHA!CLL	/AGAIN SKIP WHEN NONE. CLL'S FOR RET00.
SW1	HLT		/AND HERE AGAIN THE CORECT JUMP AT SETUP TIME
RET1	SAD	SAVRS3	/AC MUST ALREADY BE ZERO. IF FIRST SLAVE DID
/			/A RESUME, SAVRS3 HAS BEEN ZEROED
	JMP	END0	/RESUME DONE, SKIP ALL THIS JAZZ
	.ENDC
RET00	LAC	SIC0	/GET INITIAL CONDITIONS WORD
	703024		/CLEAR INTERRUPTING FLAGS
	LAW	0	/KILL ALL BITS BUT TOP FIVE INTERRUPT ONES
	AND	SAVRS3	/NOW TO FIND OUT WHETHER TO RESTART TUBE
	SPA!SNA!RTL	/SKIP ON NO STOP, AND, SOME BITS
	JMP	END0	/ON STOP, AC MINUS, DON'T RESTART. ON AC 0 THE
/			/FIRST TUBE GOT A TRACKING INTERRUPT AND 
/			/RESUMED THE VT-15!
	SNA!RTL		/SKIP UNLESS PUSH BUTTONS THE ONLY INTERRUPT
	JMP	END0	/YES THEY WERE, DON'T NEED TO RESTART
	SPA		/SKIP ON NO EXTERNAL STOP
	JMP	END0	/ON EXTERNA STOP, DON'T RESTART
	LAC	(LOOP0	/GET STARTING ADDR FOR DISPLAY PROC.
/			/WE WILL RESTART ON LIGHT PEN OR EDGE FLAG, IF 
/			/STOP OR EXTRNAL STOP
	703004		/START IT UP. (AT BEGINNING TO THAT THE LIGHT
/			/ENABLE FLAG  GETS CLEARED
END0	LAC	SAVAC	/GET BACK THE PREVIOUS AC.
	DBR		/RELEASE INTERRUPT
	JMP*	VTINT	/  BYE
/
	.ENDC
/		CODE HERE FOR SECOND VT, SAME AS FOR FIRST.
/
	.IFDEF	TUBE2
DO2	703152+LEN	/READ STATUS 3
	DAC	SAVRS3
	AND	VT2W
	SZA!CLL!SWHA
SW2	HLT
	.IFDEF	TUBE3
RET2	LAC	SAVRS3
RET21	AND	VT3W
	SZA!CLL!SWHA
SW3	HLT
RET3	SAD	SAVRS3
	JMP	END2
	.ENDC
RET20	LAC	SIC2
	703024+LEN
	LAW	0
	AND	SAVRS3
	SPA!SNA!RTL
	JMP	END2
	SNA!RTL
	JMP	END2
	SPA
	JMP	END2
	LAC	(LOOP2	/
	703004+LEN
END2	LAC	SAVAC
	DBR
	JMP*	VTINT
	.ENDC
/
/	INTERRUPT ACTION ROUTINES FOR THE FOUR SCOPES
/
RD05	SWHA		/SWAP BACK THE SWAP DONE FOR LIGHT PEN
	DAC	RS30	/SAVE WHICH HIT CAUSED THIS
XPC	703072		/SCOPE 0 PC. FOR SPEED READ ALL INTO TEMP'S
/			/AT INTERRUPT LEVEL. DO OTHER STUFF 
/			/BACK AT "CAL" LEVEL
	DAC	PC0
XRS1	703012		/SCOP E 0 READ STATUS 1
	DAC	RS10
	JMP	RD035	/FINISH UP IN COMMON WITH LTORPB
RD03	SWHA		/LTORPB ENTRY, NEEDS ONLY FOUR READS
	DAC	RS30	/HERE IS THE FIRST ONE
RD035	703032		/GET READ STATUS 2
	DAC	RS20
XXP	703112		/X POSITION. STILL SCOP E 0 ONLY
	DAC	X0
XYP	703052
	.IFDEF	TUBE0
/
/	THE FUNNY PLACEMENT OF THE IFDEF IS BECAUSE THE IOT'S ABOVE
/	ARE XCT'ED SO ALLWAYS HAVE TO BE THERE!
	DAC	Y0	/FINALLY THE Y
J0	DZM	VT0W	/KILL WANTED SWITCH TO PREVENT RE-ENTRY
	DZM	LP0	/KILL LIGHT PEN FOR SCOPE
	CLA!IAC!CLL	/FOR EVENT VARIABLE SO WE AT INTERRUPT LEVEL
/			/CAN CALL OURSELVES AT CAL LEVEL
	DAC	VTEV
	LAC	(401000	/TO DECLARE A SIGNIFICANT EVENT
	ISA
	.IFDEF	TUBE1
	JMP	RET0	/GO BACK TO SEE IF OTHER SCOPE NEEDS SERVICE
	.ENDC
	.IFUND	TUBE1
	JMP	RET00	/GO SEE IF NEED TO RESUME TUBE
	.ENDC
/		TRACKING ROUINTE, SQUARE, NO DRAW
/
TR0	RAL		/MOVE BIT FOR THIS SCOPE'S PUSH BUTTON TO AC0
	SPA		/SKIP IF NOT PUSH BTN. IF IS, WE KILL OFF TRAKNG
	JMP	J0	/TREAT LIKE ANSWER TO GET
	703032		/GET NAME REGISTER TO FIGURE DIRECTION
	AND	(177	/KEEP ONLY NAME REGISTER BITS
	AAC	-170	/USE TOP EIGHT NAME REG'S FOR TRACKING
	SPA!RAR!CLL	/LEGAL ONE ONLY IF POSITIVE. PUT BIG-
/			/LITTLE BIT INTO LINK
	JMP	TR0E	/WRONG NAME REG. GO RESUME THE DISPLAY
	SZL!CLL!RAR	/SKIP ON LITTLE STEP, NEXT BIT TO LINK(+-)
	AAC	BIGSTP	/BIG STEP. ADD IN TWO TIMES WHAT WE WANT
	SZL!CLL!RAR	/LINK IS ON FOR +!!!CLEAR OUT AND PUT X-Y BIT IN
	SKP!IAC		/FOR + INCREASE AC FROM 0 TO 1
	CMA		/FOR - MAKE AC FROM 0 TO -1. FOR BIG STEPS
/			/OFF BY 1 IS IRRELEVANT
	SZL		/SKIP FOR X DIRECTION PUSH
	JMP	TR0DY	/GO TO DO Y
	TAD	TRX0	/ADD IN THE X SET POINT
	DAC	TRX0	/AND REPLACE
	JMP	TR0E	/GO TO RESUME THE TUBE
TR0DY	TAD	TRY0	/FOR Y ADD IN Y SETPOINT
	DAC	TRY0	/AND REPLACE
TR0E	LAC	SIC0
	703024		/ON LIGHT PEN HIT, JUST RESUME THE THING.
	703064		/BUT HAVE TO FUDGE  SAVRS3 SO END OF INTERRUPT
/			/HANDLER DOESN'T RESTART IT
	.IFDEF	TUBE1
	LAC	SAVRS3	/GET IT UP FOR TESTS ON SECOND SLAVE
	DZM	SAVRS3	/BUT ZERO CORE COPY FOR RESTART TESTS
	JMP	RET01
	.ENDC
	.IFUND	TUBE1
	LAC	SAVAC	/NO OTHER TUBE, JUST GOUT OUT OF INT. LEVEL
	DBR
	JMP*	VTINT
	.ENDC
	.ENDC
/
/		NOW THE AME THING FOR SECOND SLAVE OF FIRST VT-15
/
	.IFDEF	TUBE1
RD15	SWHA
	DAC	RS31
	703072
	DAC	PC1
	703012
	DAC	RS11
	JMP	RD135
RD13	SWHA
	DAC	RS31
RD135	703032
	DAC	RS21
	703112
	DAC	X1
	703052
	DAC	Y1
J1	DZM	VT1W
	DZM	LP1
	CLA!CLL!IAC
	DAC	VTEV
	LAC	(401000
	ISA
	JMP	RET1
/
/
TR1	RTL		/PUSH BUTTON BIT FOR SCOP 1, ONE PLACE LOWER
	SPA		/SO NEED RTL TO GET TO AC0 FOR TESTING
	JMP	J1
	703032
	AND	(177
	AAC	-170
	SPA!CLL!RAR
	JMP	TR1E
	SZL!CLL!RAR
	AAC	BIGSTP
	SZL!CLL!RAR
	SKP!IAC
	CMA
	SZL
	JMP	TR1DY
	TAD	TRX1
	DAC	TRX1
	JMP	TR1E
TR1DY	TAD	TRY1
	DAC	TRY1
TR1E	LAC	SIC1
	703024
	703064
	LAC	SAVAC
	DBR
	JMP*	VTINT
	.ENDC
/
/
RD25	SWHA		/OUTSIDE OF CONDITIONAL FOR ADDR. CALC
	.IFDEF	TUBE2
	DAC	RS32
	703072+LEN
	DAC	PC2
	703012+LEN
	DAC	RS12
	JMP	RD235
RD23	SWHA
	DAC	RS32
RD235	703032+LEN
	DAC	RS22
	703112+LEN
	DAC	X2
	703052+LEN
	DAC	Y2
J2	DZM	VT2W
	DZM	LP2
	CLA!CLL!IAC
	DAC	VTEV
	LAC	(401000
	ISA
	.IFDEF	TUBE3
	JMP	RET2
	.ENDC
	.IFUND	TUBE3
	JMP	RET20
	.ENDC
/
/
TR2	RAL
	SPA
	JMP	J2
	703032+LEN
	AND	(177
	AAC	-170
	SPA!CLL!RAR
	JMP	TR2E
	SZL!CLL!RAR
	AAC	BIGSTP
	SZL!CLL!RAR
	SKP!IAC
	CMA
	SZL
	JMP	TR2DY
	TAD	TRX2
	DAC	TRX2
	JMP	TR2E
TR2DY	TAD	TRY2
	DAC	TRY2
TR2E	LAC	SIC2
	703024+LEN
	703064+LEN
	.IFDEF	TUBE3
	LAC	SAVRS3
	DZM	SAVRS3
	JMP	RET21
	.ENDC
	.IFUND	TUBE3
	LAC	SAVAC
	DBR
	JMP*	VTINT
	.ENDC
	.ENDC
/
	.IFDEF	TUBE3
/
RD35	SWHA
	DAC	RS33
	703072+LEN
	DAC	PC3
	703012+LEN
	DAC	RS13
	JMP	RD335
RD33	SWHA
	DAC	RS33
RD335	703032+LEN
	DAC	RS23
	703112+LEN
	DAC	X3
	703052+LEN
	DAC	Y3
J3	DZM	VT3W
	DZM	LP3
	CLA!CLL!IAC
	DAC	VTEV
	LAC	(401000
	ISA
	JMP	RET3
/
/
TR3	RTL
	SPA
	JMP	J3
	703032+LEN
	AND	(177
	AAC	-170
	SPA!CLL!RAR
	JMP	TR3E
	SZL!CLL!RAR
	AAC	BIGSTP
	SZL!CLL!RAR
	SKP!IAC
	CMA
	SZL
	JMP	TR3DY
	TAD	TRX3
	DAC	TRX3
	JMP	TR3E
TR3DY	TAD	TRY3
	DAC	TRY3
TR3E	LAC	SIC3
	703024+LEN
	703064+LEN
	LAC	SAVAC
	DBR
	JMP*	VTINT
	.ENDC
/
/		DISPLAY EXECUTABLE CODE
/
	.EBREL
/
/
DUM0	0		/DUMMY SUBROUTINE WHEN NOTHING REAL TO SEE
	DJMPI	DUM0	/THIS ONE FOR FIRST VT-15 PROCESSOR
/
DUM2	0		/AND THE SAME THING FOR THE SECOND ONE
	DJMPI	DUM2
/
LPS0	0		/SCOPE 0 SUBROUTINE FOR LIGHT PEN ENABLE
LP0	0		/THE SWITCH. 0 IS A DISPLAY NO-OP
	DJMPI	LPS0	/RETURN. DJMPI IS OP CODE DISPLAY JUMP *
/
LPS1	0
LP1	0
	DJMPI	LPS1
/
LPS2	0
LP2	0
	DJMPI	LPS2
/
LPS3	0
LP3	0
	DJMPI	LPS3
/
	.IFDEF	TUBE0
CLEAR0	0		/SUBROUTINE TO SET DEFAULT SETTINGS, VT-15#0
	203020		/INTENSITY 4, REPEAT COUNT 0
	215252		/ALL OFF
	220004		/TURN OFF DASHED LINE
	234400		/NAME REGISTER 0
	DJMPI	CLEAR0
	.ENDC
/
	.IFDEF	TUBE2
CLEAR2	0
	203020
	215252
	220004
	234400
	DJMPI	CLEAR2
	.ENDC
/
/	TRACKING SYMBOLS FOR TWO PROCESSORS
/
ODIAG=OSIZE/2
BIGT=2*OSIZE		/*2 SIZE INTERRUPT CODE DOES A RAR ON IT!
BIGT2=2*ITER		/CORRECTION SO LITTLE&BIG STEPS DON'T
/			/TAKE THE SILLY THING OFF SCREEN!
BIGT3=OSIZE-BIGT2
BIGT4=BIGT3&7776
BIGSTP=BIGT4-2
THICK=ITER-1		/THICKNESS OF SIDE(OFFSET 1 RASTER EACH TIME)
DIAG=SIZE-THICK		/LONG DIAGONAL TO MOVE BEAM TO OTHER HALF
/			/OF THE TRACKING SYMBOL
DIAG1=DIAG+1		/RETURN DIAGONAL ONE MORE FOR OFFSET
ZTEMP=THICK+THICK+THICK /NOT SURE OF ASSEMBLER ARITHMATIC....
INDIAG=SIZE-ZTEMP	/INNER DIAGONAL OF THE SYMBOL
SETIT=INDIAG/2		/INITIALIZE CORNER OF SQUARE FROM CENTER POINT
SEE=INT!SIZE	/COMMON BITS FOR SIDE OF BOX
/
	.IFDEF	TUBE0
TRACK0	0
TRX0	0
TRY0	0
	DJMS	TSYMB0
	DJMPI	TRACK0
	.ENDC
/
	.IFDEF	TUBE1
TRACK1	0
TRX1	0
TRY1	0
	DJMS	TSYMB0
	DJMPI	TRACK1
	.ENDC
/
	.IFDEF	TUBE2
TRACK2	0
TRX2	0
TRY2	0
	DJMS	TSYMB2
	DJMPI	TRACK2
	.ENDC
/
	.IFDEF	TUBE3
TRACK3	0
TRX3	0
TRY3	0
	DJMS	TSYMB2
	DJMPI	TRACK3
	.ENDC
/
	.IFDEF	TUBE0
TSYMB0	0
	203620		/SCALE 0, INTENSITY 7
	215256		/LIGHT PEN ON! REST OF STUFF OFF
	V3!ODIAG	/MOVE TO OUTER SQUARE
	LDNM!171	/NAME REG FOR LARGE STEP, -, X DIRECGTION
	V6!OSIZE!INT	/SQUARE SIZE, INTENSIFIED, SIZE =OSIZE
	LDNM!175	/LARGE, -Y
	V0!OSIZE!INT	/BOTTOM OF SQUARE
	LDNM!173	/+X
	V2!INT!OSIZE	/RIGHT SIDE
	LDNM!177	/+Y
	V4!INT!OSIZE	/TOOP
	V7!ODIAG	/RETURN TO CENTER TO DO SMALLER SQUARE
	V5!SETIT	/FIRST OF LINES TO POSITION TO CORNER
	V6!THICK
	.REPT	ITER
	DJMS	ISQ0	/CALLS TO THE INNER SQUARE
	210010		/AND TURN OFF THE LIGHT PEN
	203000		/RETURN TO INTENSITY 4
	V1!SETIT+ITER
	V2!THICK
	DJMPI	TSYMB0	/AND RETURN
	.ENDC
/
	.IFDEF	TUBE2
TSYMB2	0		/SAME FOR SECOND PROCESSOR
	203620
	215256
	V3!ODIAG
	LDNM!171
	V6!OSIZE!INT
	LDNM!175
	V0!OSIZE!INT
	LDNM!173
	V2!INT!OSIZE
	LDNM!177
	V4!INT!OSIZE
	V7!ODIAG
	V5!SETIT
	V6!THICK
	.REPT	ITER
	DJMS	ISQ2
	210010
	203000
	V1!SETIT+ITER
	V2!THICK
	DJMPI	TSYMB2
	.ENDC
/
/
	.IFDEF	TUBE0
ISQ0	0		/INNER SQUARE ROUTINE VT-15 #0
	LDNM!170	/SMALL SETP, -, X (NAME REG 170-177 USED
	V2!SEE		/DRAW THE SIDE ONCE
	V6!SEE		/AND BACK AGAIN
	V3!THICK	/DIAGONAL (SHORT TO ADJACENT SIDE
	LDNM!174
	V0!SEE
	V4!SEE
	V1!DIAG
	LDNM!172
	V6!SEE
	V2!SEE
	V7!THICK
	LDNM!176
	V4!SEE
	V0!SEE
	V5!DIAG1
	DJMPI	ISQ0
	.ENDC
/
/
	.IFDEF	TUBE2
ISQ2	0
	LDNM!170
	V2!SEE
	V6!SEE
	V3!THICK
	LDNM!174
	V0!SEE
	V4!SEE
	V1!DIAG
	LDNM!172
	V6!SEE
	V2!SEE
	V7!THICK
	LDNM!176
	V4!SEE
	V0!SEE
	V5!DIAG1
	DJMPI	ISQ2
	.ENDC
/
/		BASIC LOOPS FOR THE TWO PROCESSORS
/
	.IFDEF	TUBE0
LOOP0	DJMS	CLEAR0	/SET UP DEFAULTS FOR SCOPE 0
	236000		/HALT AND RESUME IN SYNC.
	340300		/SCOPE 0 ONLY, INTENSIFY AND TURN ON LIGHT PEN
	DJMSI	TRCK0	/CALL TRACKING FOR SCOPE 0
	DJMSI	SELF0	/CALL USER MAIN FILE TO SHOW ON OWN SCOPE
	DJMS	CLEAR0	/CLEAR AGAIN . IF A HIT THIS TIME
	.IFDEF	TUBE1
	340060		/INT. AND LIGHT PEN ONLY ON SCOPE 1
	DJMSI	TRCK1	/TRACKING FOR SCOPE 1
	DJMSI	SELF1	/USER MAIN FILE FOR HIS OWN SCOPE
	DJMS	CLEAR0	/CLEAR AGAIN
	.ENDC
	340360		/NOW INTENSIFY FOR BOTH SCOPES IN COMMON
	DJMSI	BOTH0	/CALL SUBROUTINE FROM USER
	.IFDEF	TUBE1
	DJMS	CLEAR0	/CLEAR FOR SECOND OF BOTH ENTRIES
	DJMSI	BOTH1
	.ENDC
	DJMP	LOOP0	/BACK TO TOP OF LOOP
	.ENDC
/
/		NOW SAME FOR SECOND PROCESSOR
/
	.IFDEF	TUBE2
LOOP2	DJMS	CLEAR2
	236000
	340300
	DJMSI	TRCK2
	DJMSI	SELF2
	DJMS	CLEAR2
	.IFDEF	TUBE3
	340060
	DJMSI	TRCK3
	DJMSI	SELF3
	DJMS	CLEAR2
	.ENDC
	340360
	DJMSI	BOTH2
	.IFDEF	TUBE3
	DJMS	CLEAR2
	DJMSI	BOTH3
	.ENDC
	DJMP	LOOP2
	.ENDC
/
/	CLEARING INTERRUPT ENABLE BITS EXIT CODE
/
TZERO	0
RETIRE	RESTR	TZERO	/ZERO'S INTO BITS
	INSTP		/INTERNAL STOP CODE
/		CONSTANTS FOR JMS INDIRECTS ETC.
/
	.DBREL
TRCK0	DUM0	/WHEN NOTHING THERE EXECUTE DUMMY SUBROUTINE
TRCK1	DUM0
TRCK2	DUM2
TRCK3	DUM2
SELF0	DUM0
SELF1	DUM0
SELF2	DUM2
SELF3	DUM2
BOTH0	DUM0
BOTH1	DUM0
BOTH2	DUM2
BOTH3	DUM2
STAD0	0		/PARTITION ADDR FOR PUT TYPE START
STAD1	0
STAD2	0
STAD3	0
	.IFDEF	TUBE0
DTRCK	TRACK0		/ADDR OF TRACKING ROUTINE IF TUBE
	.ENDC
	.IFUND	TUBE0
DTRCK	400000		/IMPOSSIBLE ADDR IF NOT
	.ENDC
	.IFDEF	TUBE1
	TRACK1
	.ENDC
	.IFUND	TUBE1
	400000
	.ENDC
	.IFDEF	TUBE2
	TRACK2
	.ENDC
	.IFUND	TUBE2
	400000
	.ENDC
	.IFDEF	TUBE3
	TRACK3
	.ENDC
	.IFUND	TUBE3
	400000
	.ENDC
DUMYS	DUM0	/LIST OF "CORRECT" DUMMYS IN ORDER OF UNIT #
	DUM0
	DUM2
	DUM2
	.IFUND	TUBE0
TRCKS	HLT
	HLT
	.ENDC
	.IFDEF	TUBE0
TRCKS	JMP	TR0	/JMP TO TRACKING INTERRUPT ROUTINE
	.IFDEF	TUBE1
	JMP	TR1
	.ENDC
	.IFUND	TUBE1
	HLT
	.ENDC
	.ENDC
	.IFUND	TUBE2
	HLT
	HLT
	.ENDC
	.IFDEF	TUBE2
	JMP	TR2
	.IFDEF	TUBE3
	JMP	TR3
	.ENDC
	.IFUND	TUBE3
	HLT
	.ENDC
	.ENDC
	.IFUND	TUBE0
TORPS	HLT
	HLT
	.ENDC
	.IFDEF	TUBE0
TORPS	JMP	RD03	/JUMP TO 3 IOT READ FOR LTORPB
	.IFDEF	TUBE1
	JMP	RD13
	.ENDC
	.IFUND	TUBE1
	HLT
	.ENDC
	.ENDC
	.IFUND	TUBE2
	HLT
	HLT
	.ENDC
	.IFDEF	TUBE2
	JMP	RD23
	.IFDEF	TUBE3
	JMP	RD33
	.ENDC
	.IFUND	TUBE3
	HLT
	.ENDC
	.ENDC
	.IFUND	TUBE0
RGRDS	HLT
	HLT
	.ENDC
	.IFDEF	TUBE0
RGRDS	JMP	RD05	/SAME FOR FUL 5 IOT READS
	.IFDEF	TUBE1
	JMP	RD15
	.ENDC
	.IFUND	TUBE1
	HLT
	.ENDC
	.ENDC
	.IFUND	TUBE2
	HLT
	HLT
	.ENDC
	.IFDEF	TUBE2
	JMP	RD25
	.IFDEF	TUBE3
	JMP	RD35
	.ENDC
	.IFUND	TUBE3
	.ENDC
	.ENDC
SIC0	257740		/LIST OF DEAULT SIC WORDS FOR EACH UNIT
SIC1	257740
SIC2	257740
SIC3	257740
REGSIC	257740		/YOU GUESSED IT, THE REGULAR SIC WORD
XTRA	0		/FOUR WORDS FOR THIRD WORD OF CONTROL
/			/TABLE FOR USER GET
	0
	0
	0
XSTOP	703044
	703044
	703044+LEN
	703044+LEN
XSIC	703024
	703024
	703024+LEN
	703024+LEN
XRSUM	703064
	703064
	703064+LEN
	703064+LEN
XSTRT	703004
	703004
	703004+LEN
	703004+LEN
	.IFDEF	TUBE0
INITD	LOOP0
	LOOP0
	.ENDC
	.IFUND	TUBE0
	400000
	400000
	.ENDC
	.IFDEF	TUBE2
	LOOP2
	LOOP2
	.ENDC
	.IFUND	TUBE2
	400000
	400000
	.ENDC
	.IFUND	TUBE0
ASW	400000
	400000
	.ENDC
	.IFDEF	TUBE0
ASW	SW0
	.IFDEF	TUBE1
	SW1
	.ENDC
	.IFUND	TUBE1
	400000
	.ENDC
	.ENDC
	.IFUND	TUBE2
	400000
	400000
	.ENDC
	.IFDEF	TUBE2
	SW2
	.IFDEF	TUBE3
	SW3
	.ENDC
	.IFUND	TUBE3
	400000
	.ENDC
	.ENDC
	.IFUND	TUBE0
LTRX	400000
	400000
	.ENDC
	.IFDEF	TUBE0
LTRX	TRX0-1
	.IFDEF	TUBE1
	TRX1-1
	.ENDC
	.IFUND	TUBE1
	400000
	.ENDC
	.ENDC
	.IFUND	TUBE2
	400000
	400000
	.ENDC
	.IFDEF	TUBE2
	TRX2-1
	.IFDEF	TUBE3
	TRX3-1
	.ENDC
	.IFUND	TUBE3
	400000
	.ENDC
	.ENDC
LBIT	100010
	100004
	100010
	100004
PBIT	200200
	200100
	200200
	200100
LPSS	LP0
	LP1
	LP2
	LP3
ANDXR2	NOP		/TABLE TO BE EXECUTED WITH XR 0-3
	AXR	777	/LEAVES XR EITHER 0 OR 2
	NOP		/FOR THOSE FUNCTIONS WHICH WORK WITH BOTH
	AXR	777	/SCOPES ON A PROCESSOR.
VTEV	0		/EVENT VARIABLE FOR HANDLER
NEGPAG	0		/NEGATIVE OF PAGE BITS FOR 2,X TYPE ADDRESSING
VTSXBT	.SIXBT	"VT@"	/VT. IN SIXBIT FOR UNIT FIND LOOP
UNITXR	0		/PRESENT UNIT #, SAVE FOR INDEX REGISTER
VTTAB	0		/TABLE OF REAL ADDRESSES OF PDVL NODES FOR VT'S
	0
	0
	0
	-1		/END OF TABLE MARKER
RWNOD	0		/REAL ADDR. OF REQUEST NODE, ORDERED BY UNIT #
	0
	0
	0
	-1		/STOPPER
IOCDS	0		/POINTER TO IOCD WORD FOR PARTITION
/			/FOR SELF TYPE PUTS
	0
	0
	0
IOCDB	0		/SAME FOR BOTH TYPE PUT
	0
	0
	0
IOCDX	0		/AND FOR START TYPE OF PUT
	0
	0
	0
	-1		/AND A STOPPER HERE TOO
HOLD	0		/JMP TO ROUTINE TO BE CALLED AFTER INTERRUPT
/			/SERVICING PLACED IN THE UNIT # TABLE
	0
	0
	0
/
/	CAL'S FOR VARIOUS THINGS
/
VTWAIT	20		/WAIT FOR VT HANDLER EVENT VARIABLE
	VTEV
/
VTCON	11		/CONNECT SCOPE TO API
	VTEV		/EVENT VARIABLE FOR IF IT WORKED
	14		/API LINE -40
	VTINT		/INTERRUPT ROUTINE
/
	.END	VTA	/ZXCV   THESE 4 CHAR'S SERVE AS EOF MARK FOR EDIT.
