	.TITLE	VPR

/ 

/ 

/                   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 #33	7/16/73		S. ROOT

/	UPDATE TO COMPATIBILITY WITH FORTRAN V44

/ EDIT #34	8/20/74		S. ROOT
/	FIX ASSEMBLY ERROR UNDER QEDIT=0

/ EDIT #35	10/27/75	SCR

/	START CHANGES FOR XVM

/ EDIT #36	11/3/75	SCR MORE XVM CHANGES
/ EDIT #37	11/4/75 SCR MORE XVM CHANGES
/ EDIT #38	11/11/75 SCR FIX VARIOUS BUGS
/ EDIT #39	11/16/75 SCR CHICKEN AND EGG PROBLEM IN PRAMTR
/ EDIT #40	11/17/75 SCR MINOR NIT, NO OP CODE FOR JMS LTP.
/ EDIT #41	11/18/75 SCR EXTRA (
/ EDIT #42	11/29/75 SCR FIX FOR XVM EXEC MODE CHECK
/ EDIT #44	12/19/75 SCR FIX 'ANY' REPLOT;INSTALL SHRTAV
/
/
/	FORTRAN CALLABLE ROUTINES TO DRIVE VT-15 SCOPE UNDER RSX-PLUS
/	VPR==VT-15 PRIMITIVES

/

	.EBREL		/BANK MODE BECAUSE FORTRAN OUTPUT IS.

/

/	ASSEMBLY PARAMETER  QEDIT

/

/	IF NOT SPECIFIED (DEFAULT), PACKAGE STOPS AND RESTARTS

/  VT-15 PROCESSOR FOR EACH EDITING (REPLOT) OPERATION.

/  THIS IS SAFEST, BUT THE MOST EFFICIENT. IF QEDIT IS SPECIFIED

/  THIS RESTART IS NOT DONE. IN THIS CASE THE USER ASSUMES

/  RESPONSIBILITY FOR HIS REPLOTS. (REPLACING A COPY (NORESTORE)
/  CALL AND A FOLLOWING NO-OP WITH TWO ARBITRARY VECTORS

/  MAY CAUSE THE VT-15 TO COME OUT OF THE SUBROUTINE, AND 

/  EXECUTE ONE ARBITRARY VECTOR.) THE PRIMIARY DIFFICULTY

/  IS RETURNING FROM A DJMS* OR CHARS* INTO THE MIDDLE OF

/  SOMETHING. IF YOU ALWAYS EDIT THE SAME ITEM OVER ITSELF,
/  YOU WILL WIN.
/
/	ASSEMBLY PARAMETER SHRTAV
/
/	IF SHRTAV IS NOT DEFINED (DEFAULT) ARBITRARY VECTORS
/  WILL BE GENERATED, AS PREVIOUSLY. IF SHRTAV IS DEFINED, THE
/  CODE WILL INSTEAD GENERATE SHORT ARBITRARY VECTOR (1 LOC) WHEN
/  THE ABSOLUTE MAGNITUDE OF DX AND DY ARE BOTH LESS THAN 40(8).
/

/

/	SOME GRAPHICS EQUALITIES

/
CHARSI=60000
DNOPB=200001
DNOPE=200004

DJMP=600000

DJMPI=620000

DJMSI=660000

DNOP=200000

DSKP=235000

GY=162000

INT=20000

PX=144000

PY=140000

RSTR=260000

SAVE=240000

STROK=100000

/

PLTLIM=6		/HIGHEST LEGAL ARG FOR PLOT-REPLOT

/

/	ENTRY POINTS FOR FORTRAN CALLS

/

	.GLOBL LINE,TEXT,COPY,PRAMTR,GRAPH,BLANK,UNBLNK,POINT

	.GLOBL DINIT,DCLOSE,SETPT,PLOT,DELETE,REPLOT,RSETPT

	.GLOBL LTORPB,TRACK,VTUNIT,CCLOSE,CINIT,ANY,GETPSH

/

/	ENTRY POINTS FOR DYSET-DYLINK

GETBAS=VTGL1

GETLTP=VTGL2

/

	.GLOBL VTGL1,VTGL2,VTGL3

/

/

/	COMMONLY CALLED INTERIOR SUBROUTINES. IN THE GENERAL CASE

/	OF A COMMAND TO GENERATE DISPLAY CODE, THREE ROUTINES WILL

/	BE CALLED. SETARG MOVES THE ARGUMENT POINTERS FROM THE

/	FROTRAN PROGRAM TO INTEOR LOCATIONS. IT ASLO

/	INITIALIZES SOME FLAGS. INITIT SETS UP POINTERS TO THE

/	DISPLAY FILE TO BE MODIFIED. EXIT DOES FINAL CLEAN UP AND

/	RETURNS TO THE USER.

/

/		THERE ARE THRE DIFFERENT CLASSES OF CALLS. THE

/	SUBPICTURE CALLS ALLOW DISPLAY CODE TO BE ADDED TO SUBPICTURE

/	FILES. THE PLOT CALLS ALLOW CODE TO BE ADDED TO MAIN FILE.

/	THE REPLOT CALLS ALLOW DISPLAY CODE TO BE WRITTEN, WITH SOME

/	CONSTRAINTS, OVER PREVIOUSLY EXISTING CODE. THIS RATHER

/	STRANGE CLASSIFICATION OF MAIN SUBPICTURE, ETC. IS A 

/	HOLD OVER FROM THE GRAPHICS-15 PROJECT. PROGRAMS WRITTEN

/	THERE MUST RUN HERE (WITH RECOMPILE.).

/

/	LOCATIONS USED BY VARIOUS LEVELS.

/

ARGP	0		/POINTER TO INTERNAL ARG. LIST ARG1, ARG2....

PUTP	0		/POINTER FOR PLACEMENT OF DISPLAY COMMANDS.

CMMTMP	0		/TEMPORARY LOCATION TO HOLD FIRST DISPLAY

/			/INSTRUCTION, WHICH IS THE LAST ONE PLACED.

PUTCNT	-1		/SWITCH SET TO -1, EACH TIME BY SETARG. SO

/			/THAT THE ROUTINE PUT PLACES FIRST IN CMMTMP.

ARGCNT	0		/INITIALLY USED FOR -COUNT OF USER ARG'S

/			/LATER USED AS SWITCH FOR CNAME PRESENCE.

/			/CNAME IS AN ABSOLUTE EDIT ADDRESS, OPTIONAL

/			/EXCEPT FOR REPLOT, THEN REQUIRED.

SUBP	0		/THE LAST SUBPICTURE REFERENCED (DEFAULT IN

/			/IN CASE NONE PROVIDED.)

CMPNT	.		/THIS IS USED AS POINTER TO NEXT TWO

/			/MAIN, AND COMMFL.KEEP THESE 3 TOGETHER!

MAIN	0		/THE PRESENT MAINFILE.

COMMFL	0		/THE PRESENT FILE BEING SHOWN BOTH SLAV

RUNLT	0		/FLAG. 1 WHEN COMMON FILE BEING

/			/EXECUTED, 2 WHEN MAIN, 3 BOTH, 0 NEITHER.

THSFIL	0		/PRESENT FILE BEING ADDED TO(MAIN OR SUBP)

LAST	0		/POINTER TO LAST ARGUMENT PROVIDED BY USER

NLAST	0		/POINTER TO NEXT TO LAST

RETURN	0		/STORE RETURN ADDR HERE FOR COMMON EXIT

TYPE	0		/-1 FOR SUBP, 0 FOR MAIN(PLOT), 1 FOR REPLOT

DEFER	0		/-1 FOR REGULAR CODE. 0 FOR CALLS THAT PLACE

/			/CODE IN TEMPORARIES THEN TO DISPLAY FILE.

/			/(35)ONLY PARAM CALLS SET 0, USE AS FLAG!
COMMND	0		/LOCATION FOR PLACEMENT FIRST COMMAND OF GROUP

ABSCMM	0		/SAME, THE ABSOLUTE RATHER THAN RELATIVE

/			/AND ALSO TRUNCATED TO 13 BIT DISPLAY SPACE.

/			/(35)LENGTH MOVED TO ANOTHER LOCATION

HNDLTP	0		/ADDR OF LIGHT PEN ENABLE ROUTINE IN

/			HANDLER 0 WHEN NOT YET OBTAINED.

/

/	CALS FOR GETTING INFO. GET BASE ADDR FROM SYSTEM. LIGHT PEN

/	ENABLING ROUTINE ADDR FROM HANDLER. DOING I/O ETC.

/

WHERE	26		/SYSTEM CAL FOR BASE

	FEV		/FORTRAN EVENT VARIABLE (NAME ARBITRARY)

	0		/0,0 IN THIS PAIR SAYS PRESENT PARTITION

	0

	BASE		/ADDR TO PLACE TWO WORD ANSWER
FEV	0		/FORTRAN EVENT VARIABLE
/
TASKN	25		/(42)CHECK EXEC-USER
	FEV		/(42)EVENT VARIABLE
BASE	-1		/(42)TASKN DUMMY, USE AS BASE-LENG
PLENG	-1		/(42)PARTITION LENGTH
/
PUTCAL	3100

	FEV

UNITP	30		/UNIT NUMBER 30(8) DEFAULT

	PUTTAB

PUTTAB	0

PUTBF	0

GETCAL	3000

	FEV

UNITG	30		/AGAIN UNIT #

	GETTAB

GETTAB	0

	GETBF

	10000		/FOR GETPSH. BITS FOR PUSH BOTTONS ONLY

GETBF	0

	0

	0

	0

	0

	0

WATCAL	20		/CAL CODE FOR WAIT

	FEV		/EVENT VARIABLE FOR EVERYONE

/

/	WORK AREAS AND LOCATIONS

/

ARG1	0		/USER ARGUMENT POINTERS TRANSFERED HERE

/			/NOTE, CLEARING ROUTINE EXPECTS ONLY USE AS

/ ARGUMENT STORAGE, ONCE IT FINDS A 0, THE REST ARE 0!!!!!

/ SO THEY CAN'T BE USED AS RANDOM TEMPORARIES.

/

ARG2	0

ARG3	0

ARG4	0

ARG5	0

ARG6	0

ARG7	0

ARG8	0

ARG9	0

ARG10	0

ARG11	0

ARG12	0

ARG13	0

	0		/EXTRA 0 AS LIST STOPPER

/

/

H0	0		/(35)SLOT FOR LEADING DNOP

H1	0		/ LOCATIONS FOR TEMPORARY PLACEMENT OF DISPLAY 

H2	0		/CODE

H3	JMS	GETLTP	/(35)ONCE ONLY, FETCH LIGHT PEN ROUTINE ADDR

H4	LAW	-2	/(35)PATCH OVER SO DON'T REENTER

H5	DAC	LITM2	/(35)

H6	JMP	LITM2	/(35)REJOIN MAIN LINE

H7	0		/(35)SPACE FOR TRALING DNOP

LITM1	-1		/STOPPER FOR GUY GETTTING THIS CODE. ALSO LITERA

PR1	0		/LOCATIONS FOR USE OF PRIMITIVES ONLY

PR2	0

PR3	0

PR4	0

PR5	0

/

/	LOCATIONS FOR USE OF SETARG, INITIT, EXIT ETC.

/

CR1	0

CR2	0

CR3	0

/

/	TRUE TEMPORARYS, CANNOT BE ASSUMED TO BE SAVED!

/

T1	0

T2	0

/

/	SETARG, ROUTINE TO MOVE ARGUMENTS TO ARG1 - ARG13

/	OTHER JOBS TO DO, SET UP ARGP, PUTCNT, NLAST, LAST, 

/	SET DEFER AND TYPE TO DEFAULT SUBP, AND NOT DEFERRED.

/	IT IS ASSUMED THAT THE CALL TO SETARG IS THE LOCATION FOLLOWING

/	THE ENTRY POINT, IN WHICH CASE SETARG SETS UP THE RETURN

/	ADDRESS IN THE LOCATION RETURN

/

SETARG	0

	DZM	LENGTH	/JUST IN CASE

	CLX		/IN CASE WE CALL AN ERROR EXIT.

	CLL!CLA!CMA	/-1 FOR INITIAL SETTINGS. LINK =0 FOR LATER

	DAC	PUTCNT	/SHOW THAT WE ARE YET TO PLACE FSRT DISPLAY INST.

	DAC	TYPE	/DEFAULT TYPE TO BE A SUBPICTURE CALL.

	DAC	DEFER	/DEFAULT, WE ARE PLACING CODE DIRECTLY TO FILE

LITM2	JMP	H3	/(35)ONCE ONLY, FETCH LIGHT PEN ADDR

/			/(35)LOCATION THEN SET UP AS LAW -2

	TAD	SETARG	/ADDR OF ORIGINAL ENTRY (LINK NOW 1)

	DAC	T1	/INDIRECTION FOR CONTENTS

	LAC*	T1	/HERE IS RETURN ADDR.

	DAC	RETURN	/SAVE FOR COMMON EXIT ROUTINES

	AND	(77777	/NEED ADDR FOR CALCULATION UNADORNED WITH

/			/TOP THREE BITS.

	DAC	CR1	/ALSO NEED AS POINTER TO GET ARG'S, BUT..

/			/IT'S ONE SHY, NOTE IN LATER LOOP..

	AND	(17777	/COUNTING GAMES COMING UP WORK ONLY IF

/			/THIS IS STRIPED TO 13 BITS

	XOR	(177777	/DIRTY.THIS MAKES -(JMP .+1)

	TAD*	RETURN	/ADD IN JMP .+(# OF ARGS)+1 = # OF ARG.'S

/

/	A PROBLEM ARISES WHEN !NO! ARGUMENTS WERE GIVEN, WHICH IS ILLEGAL.

/ PRESENT TEST WILL CATCH THIS UNLESS FOLLOWING THE CALL IS A JUMP

/ TO LESS THAN 13(10) DOWN FURTHER IN THE CODE. LINK HAS BEEN PUT

/ BACK TO ZERO IF INSTRUCTION AT LEAST A JMP .+1.

	CMA!IAC		/NEED - ARG.'S. IF 0, VERY UNLIKELY, LINK WAS

/			/MADE 'WRONG' AGAIN.

	DAC	ARGCNT	/FOR INITIT, - COUNT OF ARGUMENTS PROVIDED.

	DAC	CR2	/AND FOR LOOP CONTROL OF ARGUMENT GETTER.

	AAC	15	/SEE IN NOT TOO MANY ARG'S, OR IF OP CODE

/			/IS NOT THE EXPECTED JUMP OF ARG. LIST

	SPA!SZL		/THIS SKIPS ONLY IF ORIGINAL ADDITION GAVE

/			/1 TO 15 OCTAL, I.E. EXPECTED JUMP PRESENT.

	JMP	ERR0	/GO TO ARGUMENT SPECIFICATION ERROR

	LAC	(ARG1	/SETUP FOR LOOP TO CLEAR, AND ONE TO GET ARG.'S

	DAC	CR3	/POINTER FOR ARG.'S  TO.

	DAC	ARGP	/FOR SUBROUTINE PARMC

SETL1	DAC	NLAST	/NEXT TO LAST POINTER

	ISZ	CR1	/THIS WAS ONE SHY, INCREMENT BEFORE USING.

	LAC*	CR1	/GET POINTER

	SMA		/IF HIGH ORDER BIT, INDIRECT!?!?!

	JMP	SETL11	/NOPE, JUST CONTINUE

	DAC	T1	/T1 REAL TEMPORARY

	LAC*	T1	/THESE 2 REMOVE INDIRECTION

SETL11	DAC*	CR3	/INTO OUR LIST

	DAC	LAST	/LAST ARGUMENT FOUND (WHEN WE FINALLY EXIT)

	ISZ	CR3	/

	ISZ	CR2	/SEE IF WE'RE DONE

	JMP	SETL1	/RETURN TO LOOP FOR MORE

	CLA		/TO CHECK EACH ARG POINTER FOR 0

SETL21	SAD*	CR3	/IS NEXT 0

	JMP	SETL22	/YES, ASSUME NO MORE NON-ZERO LATER IN LIST

	DZM*	CR3	/CLEAR IT

	ISZ	CR3	/MOVE TO NEXT

	JMP	SETL21	/RETURN TO LOOP

SETL22	CLL!CLA!CMA	/LEAVE AC=-1, LINK=0 FOR OTHERS

	JMP*	SETARG	/WHEW!

/

/	INITIT SETUP WORK FOR DISPLAY FILE ADDRESSING AND CODE

/	PLACEMENT.

/

/		CALLINS SEQUENCE. THE AC CONTAINS 2*(# OF ARG.'S+1)+Z.

/	THE # OF ARG.'S ARE THOSE PRIOR TO THE PNAME POSITION IN A

/	SUBPICTURE CALL (DO NOT COUNT TYPE ARG. FOR PLOT-REPLOT).

/	SEE BELOW, #=3 FOR LINE. Z=1 IF THE LAST OF THE COUNTED ARG'S

/	CAN BE MISSING. THUS FOR LINE THE "INT" ARG CAN BE MISSING.

/	SO LINE CALLS US WITH AC=11 OCTAL.  AT CALL+1 IS THE

/	NUMBER OF DISPLAY COMMANDS  THE CALL WILL PLACE (FOR EDITTING

/	PURPOSES). IT IS ASSUMED THAT SETARG HAS SET UP ARGCNT.

/	COMMND , PUTP, THSFIL, UPDATE OF MAIN AND SUBP ALSO DONE.

/

INITIT	0

	CLL!RAR		/PUSH Z INTO LINK, AND GIVE #+1 IN AC

	TAD	ARGCNT	/NEW ARGCNT, SEE BELOW.  LINK FLIPPED!!!

	DAC	ARGCNT	/ARGCNT HAD - COUNT OF USER SUPPLIED ARGS

/	A DIGRESSION IS NEEDED; TAKE    CALL LINE (X,Y,INT,PNAME,CNAME)

/ AS EXAMPLE. THE FORTRAN USER MAY SUPPLY FROM 2 TO 5 ARG.'S. THE CALL

/ TO INTIT FROM LINE SUBROUTINE INTERNALLY GAVE US 4 IN AC. ARGCNT HAD

/ -2 TO -5.  THUS      X,Y          ARGCNT NOW = 2

/			X,Y,INT	    		1

/			X,Y,INT,PNAME		0

/			X,Y,INT,PNAME,CNAME	-1

/ WHERE PNAME IS SUBPICTURE (OR MAIN) FILE ADDR. AND CNAME IS EDIT ADDR

/ TO BE RETURNED; THIS IS DOS-15 GRAPHICS TERMINOLOGY.

/

/       NOW FOR MAIN FILE       CALL PLOT (1,X,Y,INT,CNAME)

/ MOVARG CONVERTS TO                       (X,Y,INT,CNAME) MAKING

/ ARGCNT CORRESPOND, SO WE HAVE

/

/			X,Y			2

/			X,Y,INT			1

/			X,Y,INT,CNAME		0

/

/ AND FINALLY FOR REPLOT, AFTER MOVARG HAS ALSO GOT TO IT,

/

/			X,Y,INT,CNAME		0

/

/ THOSE CALLS SUCH AS COPY, WHICH DON'T HAVE AN OPTIONAL GRAPHICS ARGU-

/ MENT, (AS OPPOSED TO FILE ARGUMENTS LIKE PNAME AND CNAME) CANNOT

/ LEGALLY HAVE AN ARGCNT OF 2 AT THIS POINT. THOSE THAT CAN HAVE

/ 2, HAVE A LINK OF 0.

/

/ FIRST JOB, ARGCNT MINUS IS ILLEGAL, EXCEPT -1 FOR TYPE -1(SUBPICTURE)

	SPA		/ARGCNT POSITIVE, GO TO SKP TO GET OUT.

	SAD	TYPE	/MINUS OK ONLY IF TYPE=ARGCNT=-1

	SKP!RAL		/HEY, THAT HAPPENED AND IS LEGAL

/			/RAL TO GET LINK OUT FOR TESTING,

	JMP	ERR0	/ALL OTHER MINUS ARGCNT ERROR. GO TO IT

	AAC	-5	/THIS MAKES LEGAL ARG COUNTS MINUS

	SMA!CMA!IAC	/SO SKIP WHEN OK. THE REST IS TO REMEMBER IN LINK

	JMP	ERR0	/ANOTHER ARGUMENT ERROR. TOO FEW

	RTR		/WHETHER A CNAME OR PNAME WAS PROVIDED.

	RAR		/LINK NOW 0 WHEN NONE WERE PORVIDED!

	LAC*	INITIT	/AT CALL+1 USER GAVE US (USUALLY) COUNT OF

/			/COMMANDS TO BE GENERATED. THAT IS NEEDED

	DAC	LENGTH	/HERE. CALLER MAY OVERRIDE IF NECESSRY.

	LAC	TYPE	/WE NOW MUST SPLIT UP EDIT,MAIN(PLOT,SUBPIC

/			/TURE WITH PNAME, AND SUBPICTURE WITHOUT

	SMA!SZA		/SKIP UNLESS EDIT.

	JMP	INEDIT	/GO DO EDIT (REPLOT) SETUP

	SZA!SNL!RAR	/SKIP UNLESS SUBPICTURE WITHOUT PNAME. ALSO

/			/SET UP LINK0 FOR MAIN, 1 FOR SUBPICT.

	JMP	INS	/NO NAME PROVIDED, JUST GO GET DEFAULT

	LAC	MAIN	/PICK UP MAIN FILE IN CASE WE'RE DOING MAIN

	SNL		/SKIP ON SUBPICTURE

	JMP	INB	/DOING MAIN, REJOIN LATER.

	LAC	LAST	/THIS 4 IS DIRTY!!!! IF LAST POINTS TO PNAME

/			/THE SUBPICUTER FILENAME, ARGCNT IS 0.

	ISZ	ARGCNT	/IF NLAST POINTS  ARGCNT IS -1

	DAC	NLAST	/THIS MAKES NLAST ALWAYS POINT. IT ALSO LEAVES

/			/ARGCNT 0 WHEN THERE IS A CNAME!

	LAC	NLAST	/GET FILE ADDR

	DAC	SUBP	/IT IS NOW THE DEFAULT SUPPICTURE

INS	LAC	SUBP	/SUBPICTURE NO PNAME RE-ENTERS HERE

INB	DAC	THSFIL	/MAIN RE-ENTERS HERE. LOAD "PRESENT" FILE

	TAD*	THSFIL	/ADD POINTER ON TOP TO POINT AT END

	SAD	THSFIL	/WATCH IT! IF POINT WAS ZERO, IT'S A NEW FILE

/			/WE DON'T SKIP AND WE GO INIT THE FILE

	JMS	NEW	/THIS ROUTINE INIT'S THE FILE, AND LEAVES IN

/			/AC THE DESIRED POINTER TO FILE END

	DAC	PUTP	/(35)POINT END OF GROUP

	AAC	-1	/(35)AND ONE PREVIOUS

	DAC	COMMND	/(35)

	LAC*	COMMND	/(35)CAN RECLAIM A DNOPE AT FILE END???

	SAD	(DNOPE	/(35)IS THERE A DNOPE THERE

	SKP!CLA!CMA	/(35)YES, KEEP CHECKING

	JMP	REG	/(35)NO RECLAIM, MOVE PNTERS

	SAD	DEFER	/(35)DNOPE, BUT CAN'T BE A PARAM SET

	JMP	RECLAI	/(35)RECLAIM DNOPE

REG	ISZ	PUTP	/(35)NO RECLAIM, MOVE UP POINTERS

	ISZ	COMMND	/(35)

	JMP	INEX	/(35)

RECLAI	LAC*	PUTP	/(35)RECLAIM BY MOVING JMP* OVER DNOPE

	DAC*	COMMND	/(35)

INEX	LAC	COMMND	/NOW TO MAKE TURNCATED, ABS, ADDR. FOR

/			/VT-15 DISPLAY INSTRUCTIONS

	TAD	BASE	/ADD IN BASE OF PARTITION

	AND	(17777	/TRUCATE TO DISPLAY SPACE

	DAC	ABSCMM	/AND PLACE IT

	ISZ	INITIT	/MOVE RETURN OVER LENGTH ARGUMENT

	JMP*	INITIT	/OUT!. THIS EXIT IS COMMON WITH EDIT
INEDIT	LAC	ARGCNT	/THIS MUST! BE ZERO FOR EDIT (REPLOT)

	SZA!CLL		/SKIP WHEN OK. CLEAR LINK FOR RTL'S

	JMP	ERR0	/EDIT MUST HAVE EXAXT # OF ARG'S. DIDN'T.

	LAC*	LAST	/GET PROVIDED CNAME, ALWAYS THE LAST ARG.

/			/(35)PICK UP ALL ADDR BITS

	DAC	COMMND	/COMMND IS USED IN COMMN WITH ADDING TYPE OF

/			/CALLS TO POINTS TO TOP OF NEW GROUP

	DAC	CR3	/(37)POINTER FOR USE OF SIZE
	SNA!SPA!IAC	/(38)CNAME MUST BE >0!!
	JMP	ERR3	/(38)IF NOT ARGU ERROR

	DAC	PUTP	/(37)

	IAC		/(37)CR2 AT GROUP +2

	DAC	CR2	/(37)

	JMS	SIZE	/(35)DECODE SIZE OF EXISTING GROUP,

/			/(35)SIZE RETURNED IN AC

	TAD	COMMND	/TO POINT TO NEXT LOC. AFTER OLD GROUP

/ ##########AROUND HERE, CHECK TO SEE EDITTING OVER BAD GROUP

/  LOGIC NOT PUT IN, . . WHICH ASSUMPTIONS TO MAKE??

	DAC	CR1	/RUNNING POINTER TO NEXT LOC

	LAC	(DNOP	/DISPLAY NO-OP'S ARE TO BE ADDED TO AVAILABLE CNT

	SKP		/ENTRY MIDDLE OF LOOP TO COUNT DNOP'S

	ISZ	CR1	/ MOVE POINTER TO NEXT

	SAD*	CR1	/NO- SKP ON FINDING A DNOP

	JMP	.-2	/CONTINUE IN LOOP. COUNT COMES FROM POINTERR

	LAC	CR1	/MAKE -(END+1)  + BEGINNING  +NEEDED AS FIT TEST

	CMA!IAC		/THIS IS -(END+1)  IT WENT ONE BEYOND TO FAIL DNOP

	TAD	COMMND	/  + BEGINNING

	TAD	LENGTH	/   + NUMBER OF LOC.'S NEEDED

	SMA!SZA!CLA	/SKIP IF GOT ENUF. 0 AC FOR EDIT FAIL

	JMP*	RETURN	/ON EDIT FAIL. DON'T CHANGE ANYTHING

	SAD	RUNLT	/IF WE ARE EXECUTING WITH TUBE, MUST ACT

	JMP	INEX	/WERE NOT, SO GO TO COMMON EXIT

	LAC	COMMND	/MAKE A JMP . AT THIS COMMAND GROUP TO HOLD OFF

/			/VT-15 WHILE WE ARE CHANGING THE CODE

	TAD	BASE	/MAKE POINTER TO NEXT GROUP ABSOLUTE

	AND	(17777	/TRUNCATE TO VT-15 ADDRESS SPACE

	TAD	(DJMP	/OP CODE FOR JUMP

	DAC*	COMMND	/PLACE IT

	.IFUND	QEDIT

/ 

/  ALLOW ASSEMBLING OUT RESTART OF DISPLAY FILE ON EACH EDIT

	JMS	SHUNT	/NOW START TUBE AT ITS HALT RESUME SYNC. WE

/			/CAN'T IN GENERAL CASE HAVE TUBE EXECUTING

/			/WITHIN THE SHUNT (SUBROUTINE CALL, CHAR'S, ETC.)

	.ENDC

	JMP	INEX	/NOW CAN GO TO COMMON EXIT FOR INITIT

/

/	NOW THE EXIT ROUTINE

/

EXIT	ISZ	DEFER	/SKIP IF CODE ALREADY IN DISPLAY FILE

	JMS	MOVEIT	/ROUTINE TO GET IT THERE WHEN NOT

	LAC	TYPE	/SEE WHICH KIND WE ARE

	SMA!SZA		/SKIP UNLESS EDIT (REPLOT)

	JMP	EXEDIT	/IT GOES ELESWHERE

	LAC	COMMND	/DIRTY JOB HERE. HAS COMMAND JUST PLACED

			/STRADDLED A ABSOLUTE BANK BOUNDARY?!?

	CMA!IAC		/NEGATIVE RELATIVE ADDR OF TOP

	TAD	PUTP	/PLUS POSITIVE RELATIVE ADDR OF LAST PLACED

	TAD	ABSCMM	/ADD IN 13 BIT ABS. ADDR OF TOP

	AND	(LAW 0	/DID WE CARRY OUT OF THE BANK

	SZA		/SKIP IF OK

	JMP	ERR4	/ERROR EXIT TO SHOW BANK VIOLATION

	LAC*	COMMND	/GET PRIOR END OF FILE(THIS OK IF WE ARE BLANKED)

	JMS	PUT	/AND PLACE AT NEW END

	LAC	CMMTMP	/FINALLY AS LAST STEP. PLACE FIRST COMMAND

	DAC*	COMMND	/OVER THE PREVIOUS JUMP. THIS WAY VT CAN BE LEFT

/			/ON DURING ADDITION TO EITHER MAIN OR SUBP.

	LAC	THSFIL	/(35)UPDATE TOP OF FILE POINTER

	CMA		/(35)SINCE PUTP POINTS 1 BEYOND

	TAD	PUTP	/(35)

	DAC*	THSFIL	/(35) SET

	JMP	EXCMM	/GO TO COMMND EXIT

EXEDIT	LAC	PUTP	/EDIT MUST DNOP FILL ANY REMAINING LOCATIONS

	SAD	CR1	/CR1 POINTER TO NEXT ONE. AFTER AREA TO BE

/			/DNOP'ED

	JMP	EXED1	/ALL DNOPED

	LAC	(DNOP	/MORE TO DO

	JMS	PUT

	JMP	EXEDIT	/GO TO LOOP

EXED1	LAC	CMMTMP	/AS WITH ADDITION. WRITE IN FIRST ONE

	DAC*	COMMND

EXCMM	LAC	ARGCNT	/SEE IF A CNAME MUST BE RETUENRD

OKEX	SZA!CLA!CMA	/SKIP IF YES. SET  UP -1 FOR OK USER RETURN

	JMP*	RETURN

	LAC	COMMND	/(35)POINTER TO EDIT GROUP

	DAC*	LAST	/AND LAST POINTS TO USER VAIBLE

	JMP	OKEX	/COMMND EXIT (AC MUST BE NON0

/

/	OTHER ROUTINES CALLED BY VARIOUS INTERNAL PEOPLE

/

/

/  THE SIZE SUBROUTINE DECIPHIERS THE SIZE OF THE PREVIOUS

/  GROUP FOR A EDIT TYPE OF OPERATION.

/  EDIT #36 IS THIS SUBROUTINE

/

SIZE	0

	LAC*	COMMND	/FIRST MEMBER OF GROUP IN QUESTION

	SAD	(DSKP	/IS IT A SKIP/COUNT TYPE OF GROUP

	JMP	SIZAPP	/YES, FETCH COUNT FROM FOLLOWING LOC

	SAD	(DNOP	/IS GROUP DNOP'ED

	CLL!RAL		/YES, CALL A BASIC VECTOR!!THE DNOP

/			/COUNTER WILL CLEAN THIS UP OK

	AND	(760000	/CHECK FOR JMS*

	SAD	(660000	/WHICH IS EITHER SUBR. OR PARAM JMS LIGHT

	JMP	SIZJMS	/GO FIGURE OUT WHICH
SIZ2	AND	LITNOP	/REDUCE TO 4 BIT OP (LITNOP=740000)
	SAD	(DNOP	/PARAMETER SPECIAL CASE
	JMP	SIZPAR	/GO COUNT PARAMTER BY 'HAND'
	CLL		/(38)ENSURE SHIFT BRINGS IN ZERO'S
	LRS	16	/RIGHT JUSTIFY 4 BITS
	TAD	(SIZETB	/(38)TABLE LOOKUP

	DAC	CR2	/SERVICE LEVEL TEMPORARY
	LAC*	CR2	/(#44)GROUP SIZE IN AC; MOVE SIZTST 1 LOC
SIZTST	SNA!SPA		/SKIP IF LEGAL

	JMP	ERR0	/NO, ERROR OUT

	JMP*	SIZE	/RETURN SIZE IN AC FOR COMPARISON

/

SIZAPP	LAC*	PUTP	/PUTP POINTS TO GROUP+1

	JMP	SIZTST	/REJOIN

/

/

SIZJMS	LAC*	CR2	/GROUP+2

	SAD	HNDLTP	/ADDR OF HANDLER LIGHT PEN REOUTINE

	JMP	SIZXX	/YES, MOVVE POINTER AND DO PARAMTER

	LAC*	COMMND	/NO, RELOAD AC AND REJOIN

	JMP	SIZ2

/

SIZXX	ISZ	CR3	/DJMS* HANDLER LIGHT PEN FOUND

	ISZ	CR3	/MOVE POINTER

SIZPAR	ISZ	CR3	/FETCH NEXT TO SEE IF STILL PARAM

	LAC*	CR3

	SAD	(DNOP	/NOT IF A DNOP

	JMP	SIZND

	SAD	(DNOPB	/NOT IF BEGINNING OF NEXT! PARAM GROUP

	JMP	SIZND

	SAD	(DNOPE	/LAST OF THIS IF END DNOP

	JMP	SIZND1	/ADJUST FOR COUNT OF THIS ONE

	AND	(760000	/CHECK FOR DJMS* LIGHT PEN

	SAD	(660000	/COULD BE; ALSO COULD BE REGULAR DJMS*

	JMP	SIZPJ	/CHECK OUT

	AND	LITNOP	/4 BIT OP FIELD

	SAD	(DNOP	/PARAM

	JMP	SIZPAR	/YES, KEEP GOING

SIZND	SKP!CLA		/0 AC, NO SIZE ADJUST

SIZND1	CLA!CMA		/ADJUST FOR PRESENT INSTRUCT

	TAD	COMMND	/ADDR OF BEGINNING OF GROUP

	CMA!IAC		/MINUS

	TAD	CR3	/PRESENT LOC + GIVING LENGTH

	JMP*	SIZE

/

SIZPJ	LAC	CR3	/ALREADY IN GROUP

	AAC	2	/GET DJMS* +2

	DAC	CR2	/TEMPORARY

	LAC*	CR2

	SAD	HNDLTP	/HANDLER LIGHT PEN CALL?

	JMP	SIZXX	/YES, KEEP CHECKING PARAM GROUP

	JMP	SIZND	/NO, DONE WITH PARAM GROUP

/
SIZETB	0		/SIZE OF GROUP BY OP CODE

/			/0 IS ILLEGAL

	3		/CHAR STRING INDIRECT

	2		/ARB VEC

	2		/POINT INSTRUCTION

	0		/PARAMETER SPECIAL CASE
	6		/SAVE-RESTORE; COPY WITH SAVE-RESTORE
	.IFUND	SHRTAV	/(#44)
	0
	.ENDC		/(#44)
	.IFDEF	SHRTAV	/(#44) NOW LEGAL, SIZE 1
	1		/(#44)
	.ENDC		/(#44)
	0

	1

	0

	0

	0

	0

	3		/DJMS WITHOUT SAVE-RESTORE

	0

	0

/

/	PUT IS USED TO PLACE THE VT-15 INSTRUCTION IN THE DISPLAY FILE

/	EXCEPT THAT THE FIRST ONE IS PLACED IN CMMTMP. PUTCNT

/	IS SET BY SETARG IS -1 TO FORCE THE PLACEMENT IN CMMTMP

/

PUT	0

	ISZ	PUTCNT	/SKIP IF WE ARE TO PLACE IN TEMPORARY

	JMP	PUTPUT	/GO TO REGULAR PLACEMENT

	DAC	CMMTMP	/INTO TEMPORARY

	JMP*	PUT	/THAT'S ALL

PUTPUT	DAC*	PUTP	/POINTS TO INSTRUCTION TO BE PLACED

	ISZ	PUTP	/SO SET UP FOR NEXT ONE.

	JMP*	PUT	/OUT!!

/

/	MOVARG MOVES ALL ARGUMENTS DOWN ONE. THIS WIPES OUT LEADING

/	TYPE ARG. FOR PLOT AND REPLOT, ALLOWING COMMON PROCESSING

/	FOR CODE GENERATION ETC.

/

MOVARG	0

	LAC	(ARG1	/ADDR OF TOP OF LIST

	DAC	T1	/INTO TEMPORARY TO POINTER

	IAC		/TO NEXT ARG

	DAC	T2	/TEMPORARY FOR GETTER POINTER

	ISZ	ARGCNT	/REDUCE (IT IS -) TOTAL COUNT BY 1

	NOP		/IN CASE USER GAVE US PLOT-REPLOT WITH ONLY 1

/			/ARG.!WE WILL CATCH IT LATER. FOR NOW AVOID

/			/SELF-DESTRUCTION.

MOVRG	LAC*	T2	/GET NEXT POINTER

	DAC*	T1	/PLACE ARGUMENT

	SNA		/WHEN HAVE MOVED UP A 0, WERE DONE

	JMP*	MOVARG	/SO LEAVE YET.

	ISZ	T1	/MOVE POINTERS

	ISZ	T2

	JMP	MOVRG	/BACK TO LOOP

/

/	MOVEIT MOVES CODE FROM H1-H6 INTO DISPLAY FILE

/	(35) ASSUME PARAMETER ONLY!!

/

MOVEIT	0

	LAC	(H0	/ADDR OF FIRST INST.

	DAC	T1	/INTO TMPORARY FOR GETTER OINTER

MOVE11	LAC*	T1	/GET IT

	SAD	LITM1	/CHECK FOR END

	JMP	MOVE31	/(35)MORE ACTION

	SZA		/IF ZERO , NOT REAL INSTRUCTION

	JMS	PUT	/USE REFULAR PUT ROUTINE

	ISZ	T1	/MOVE GETTER POINTER

	JMP	MOVE11	/BACK TO LOOP

/

MOVE31	LAC	TYPE	/(35)IF MAIN OR SUB, MAY NEED DNOPE

	SMA!SZA!CLA!CMA!CLL /(35)SKIP IF MAIN, SUB

	JMP*	MOVEIT	/(35)EDIT, SO JUST LEAVE

	TAD	ARGCNT	/(35)ARGCNT IS ZERO IF CNAME

	LAC	(DNOPE	/(35)SET UP TO PLACE IF NECESS. 

	SNL		/(35)ONLY CNAME LEAVE LINK 0

	JMS	PUT	/(35)PLACE DNOPE

	JMP*	MOVEIT	/(35)OUT

/

/	NEW IS THE ROUTINE THAT INTIALIZES DISPLAY FILES

/

/	2

/	ENTRY POINT, CAN BE ANY CONTENT

/	DJMPI	.-1	ABSOLUTE ADDR!!

/

/	THE ROUTINE IS CALLED WITH THE DISPLAY FILE ADDR IN THE AC.

/	AT EXIT, THE AC NOOW POINTER TO THE DJMPI AT FILE END.

/

NEW	0

	DAC	T1	/SAVE FILE ADD

	AAC	2	/MOKE POINTER TO FILE END

	DAC	T2	/AND SAVE IT

	LAC	BASE	/GET BASE ADDR OF PARTITION

	SPA		/MINUS MEANS WE DON'T HAVE IT YET

	JMS	GETBAS	/SO GO GET IT

	TAD	T1	/ADD DISPLAY FILE ADDR

	AND	(17777	/TRUNCATED TO DISPLAY ADDR SPACE 2^13

	TAD	(DJMPI+1  /MAKE DISPLAY JUMP INDIRECT FILE +1

	DAC*	T2	/AND PLACE IT

	LAC	LIT2	/GET A 2 FOR FILE TOP

	DAC*	T1	/AND PLACE IT TOO

	LAC	T2	/NOW EXIT WITH POINTER TO FILE END IN THE AC

	JMP*	NEW

/

/	ROUTINE TO DO CAL TO GET THE BASE ADDR

/	BUT ONLY IF USER MODE, ZERO BASE IF EXEC MODE.

/
VTGL1	0
	DZM	BASE	/IN CASE EXEC MODE, ZERO BASE ADDR.
	CAL	TASKN	/(42)TASKNAME DIRECTIVE GIVES EXEC/NORM
	CAL	WATCAL	/(42)WAIT
	LAC	FEV	/(42)
	SPA		/(42)OK?
	JMP	IOERR	/(42)NO, SYSTEM ERROR
	AND	(40000	/(42)USER MODE BIT
	SNA		/(42)SKIP IF YES
	JMP*	GETBAS	/EXEC MODE EXIT. LEAVE BASE (=0) IN AC.

	CAL	WHERE	/THIS IS THE CAL PARAMETER BLOCK

	CAL	WATCAL	/AND WAIT FO R EVENT TO HAPPEN

	CLX		/ERROR ROUTINE ASSUMES THIS ZERO. CAL COULD

/			/HAVE CHANGED IT.

	LAC	FEV	/GET EVENT VARIABLE

	SPA

	JMP	IOERR	/SYSTEM RATHER THAN GRAPHICS ERROR. GO DO IT

	LAC	BASE	/LEAVE THE BASE ADDR IN AC

	JMP*	GETBAS

/

/	ROUTINE TO GET ADDR OF LIGHT PEN ENABLE ROUTINE

/

VTGL2	0

	LAC	LIT12	/OP CODE TO GET LIGHT PEN ENABLE ROUTINE ADDR

	JMS	DOGET	/CALL GENERALIZED GETTER. GET CODE GOES IN AC

	DAC	HNDLTP	/GET BACK CONTENTS OF FIRST BUFF. LOC IN AC

/			/WANT TO SAVE THAT ADDR. LEAVE IN AC FOR OUR 

	JMP*	GETLTP	/EXIT.

/

DOGET	0		/GENERALIZED GETTER. CALL WITH GET CODE IN AC

/			/RETURNS WITH  FIRST BUFFER LOC CONTENTS IN AC

	DAC	GETTAB	/PUT CODE IN CAL STRUCTURE

	CAL	GETCAL	/CALL THE VT HANDLER

	CAL	WATCAL	/WAIT FOR IT TO ACTUALLY HAPPEN

	CLX		/CLEAR FOR ERROR ROUTINE BENEFIT

	LAC	FEV	/GET EVENT VARIABLE FOR TESTING

	SPA		/SKIP ON OK EVENT VARIABLE

	JMP	IOERR	/GO SHOW SYSTEM ERROR CODE

	LAC	GETBF	/GET CONENTS OF FIRST BUFFER LOC FOR CALLER

	JMP*	DOGET

/

DOPUT	0		/GENERALIZED PUTTER. NO ARG'S PASSED IN AC.

	CAL	PUTCAL	/CALL HANDLER

	CAL	WATCAL	/WAIT FOR HAPPENNING

	CLX		/IN CASE OF ERROR OTHER THAN IOERR LATER...

	LAC	FEV	/GET EVENT VARIABLE FOR CHECKING.

	SPA		/SKIP ON GOOD HAPPENNING

	JMP	IOERR	/GO SHOW IOERROR BY PUTTING EV INTO XR

	JMP*	DOPUT	/THAT'S ALL, BYE

/

/

/

SHUNT	0		/WHEN EDITTING, A SHUNT IS PUT OVER EDITTING SPOT

/			/WE MUST HOWEVER, MAKE SURE PROCESSOR ISN'T

/			/CAUGHT WITHIN! THE CRITICAL AREA. THEREFORE,

/			/CALL HANDLER TO START UP EXISTING MAIN OR

/			/COMMON FILE. THIS WILL START AT THE HALT-

/			/RESUME IN SYNC, GIVING US SAFETY WITH LITTLE

/			/VISUAL DISTURBANCE.

/			/SHUNT MAY NOT TOUVH PR1-PR4

	LAC	RUNLT	/FIND OUT WHICH OF COMMON-MAIN IN RUNNING. IT IS

/			/THE RESPONSIBILY OF CALLER THAT ONE OF THEM IS.

	SAD	LIT3	/BOTH?

	AAC	-1	/YES, PRETEND JUST THE MAIN

	XOR	LIT3	/BITS ARE BACKWARDS FROM HOW WE WANT!SWAP THEM.

	DAC	PUTTAB	/PLACE DOWN DESIRED OP CODE -1(MAIN WANTS TO BE

/			/2 AND COMMON WANTS TO BE 3)

	TAD	CMPNT	/MAKE POINTER TO FILE ADDRESS

	DAC	T1	/PLACE DOWN FOR LAC*

	LAC*	T1	/HERE IS FILE ADDR

	IAC		/NEED FILE+1

	DAC	PUTBF	/PLACE IN PUT CAL FOR HANDLER

	ISZ	PUTTAB	/ADJUST OP CODE TO CORRECT VALUE

	JMS	DOPUT	/GO DO THE PUT TO THE HANDLER

	JMP*	SHUNT

/

/	GENERALIZED CHECKING ROUTINE.

/

/		JMS	CHK

/		LIMIT

/		CONTINUE CODE

/

/	WHERE LIMIT IS THE HIGHEST LEGAL VALUE (>0) FOR ITEM IN AC

/	IT IS ASSUMED THAT THE ITEM IN AC CAN'T BE <0

/	AC IS RESTORED TO ORIGINAL VALUE UPON EXIT FROM ROUTINE

/

CHK	0

	DAC	T1	/SAVE THE ITEM TO BE CHECKED

	SPA!CMA!IAC	/SKIP IF >=0. MAKE MINUS FOR UPPER LIMIT CHK

	JMP	ERR1	/WRONG NUMBER. FOR NOW JUST ERPLOT-PLOT ERROR

	TAD*	CHK	/SUBROUTINE ENTRY POINTS TO NEXT ARG.

	SPA		/EITHER >=0 OK, SINCE WE COMPLEMENTED VALUE.

	JMP	ERR1	/LIKE ABOVE

	ISZ	CHK	/BUMP EXIT POINT BY LIMIT 

	LAC	T1	/BRING BACK ORIGINAL AC

	JMP*	CHK	/BYE

/	ENTRY POINT FOR PLOT CALLS (MAIN FILE ADDITION ROUTINES

/

PLOT	0

	JMS	SETARG	/SET UP ARG. POINTERS IN OUR CODE

	DZM	TYPE	/SHOW THAT WE ARE A PLOT TYPE

PLTRPL	LAC*	ARG1	/GET  WHICH CODE TO ADD TO MAIN (OR REPLOT)

	JMS	CHK	/CHK THIS ARGUMENT FOR VALIDITY

	PLTLIM		/HIGHEST LEGAL DISPATCH#

	TAD	(JMP* PLTDSP	/SET UP DISPATCH TO CORRECT CODE GENERATOR

	DAC	GOTHER	/AND PLACE DISPLATCH INST.

	JMS	MOVARG	/MOVE ALL ARGUMENTS DOWN ONE. SO THAT PLOT

/			/AND REPLOT LOOK LIKE SUBPICTURE CALLS

GOTHER	HLT		/DISPATCH INST. WRITTEN HERE

PLTDSP	COPYCM		/COMON CODE FOR COPY (DISPLAY SUBROUTINE

	LINECM		/COMMON CODE FOR LINE GENERATEION

	PRAMCM		/COMMON CODE FOR PARAMETER GENERATION

	TEXTCM		/COMMON CODE FOR TEXT STRING DISPLAY

	POINCM		/COMMON CODE FOR POINT PLOTTING

	GRPHCM		/COMMON FOR GRAPHING.

	ANYCM		/COMMON FOR USER GENERATED CODE

/

/	ENTRY POINT FOR REPLOT CALLS (EDIT OF PREVIOUS CODE

/

REPLOT	0

	JMS	SETARG	/SET UP POINTER TO USER ARG'S AT ARG1-ARG13

	CLA!IAC		/SET UP TYPE TO SHOW EDITTING

	DAC	TYPE	/

	JMP	PLTRPL	/GO TO PLOT-REPLOT COMMON

/

/		SUBROUTINE FOR PARAMETER CALLS

/

/	IF THE BIT IS SET (WORD OF BITS IN PR1) AC IS RETURNED WITH

/	THE CORESPONDING ARGUMENT. IF ARGUMENT IS NON-0, RETURN AT

/	CALL+1. IF ARGUEMTN 0 RETURN AT CALL+2. IF THE BIT IS 0, RETURN

/	AT CALL+3 WITH AC 0. PR2 IS POINTER TO INSTRUCTION (H1-6)

/	WHICH WE ARE CURRENTLY MODIFYING. WHEN ROUTINE IS CALLED, AC

/	CONTAINS THOSE BITS (IF ANY) RESULTING FROM LAST CALL WHICH MUST

/	BE ADDED IN TO THE INSTRUCTION.

/

PARMC	0

	TAD*	PR2	/ADD IN PREVIOUS BITS TO PRESENT

	DAC*	PR2	/AND REPLACE

	LAC	PR1	/GET BIT PATTERN

	CLL!RAR		/STICK NEXT BIT TO LINK

	DAC	PR1	/AND SAVE REMAINING BITS

	SNL!CLL!CLA	/SKIP WHEN REAL ARGUMENT

	JMP	KICK2	/NOT ONE. BUMP EXIT TO CALL+3

	ISZ	ARGP	/MOVE ORIGINAL POINTER

	LAC*	ARGP	/GET NEXT POINTER

	SNA		/IF ZERO, WE IN TROUBLE, NO MORE ARG.'S

	JMP	ERR0	/RAN OUT OF ARG.'S

	DAC	T1	/ANOTHER INDIRECTION NEEDED

	LAC*	T1	/HERE IS NEXT ARGUMENT

	SNA		/IF ZERO ARGUMENT, BUMP TO CALL+2

KICK1	ISZ	PARMC	/COMMON EXIT FOR KICKERS

	JMP*	PARMC	/OTHER GUY DOES REST OF WORK

KICK2	ISZ	PARMC	/FOR OF TWO KICKS FOR NO  ARGUMENT

	JMP	KICK1	/GO TO DO 2ND BUMP

/

/
PRAMTR	0		/ENTRY POINT FOR SUBPICTURE PARAMTERS

	JMS	SETARG	/DO INITIALIZATION FOR ARGUMENT FETCHING

PRAMCM	DZM	DEFER	/SHOW WE ARE PLACING CODE IN TEMPORARY

	DZM	H0	/(35)SPACE FOR LEADING DNOP

	DZM	H1	/ROUTINE NEED H1-H6 0. OTHER ROUTINES

	DZM	H2	/DON'T CARE.

	DZM	H3	/ A LOOP FOR 6 LOCATIONS??

	DZM	H4

	DZM	H5

	DZM	H6

	DZM	H7	/(35)SPACE FOR TRAILING DNOP

	LAC*	ARG1	/GET ARGUMENT WITH THE PARAMTER BITS

	DAC	PR1	/AND SAVE HERE FOR ROUTINE PARMC

	LAC	(H0	/(35)SET UP POINTERS

	DAC	PR3	/(35)FOR INSTRUCTION PUT-TOGETHER

	IAC		/(35)

	DAC	PR2	/(35)AND FOR REGULAR INSTRUCTIONS

	CLA		/SO FIRST CALL TO PARMC DOESN'T PLACE JUNK

/			/INTO INSTRUCTION BEING BUILT AT H1

	JMS	PARMC	/GET FIRST BIT

	AND	(17	/ONLY FOUR BITS OF SCLAE. RETURN HERE SAID WE

/			/HAD A CHANGE TO A NON ZERO SCALE

	AAC	20	/ENABLE BIT FOR SCALE CHANGE. RETURN HERE SAYS

/			/WE ARE CHANGING TO ZERO SCALE

	JMS	PARMC	/HERE WHEN TO SCALE CHANGE. PUT DOWN SCALE

/			/IF ANY, AND GET INTENSITY.

	JMP	FIX1	/MORE THAN 1 INSTRUCTION NEEDED FOR INTENSITY

FIX1R	TAD	(2000	/ENABLE BIT FOR INTENSITY

	JMS	PARMC	/PUT DOWN INTENSITY, GET LIGHT PEN

	JMP	FIX2	/ALSO EXTRA INSTRUCTIONS NEEDED FOR LIGHT PEN

	AAC	10	/ENALBE LIGHT PEN CHANGE

FIX2R	ISZ	PR2	/MOVE POINTER FOR PLACEMENT IN 2ND INSTRUCTION

	JMS	PARMC	/DOWN LIGHT PEN, UP WITH BLINK

	LAC	(400	/TURN ON BLOCK BIT

	TAD	(1000	/ENABLE BLINK CHANGE BIT

	JMS	PARMC	/DOWN BLICNK GET THE DASH

	AND	LIT3	/ONLY LOW THREE BITS NEEDDED

	AAC	4	/DASH CHANGE ENABLE BIT

	DAC	H3	/THIS ONE IS OUT OF ORDER, PLACE BY HAND

	CLA		/!!!!!OTHER WISE RANDOM BITS WILL BE PLACED IN

/			/THE SENCOND PARAMETER INSTRUCTIN WE'RE

/			/IN THE PROCESS OF BUILDING,

	JMS	PARMC	/GO TO GET OFFSET

	CLA!IAC		/OFFSET ON BIT

	AAC	2	/OFFSET CHANGE ENABLE BIT

	JMS	PARMC	/DOWN WITH OFFSET, GET ROTATE

	LAC	(20	/ROTATE ON BIT

	AAC	40	/ROTATE CHANGE ENABLE BIT

	JMS	PARMC	/FINISH BITS FOR PARAMETER II. GET NAME

	AND	(177	/ONLY LOW 7 BITS NEEDED

	TAD	(400	/ENABLE NAME CHANGE BIT

	ISZ	PR2	/MOVE POINTER TO FIFTH INSTRUCTION

	ISZ	PR2

	ISZ	PR2

	JMS	PARMC	/PLACE THESE BITS. REMOVE SYNC ARGUMENT (WE

/			/DON'T LET USER HANDLE SYNC!!) IF PRESENT

LITSKP	SKP		/TO REJOIN ALL POSSIBLE EXITS
LITNOP	NOP		/ALSO USE AS LITERALS

/

/	AT THIS POINT ALL BITS ARE IN INSTURCTIONS. WE HAVE TO ADD OP 

/	CODES, AND. COUNT NUMBER OF REAL (NON0) INSTRUCTIONS IN CASE

/	WE ARE EDITTING (REPLOTTING)

/

	LAC	TYPE	/(35)SEPARATE EDIT FROM SUB-MAIN

	SNA!SPA!CLA!CMA	/(35)SKIP ON EDIT
	JMP	PARN2	/(35)SUB+MAIN HAVE NO LEADING DNOP
	LAC*	ARG1	/(39)WHILE WE'RE HERE, IS THIS A NULL CALL?
	AND	(377	/(39)SOME OF THESE BITS SHOULD BE ON
	SNA		/(39)SKIP IF OK
	JMP*	RETURN	/(39)NO EDIT
/
	LAC*	LAST	/(39)SET UP COMMND EARLY !!
	DAC	COMMND	/(39)SINCE NOT USUALLY DONE UNTIL INITIT
	AAC	-1	/(39)POINTER TO GROUP-1
	DAC	PR5	/(39)
	AAC	3	/(39)GROUP+2 IN CASE DJMS*
	DAC	PR4	/(35)

	LAC*	COMMND	/(35)CHECK PREVIOUS GROUP FOR PARAM

	SAD	(DNOPB	/(35) STARTIN WITH BEGIN DNOP

	JMP	PARN1	/(35) PREVOUS PARAM HAS DNOP NO SPECIAL

	SAD	(DSKP	/(35)GRAPH, ANY WITH LEADING COUNT

	JMP	PARN1	/(35) NO SPECIAL

	SAD	(DNOP	/(35)NOT A PARAMETER BUT NOP'ED GROUP

	JMP	PARN1	/(35) SO NOT SPECIAL

	AND	(760000	/(35) CHECK FOR DJMS*

	SAD	(660000	/(35)

	JMP	PARN19	/(35)YUP, SEE IF IT IS TO LIGT PEN

PARN11	AND	LITNOP	/(35) AND (740000

	SAD	(DNOP	/(35) IS IT A PARAMETER

	JMP	PARN2	/(35) YES, DON'T!! NEED DNOPB

PARN1	LAC*	PR5	/(35) NOW CHECK PREVIOUS GROUP

	SAD	(DNOP	/(35)	PREVVIOUS GROUP TERMINATE DNOP, OK

	JMP	PARN2	/(35) SO NO DNOPB NEEDED

	SAD	(DNOPE	/(35) AND IF DNOPE TERMINATES

	JMP	PARN2	/(35) STILL OK
	SAD	HNDLTP	/(41) BUT IF CALL TO LIGHT PEN

	JMP	PARN12	/(35) NOT OK, NEED DNOPB

	AND	LITNOP	/(35)AND 740000  CHECK OTHER PARAMTER

	SAD	(DNOP	/(35) IF IT IS, SET UP DNOPB

PARN12	ISZ	H0	/(35) DNOPB SETUP

PARN2	LAC	PR1	/IF ANY FEATURE BITS LEFT, WE'RE INTROUBLE

	SZA		/SKIP IF NONE LEFT

	JMP	ERR2	/GO TO FUNNY FEATURE BIT ERROR

	LAC	(LITLST	/ADDR OF LIST OF OP CODE LITERALS

	DAC	PR2

DPOPS	LAC*	PR3	/GET INSTRUCTION

	SAD	LITM1	/END IF POINTER HAS -1 BLOCK

	JMP	OKNOW	/KEEP GOING WITH OTHER TASKS

	SNA		/SKIP IF INSTRUCTION REALLY NEEDED

	JMP	DPOPS1	/IT ISN'T

	TAD*	PR2	/ADD IN OP CODE

	DAC*	PR3	/REPLACE INSTRUCTION

	ISZ	LENGTH	/COUNT IT IN LENGTH OF GROUP COUNTER

DPOPS1	ISZ	PR3	/MOVE POINTERS

	ISZ	PR2

	JMP	DPOPS	/BACK TO LOOP
OKNOW	LAC	H4	/(35)IS A LIGHT PEN CALL THERE?
	SZA		/(39)SKIP IF NOT
	TAD	LENGTH	/(40)POINT TO ENDOF GROUP
	DAC	H4	/(39)REPLACING 0 OR POINTER
/
OKNOW1	LAC	TYPE	/(35) EDIT MUST CHECK DNOPE

	SNA!SPA		/(35) SKIP IF EDIT

	JMP	PARN4	/(35) MAIN AND SUB DO NOTHING

	LAC	LENGTH	/(35) MAKE POINTER TO GROUPEND+1

	TAD	COMMND	/(35)

	DAC	PR5	/(35)

	AAC	2	/(35)TO GROUP+2 IN CASE DJMS*

	DAC	PR4	/(35)

	LAC*	PR5	/(35)WHAT MUST INTERFACE TO NEW GROUP??

	SAD	(DNOPB	/(35) DOES IT HAVVE DNOP PROTECTION

	JMP	PARN4	/(35) YES, WE DON'T NEED IT

	SAD	(DNOP	/(35) IS IT DNOP'ED

	JMP	PARN4	/(35) YES, NO PROTECTION EITHER

	AND	(760000	/(35) CHECK FOR CALL TO LIGHT PEN

	SAD	(660000	/(35) IS IT DJMS*

	JMP	PARN39	/(35) YES, FURTHER CHECKING

	AND	LITNOP	/(35) AND 740000 CHECK FOR PARAM

	SAD	(DNOP	/(35) OTHER PARAM, WE NEED CHECKING

	SKP		/(35)

	JMP	PARN4	/(35) NO CHECK ING NEEDED
PARN34	LAC	(DNOPE	/(35) PLACE DNOPE DIRECTLY
	DAC	H7	/(39)
	ISZ	LENGTH	/(35) MOVE COUNTER BY ONE

PARN4	LAC	(ARG1	/WE MUST SEND IN AC TO INITIT # OF FEATURES+2

	CMA!IAC		/SUBTRACT OFF ORIGINAL POINTER

	TAD	ARGP	/FROM PRESENT TO GIVE #. EXTRA 2; ONE IS FEATURE

	AAC	2	/BITS WORD, OTHER SINCE WE GIVE # OF ARG.'S +1.

	CLL!RAL		/*2 FOR INITIT. NO ARG DEFAULT ALLOWED.

	JMS	INITIT	/GO INTIALIZE DISPLAY FILE ADDRESSING
LENGTH	0		/(35) CONVENIENT HERE
	LAC	H4	/(39)CALL TO LIGHT PEN?
	SZA		/(39)SKIP IF NO
	TAD	ABSCMM	/(39)ABSOLUTE 13 BIT GROUP ADDR FOR INSTR
	DAC	H4	/(39)RETURNING 0 OR FULL INSTR.
	LAC*	ARG1	/(39)CHECK OUT NULL CALL FOR SUB+MAIN
	AND	(377	/(39)MUST HAVE ONE OF THESE ON
	SZA		/(39)SKIP IF A PROBLEM
	JMP	EXIT	/(39)NO PROBLEM, GO TO FINAL CODE
	SAD	ARGCNT	/(39)PROVIDED CNAME
	DZM*	LAST	/(39)0 INTO CNAME !!!!
	JMP*	RETURN	/(39)EXIT WITH NO DISPLAY FILE MOD.
/

LITLST	DNOPB-1		/(35) LEADING DNOP

	200000		/OP CODE FIRST ONE

	210000

	220000
	657776		/(40)DJMS-2; 1 FOR H4=1; 1 FOR LENGTH -1!
	234000

LIT0	0		/ADD NOTHING TO ADDRESS!

/

PARN19	LAC*	PR4	/(35)WAS DJMS* TO LIGHTPEN?

	SAD	HNDLTP	/(35)

	JMP	PARN2	/(35)YES, PARAM INST, NO DNOPB

	JMP	PARN1	/(35)NO, POSSIBLE DNOPB, GO CHECK

/

PARN39	LAC*	PR4	/(35)WAS DJMS* TO LIGHTPEN

	SAD	HNDLTP	/(35)

	JMP	PARN34	/(35)YES, PARAM, NEED DNOPE

	JMP	PARN4	/(35)NO, DON'T NEED DNOPE MARKER

/

/

/

FIX1	AND	LIT7	/ONLY THREE BITS OF INTENSITY

	CLL!SWHA	/HAVE TO MOVE TO PLACE

	RTR

	JMP	FIX1R	/REJOIN MAIN LINE

FIX2	ISZ	H4	/SHOW WE HAVE TO PUT IN JMS*

	LAC	(1000	/?? UNCONDITIONAL SKIP BIT 

	DAC	H5

	LAC	HNDLTP	/GET ADDR FOR LIGHT PEN ENABLER IN HANDLER

/			/(35)HNDLTP ALWAYS THERE

	DAC	H6	/AND PUT IT DOWN

	CLA		/!!SO EXTRANEOUS BITS DON'T GO TO WORD 2!!

	JMP	FIX2R	/REJOIN MAIN LINE

/

/

/	SUBROUTINE TO PLACE A POINT (INTENSITY OPTIONAL) IN SUBPICT.

/

POINT	0		/ENTRY POINT

	JMS	SETARG	/INIT. ARGUMENT FETCHING ETC.

POINCM	LAC	LIT11	/2*(3 ARG.'S+1)+ALLOWABLE DEFAULT ON INT.

	JMS	INITIT	/INIT. DISPLAY FIE ADDRESSING

LIT2	2		/2 DISPLAY INSTRUCTIONS, ALSO LITERAL

	LAC	ARG3	/SEE IF 3RD ARG IS PRESENT

	SZA		/SKIP WHEN NOT

	LAC*	ARG3	/GET INTENSITY ARGUMENT

	SZA		/SKIP WHEN ZERO, NOT INTENSIFIED

	LAC	(INT	/GET INTENSITY BIT

	DAC	PR1	/SAVE THAT HERE

	JMP	PTCOM	/FINISH UP IN COMMON WITH SETPT'S

/

/

/	NOW THE TRADITIONAL SETPT CODE

/

SETPT	0

	JMS	SETARG	/INIT

	DZM	TYPE	/MAINFILE ONLY

SETCM	LAC	LIT6	/2 ARG.'S, NO DEFAULT ALLOWED.

	JMS	INITIT	/SET UP FILE ADDRESSING

	2		/TWO COMMANDS PLACED FOR EDIT PURPOSES

	DZM	PR1	/NEVEN INTENSIFIED

PTCOM	LAC*	ARG2	/GET Y. OPTIONAL POINT CODE JOINS HERE

	AND	(1777	/TRUNCATE TO TEN BITS

	XOR	(PY	/AND THE OP CODE

	JMS	PUT	/GO TO PLACE IN DISPLAY FILE

	LAC*	ARG1	/GET X POINT

	AND	(1777	/AGAIN ZAP EXTRA BITS

	XOR	(PX	/X POINT OP CODE

	XOR	PR1	/INTENSITY, IF ANY

	JMS	PUT	/DOWN IT GOES

	JMP	EXIT	/ROUTINE TO FINISH US UP

/

/	ENTRY FOR EDITTING TRADITIONAL POINTS

/

RSETPT	0

	JMS	SETARG	/INIT ALL SORTS OF GOODIES

	CLA!IAC		/SHOW WE'RE AN EDIT

	DAC	TYPE

	JMP	SETCM	/JOIN OTHER TRADITIONAL POINT CODE

/

CMGRAN	0		/COMMON SETUP GRAPH AND ANY

/			/(35) COUNT ALWAYS IN HEADR

	LAC	ARG2	/SEE IF ARG. INITIT HAS NOT YET HELPED US OUT

	SNA		/HAS TO BE ONE

	JMP	ERR0	/ARGUMENT SPECIFICATION ERROR

	LAC*	ARG2	/GET NUMBER OF POINTS TO BE PLACED

	SNA!SPA!CMA!IAC	/MUST BE >0. MAKE - FOR LOOP CONTROL

	JMP	ERR5	/USER INCORRECT CONTROL COUNT ERROR

	DAC	PR2	/SAVE THAT HERE FOR LATER

	LAC*	ARG2	/(35) COUNT+2 FOR TOTAL LENGTH

	AAC	2	/(35)

	JMP*	CMGRAN	/LEAVE COUNT IN AC

/

/	TO PROCESS CALL TO GRAPH POINTS

/

GRAPH	0

	JMS	SETARG	/SET UP ARG POINTERS ETC.

GRPHCM	JMS	CMGRAN	/COMMON SETUP BETWEEN GRAPH AND ANY

	DAC	GRARG	/PLACE USE COUNT FOR DISPLAY FILE FOR INITIT

	LAC	LIT11	/3 ARG.'S WITH POSSIBLE DEFAULT.

	JMS	INITIT	/GO SET UP FILE POINTER ETC.

GRARG	0		/CORRECT LENGTH WRITTEN IN HERE

	LAC	ARG3	/SEE IF ARGUMENT PRESENT

	SZA		/SKIP WHEN NOT

	LAC*	ARG3	/GET 3RD ARG, WHICH IS WHICH AXIS

	SZA		/0 IS X AXIS, I.E. Y VS X PLOT

	LAC	(4000	/FLIP BACK TO Y AXIS

	XOR	(GY	/GRAPH Y COMMNAD

	DAC	PR1	/SAVE BASIC OP CODE

/			/(35)HEADR ALWAYS PLACED

	LAC	(DSKP	/SKIP OVER THE ACTUAL COUNT

	JMS	PUT	/PLACE INST. IN FILE

	LAC	LENGTH	/NAD HERE IS THE REAL COUNT (INCLUDING HEADER)

	JMS	PUT	/AND PLACE IT IN THE FILE.

GRPHL	LAC*	ARG1	/GET A DATA POINT

	AND	(1777	/STRIP TO 10 BITS

	XOR	PR1	/PLACE OP CODE

	JMS	PUT	/PLACE INST. IN DISPLAY FILE

	ISZ	ARG1	/MOVE POINTER THRU ARRAY

	ISZ	PR2	/LOOP CONTROL

	JMP	GRPHL	/RETURN TO LOOP

	JMP	EXIT	/GO TO DO END PROCESSING

/

/	AND THE CALL FOR USER PROVIDED CODE

/

ANY	0

	JMS	SETARG	/S UP EVERYTHING

ANYCM	JMS	CMGRAN	/COMMON SETUP WITH GRAPH

	DAC	ANARG	/PLACE CORE USAGE COUNT FOR CALL TO INITIT

	LAC	LIT6	/ARGUMENT COUNT FOR USER SUBROUTINE CALL

	JMS	INITIT	/COMMON SETUP FOR CODE PLACEMENT

ANARG	0		/COUNT OF LOCATIONS NEEDED PLACED HERE

/			/(35) HEADR ALWAYS PLACED

/
/
/	(38) ALLOW CNAME WITH ANY SINCE HEADR GIVES COUNT!!
	LAC	(DSKP	/GET DISPLAY SKIP INSTRUCTION

	JMS	PUT	/GO PLACE IN DISPLAY FILE

	LAC	LENGTH	/GET TOTAL COUNT (INITIT PLACED IN LENGTH)

	JMS	PUT	/FOR PLACEMENT IN BOOKKEEPING HEADER

ANYL	LAC*	ARG1	/ITEM FROM USER'S ARRAY

	JMS	PUT	/JUST TRANSFER TO DISPLAY FILE

	ISZ	ARG1	/MOVE POINTER TO NEXT ITEM

	ISZ	PR2	/DONE (CMGRAN SET UP CONTROL COUNT FOR US)

	JMP	ANYL	/NOPE, GO DO MORE

	JMP	EXIT	/GO TO COMMON FINISH UP CODE

/

/

/SUBROUTINE CALL WITH THE DISPLAY ROUTINE

/

COPY	0

	JMS	SETARG

COPYCM	LAC*	ARG1	/SEE IF WITH RESTORE OPTION

	SZA!CLA		/SKIP IF NOT

	AAC	3	/SIZE 3 WHEN NOT, 6 WHEN

	AAC	3

	DAC	CPYCLL	/PLACE IN CALL

	LAC	LIT6	/2 ARG.'S CANNOT DEFAULT ONE.

	JMS	INITIT	/GO SET UP DISPLAY FILES ETC.

CPYCLL	0		/PLACE LENGTH HERE

	LAC*	ARG1	/SPLIT ON TYPE OF COPY

	SZA		/SKIP ON SIMPLE ONE

	JMP	CPYRST	/GO DO WITH RESTORE

	LAC	ABSCMM	/GET 13 BIT ABSOLUTE ADDR OF COMAND GROUP

	TAD	(DJMSI+2 /MAKE DISPLAY SUBROUTINE INDIRECT TO

/			/COMMAND GROUP +2

	JMS	PUT

	LAC	(DSKP	/ DISPLAY SKIP

	JMS	PUT

	LAC	ARG2	/GET FILE TO BE CALLED

	IAC		/NEED FILE+1

	TAD	BASE	/NEED ABSOLJTE ADDR

	JMS	PUT	/PLACE IT TOO

	JMP	EXIT	/BYE

/

CPYRST	LAC	ABSCMM	/GET ABSOLUTE 13 BIT ADDR

	TAD	(SAVE+4	/SAVE TO GROUP+4

	JMS	PUT

	TAD	(DJMSI-SAVE-1	/TOMAKE DJMSI GROUP+3

/			/THESE FUNNY LITERALS SO DON'T HAVE TO KEEP

/			/LOADING ABSCMM EACH TIME.

	JMS	PUT

	TAD	(DJMP-DJMSI+2	/TO MAKE DJMP GROUP+5

	JMS	PUT

	LAC	ARG2	/GET DISPLAY FILE TO BE CALLED

	IAC		/REALLY WANT FILE+1

	TAD	BASE	/AND REALLY WNAT ABSOLUTE ADDR

	JMS	PUT

	ISZ	PUTP	/MOVE POINTER OVER SAVE-RESTORE WORD. BUT DON'T

			/CHANGE IN CASE WE EDITTING OVER IDENTICAL

			/GROUP, IN WHICH CASE VT-15 CAN NEED THIS. 

/			/I.E. IT MAKES SUBROUTINE CALL, WE COME AND GO,

/			/AND THEN IT RETURNS FROM SUBROUTINE, AND WANTS

/			/SAVE-RESTORE WORD.

	LAC	ABSCMM	/ABSOLUTE TOP OF GROUP ADDR

	TAD	(RSTR+4	/RESTORE FROM GROUP+4

	JMS	PUT	/

	JMP	EXIT	/FINALLY

/

/	SUBROUTINE TO GENERATE COMMANDS FOR A LINE

/	IF INTENSITY ARGUMENT IS MISSING, LINE IS INTENSIFIED.

/	SOFTWARE APPROXIMATION OF LINES WHEN NO RANDOM VECTOR

/	HARDWARE IS NOT DONE.

/

LINE	0

	JMS	SETARG	/SET UP RETURN, ARGUMENTS TO ARG1---
LINECM	LAC	ARGCNT	/(#44)USUALLY INITIT CHECKS ARGUMENT COUNTS ETC.

/			/HERE WE HAVE TO DO WORK BEFORE INITIT

	AAC	2	/SO WE HAVE TO CHECK. ARGCNT HAS - COUNT

	SZA!SMA		/SKIP WHEN >=2 ARG.'S

	JMP	ERR0	/TOO FEW, COMPLAIN

	SZA!IAC		/IF ONLY TWO ARG'S, DON'T LAC*, SET INT.

	LAC*	ARG3	/GET IT, IT WAS THERE

	SZA		/WHEN ARGUMENT ZERO, NOT INTENSIFIED

	LAC	(INT	/GET INTENSITY BIT FOR WHEN WE NEED IT

	DAC	PR2	/SAVE INTENSITY HERE, FOR MAKING UP THE CODE

	LAC*	ARG1	/GO GET DX

	CLL!CML!SPA	/SET UP ABSOLUTE QUANT. IN AC. LINK 1 WHEN +.

	CLL!CMA!IAC	/AND LINK 0 WHEN -.

	AND	(1777	/TRUNCATE TO TEN BITS!!

	SNA		/SKIP IF THERE IS REALLY A DX

	JMP	LX0	/NO DX. A PRIMARY DIRECTION LINE

	DAC	PR3	/SAVE THE DX, ASSUME FOR NOW WE HAVE TO DO A

/			/STORK VECTOR, SO DO IT

	JMS	LSUB	/THIS GUY PUT IN OP CODE, SIGN INTENSITY

	DAC	PR4	/PLACE THE FIRST STROKE

	SNL!CLA!CMA	/TO SET UP PR1 -1 WHEN X+, 0 WHEN MINUS

	CLA

	DAC	PR1	/THIS IS IN CASE WE HAVE A PRIMARY LINE, AND

/			/HAVE TO MAKE UP THE 3 BIT DIRECTION FIELD

	LAC*	ARG2	/GO GET DY

	CLL!CML!SPA	/SAME PAIR AS ABLOVE ABS. IN AC LINK 1 WHEN

	CLL!CMA!IAC	/ORIGINAL QUANTITY +, 0 WHEN -.

	AND	(1777	/TRUNCATE AGAIN

	SAD	PR3	/IF DX(ABS)=DY(ABS) PRIMARY DIAGONAL LINE

	JMP	LDIAG	/YUP

	SNA		/SKIP IF DY NOT ZERO

	JMP	LY0	/PRIMARY LINE WITH DY = 0

	JMS	LSUB	/NOW FOR SURE WE HAVE STROKE VECTOR, PLACE
	DAC	PR5	/IN SECOND LOCATION
/
/  BEGIN SECTION OF EDIT #44
/
	.IFDEF	SHRTAV
/
/  ENTER HERE WITH PR5 IN AC, AND COMPLEMENT OF SIGN
/  OF DY IN THE LINK.
/
	AND	(1740	/CHECK HIGH BITS OF DY TO SEE IF SHORT A.V.
	TAD	PR4	/COMBINE CHECK WITH HIGH BITS OF DX
	AND	(3740	/WORKS ONLY BECAUSE BIT 2000 OF PR4=0
	SZA!CML		/SKIP IF CAN SHORT A.V.;LINK=SIGN DY
	.ENDC
	JMP	LINTWO	/NO SHORT A.V.;GO DO REGULAR A.V.
	.IFDEF	SHRTAV
	LAC	PR4	/SET TO PUT MAG X,SIGN Y INTO BITS 7-12
	ALS	6	/0'S IN BITS 1-6, JUNK IN OTHER BITS
	XOR	PR4	/OP,SIGN X,INT INTO BITS 1-6;7-12  OK!!
	XOR	PR5	/MERGE IN MAG Y INTO 13-17
	AND	(177740	/ALSO CLEAR JUNK BIT 0
	XOR	PR5	/THE DOUBLE XOR MERGE IS GENERAL
	TAD	(200000	/CHANGE OP CODE FROM 10 TO 30
	JMP	LINONE	/FINISH UP IN COMMON WITH BASIC VECT.
	.ENDC
/
/  END SECTION OF EDIT #44
/
/	THE FOLLOWING CODE IS THE CAL'S AND BUFFER FOR ERROR MSG.

/  SOME OF THE LINE SUBROUTINES WILL OCCUR IN THE BUFFER, AND

/  SOME OF THE LITERALS WILL OCCUR IN THE CAL'S.

/

WHO	25		/TO RETURN TASK NAME IN SIXBIT AT WHO+2,+3

	0		/NO EVENT VARIABLE FOR THIS ONE

LIT6	6		/NAME RETURNED HERE

LIT7	7		/AND HERE

/

TYPEIT	2700		/TYPE OUT ERROR MESSAGE

	FEV		/EVENT VARIABLE

	2		/LUN. IS 2 RIGHT??

	3		/IMAGE MODE, 1 CHAR PER WORD

	ERBF		/POINTER TO ERROR BUFFER

ERBF	26003		/26 WORD PAIRS, IMAGE MODE

	0		/EXTRA 0 FOR SOMETHING

	52		/*

	52		/*

	52		/*

	40		/SPACE

	42		/"

LSUB	0		/TASK NAME IS WRITTEN OVER THIS SUBROUTINE

	XOR	(STROK	/HERE IS OP CODE

	SNL		/REMEMBER SIGN SAVED IN LINK

	XOR	(4000	/HERE IS MINUS BIT

	XOR	PR2	/HERE IS INTENSITY IF ANY

	JMP*	LSUB	/THAT'S IT

	42		/"

	40		/MESSAGE STILL, HERE IS SPACE

VPRDYS	126		/V

	120		/P

	122		/R

	40		/SPACE

	101		/A

LITD	104		/D

	104		/D

	122		/R  ADDRESS OF CALL

	40		/SPACE

LDIAG	TAD	(2000	/ADDRESS OF USER CALL PLACED IN ERROR

/			/MSG. OVER THIS. DIAGONAL PRIMIARY LINE

/			/SHOW ODD DIRECTIONS WITH 2000

	SNL		/SKIP WHEN Y +

	TAD	(14000	/DIRECTION TO 7 FOR +X,-Y

	ISZ	PR1	/SKIP WHEN X REALLY WAS +

	XOR	(4000	/-X. FOR -Y CHANGES 7 TO 5;FOR +Y 1 TO 3

	JMP	LC2	/REJOIN MAIN PRIMIARY VECTOR LINE OF CODE

	40		/MESSAGE CONTINUES, SPACE

	103		/C

	117		/O

	104		/D

	105		/E  ERROR CODE

	40		/SPACE

LY0	LAC	PR3	/CODE WRITTEN OVER 4 CODE LOC'S

/			/AND FOLLOWING TWO LIT.'S.

/			/DY=0, GET DX

	ISZ	PR1	/SKIP WHEN X +, LEAVING DIRECTION CODE 0

	TAD	(10000	/DX WAS MINUS, MAKE A DIRECTION CODE OF FOUR

	JMP	LC2	/REJOIN MAIN PRIMARY CODE LINE.

LIT4	4		/PUT A RANDOM LITERAL HERE

LIT11	11		/AND HERE, TO FILL OUT 6 LOC'S FOR CODE

LIT15	15		/CARRIAGE RETURN

LIT12	12		/LINE FEED

/			/END OF ERROR MESSAGE

/

/

LX0	LAC*	ARG2	/PRIMARY LINE DX=0, GET DY

/			/THIS AND NEXT USED AS TEMPORARIES BY ERROR

/			/MESSAGE GENERATING CODE

LX1	CLL!CML!SPA	/SEE COMMENTS ABOVE

	CLL!CMA!IAC

	AND	(1777	/REDUCE TO 10 BITS

	SNA		/SKIP IF NON0

	JMP*	RETURN	/????OLD PACKAGE DID NOTHING ON DX=DY=0

/			/WILL DO SAME HERE-- DON'T LIKE IT

	TAD	(4000	/DX=0 HAS DIRECTION CODE 2 OR 6. BITS ARE

/			/SHIFTED TO 4000=2

	SNL		/SKIP ON POSITIVE DY

	TAD	(10000	/NEGATIVE, CHANGE CODE TO 6
LC2	TAD	(400000	/HERE IS PRIMARY LINE OP CODE
	TAD	PR2	/AND INTENSITY IF ANY
/
/  BEGIN SECTION OF EDIT #44
/
LINONE	DAC	PR4	/END OF SINGLE COMMAND LINE CODE
	DZM	PR5	/SIGNAL ONLY ONE COMMAND
	SKP!CLA!IAC	/ONE COMMAND ARGUMENT FOR INITIT
LINTWO	LAC	LIT2	/TWO COMMAND ARGUMENT FOR INITIT
	DAC	LNCLL	/AT CALL + 1
	LAC	LIT11	/3 ARG'S, CAN DEFAULT LAST ONE
	JMS	INITIT	/DISPLAY FILE SETUP
LNCLL	0		/REAL LENGTH PUT HERE
	LAC	PR4	/GET FIRST INSTR
	JMS	PUT	/TO DISPLAY FILE
	LAC	PR5	/GET POSSIBLE SECOND ONE
	SZA		/SKIP IF NOT ONE
	JMS	PUT	/TO DISPLAY, THERE WAS ONE
	JMP	EXIT	/THIS GUY CLEANS UP
/
/  END OF SECTION OF EDIT #44
/
/
/
/	CODE TO BLANK AND UNBLANK DISPLAY FILE. BOTH OPERATIONS

/ CONSIST OF SWAPPING INSTRUCTIONS AT END OF FILE AND FILE+2.

/ THUS WHEN THE VT-15 ENTERS THE BLANK'ED FILE, IT HITS JMP*

/ AND IMMEDIATELY EXITS. THE UNBLNK OPERATIONS SIMPLY RESTORES

/ THE ORGINAL. A JMP* ALREADY IN DESTINATION WILL PREVENT 

/  THE SWAP FROM OCCURRING FOR EITHER BLANK OR UNBLNK.

/

BLANK	0

	JMS	SETARG	/SET UP ARGUMENTS, RETURN, COUNTS, ETC.

BLNKCM	LAC	ARG1	/COMMON WITH UNBLNK

	SNA		/CHECK IF AN ARGUMENT AT ALL

/		###?? THINK THIS SAYS THAT THE BLANKED FILE

/ CANNOT BEGIN AT RELATIVE ZERO OF THE PARTITION!!! ######

/

	JMP	ERR0	/NOPE, GET OUT OF HERE

	AAC	2	/NOW HAVE POINTER TO FILE+2

	DAC	PR1	/PUT IN TWO PLACES, ONE WILL BE OVER-WRITEN

	DAC	PR2	/LATER

	AAC	-2	/MOVE POINTER BACK TO TOP

	TAD*	ARG1	/ADD IN TOP OF FILE POINTER TO POINT TO END

/

/  AT THIS POINT WE WANT TO PUT THE POINTER TO THE JMP* IN PR2

/   AND THE POINTER TO THE OTHER INSTRUCTIN IN PR1

	SZL		/SKIP NEXT INSTRUCTION WHEN WE'RE A  BLANK

	DAC	PR1	/WE'RE AN UNBLNK. JMP POINTER IN PR1

	SNL		/SKIP NEXT WHEN WE'RE AN UNBLNK

	DAC	PR2	/WE'RE A BLANK. JMP POINTER IN PR2

	LAC*	PR1	/GET NON-JUMP

	DAC	PR3	/AND SAVE IN TEMPORARY

	AND	(LAW 0	/CHECK TO SEE IF ALREADY A JUMP

	SAD	(DJMPI	/IF IT IS. WE HAVE NO WORK TO DO

	JMP*	RETURN	/ AND WILL JUST GET OUT

	LAC*	PR2	/GET JUMP*

	DAC*	PR1	/AND PUT ON OTHER END. THIS IS THE "SAFE"

/  TRANSITION STATE. A JUMP* AT BOTH ENDS RATHER THAN NEITHER.

	LAC	RUNLT	/FIND OUT IF VT-15 IS RUNNING

	SZA!SNL		/SKIP PROCESSOR SHUT DOWN IF UNBLNK,

/   OR IF THE PROCESSOR ISN'T RUNNING (AC=0)

	JMS	SHUNT	/RESTART PROCESSOR AT TOP SO WE CAN'T CATCH

/  IT IN THE TRAP OF OUR FILE, AND THEN LET IT OUT BOTTOM.

	LAC	PR3	/GET OTHER INTRUCTION FROM ITS HIDING PLACE

	DAC*	PR2	/AND PLACE IT OVER THE OLD JUMP.

/

	JMP*	RETURN	/EXIT.

/

/	ENTRY POINT FOR UNBLNK

/

UNBLNK	0

	JMS	SETARG	/DO ALL GOOD STUFF AT BEGINNING

	CLL!CML		/SET LINK TO SAY WE'RE UNBLNK

	JMP	BLNKCM	/AND REJOIN OTHER CODE

/

/	ROUTINE TO REPLACE COMMAND GROUP BY NO-OPS

/

DELETE	0

	JMS	SETARG	/INITIALIZE

	CLA!IAC		/VERY DIRTY. WE WILL TELL SERVICE ROUTINES

/			/WE ARE GONG TO DO AN EDIT REQUIRING 1 LOC

/			/AND NO ARG'S PRIOR TO CNAME

	DAC	TYPE	/SAY WE'RE AN EDIT

	CLL!RAL		/(=2)0 ARG.'S PRIOR TO FILE INFO.

	JMS	INITIT	/GO SET UP EDIT

	1		/1 LOC REQUIRED FOR EDIT

	LAC	(DNOP	/HERE IS THE 1 INST.  A DNOP

	JMS	PUT	/TO PUT SUBROUTINE AS USUAL.

	JMP	EXIT	/THE EXIT ROUTINE

/			/FILLS ANY UNUSED LOC'S WITH NO-OPS, WHICH

/			/WILL BE THE REST OF THE LOCATIONS. DONE

/

/

/	TO GENERATE CODE FOR TEXT DISPLAY

/

TEXT	0

	JMS	SETARG

TEXTCM	LAC	LIT6	/TWO ARG'S PRIOR TO FILE INFORMATION

	JMS	INITIT	/SET UP FILE STUFF

LIT3	3

	LAC	ABSCMM	/13 BIT ABSOLUTE ADDR OF GROUP TOP

	TAD	(CHARSI+2  /CHARACTER INDIRECT GROUP +2

	JMS	PUT	/FIRST OF 3 COMMANDS TO GO

	LAC	(DSKP	/DISPLAY SKIP TO GO OVER ADDR

	JMS	PUT

	LAC	ARG1	/GET ADDR OF TEXT ARRAY

	.IFUND	NONXVM	/(35)XVM SYSTEMS NO 100000 BIT

	AND	(77777	/IN TEST FOUND WE WERE PICKING UP 100000 BIT!!!!

	.ENDC		/(35)

	TAD	BASE	/MAKE IT ABSOLUTE

	DAC	PR3	/SAVE FOR 8K TEXT OVERFLOW CASE TEST

	JMS	PUT

/

/	NOW FOR THE HARD PART. WE MUST PLACE AN ALTMODE TO TERMINATE

/	TEXT DISPLAY. WE WILL DESTROY WHATEVER IS NOT NEEDED OF A

/	TWO WORD PAIR, PLACING ALT IN LOW POSITION. IF N*5 CHAR'S

/	AN !!!ADDITIONAL!! WORD PAIR MUST BE PROVIDED FOR THE ALT.

/

	LAC*	ARG2	/GET # OF CHAR'S TO BE SHOWN

	SPA		/CHECK FOR NEGATIVE VHARACTER COUNT (0 OK)

	JMP	ERR5	/ILLEGAL COUNT ERROR

	SNA!CLL		/IF ZERO, ALT ALREADY THERE

	JMP	EXIT	/SO JUST GET OUT

	653323		/INTEGER DIVIDE (LINK HAD TO BE ZERO

LIT5	5		/DIVISOR

	DAC	INLIN1	/REMAINDER TO MAKE MASK TO SAVE RIGHT #

/			/OF CHAR'S FROM LAST WORD PAIR

	641002		/GET # OF WORD PAIRS FROM MQ

	CLL!RAL		/ OFFSET TO GET TO 1ST WORD OF PAIR TO BE

/			/CHANGED BY ALT MODE

	TAD	ARG1	/ADD IN TOP ADDR, NOW HAVE POINTER

	.IFUND	NONXVM	/(35)XVM HAS ALL ADDRESS BITS

	AND	(77777	/AND ZAP 100000 BIT AGAIN!

	.ENDC		/(35)

	DAC	PR1	/SOSAVE IT.

	LAC	LIT7	/MUST MULT REMAINDER BY 7 TO GIVE # OF

/			/OF ONES IN TWO WORD MASK TO AND WITH WHAT'S

/			/IN CORE IN CRITICAL PAIR

	653122		/MULTIPLY

INLIN1	0		/MULTIPLIER PLACED HERE

	641002		/GET LOW ORDER PART OF ANSWER

	TAD	(640500	/HERE IS LONG RIGHT SHIFT OP CODE

	DAC	INLIN2	/PLACE HERE FOR MAKING MASK

	650000		/ZERO MQ

	CLA!CLL!CML	/ZERO AC, ONE IN LINK. SHIFT BRINGS ONE BITS

INLIN2	0		/FROM LINK INTO AC THEN MQ

	AND*	PR1	/AND FIRST WORD

	DAC*	PR1	/AND PLACE

	641002		/BRING IN SECOND WORD OF MASK

	ISZ	PR1	/MOVE POINTER TO SECOND WORD

	AND*	PR1	/ZAP UNWANTED CHAR POSITIONS OF SECOND

	AAC	372	/ALMODE SHIFTED UP ONE (LAST BIT OF 2 WORDS

/			/IS NOT USED IN PACKING MODE

	DAC*	PR1	/AND REPLACE SECOND WORD

	LAC	BASE	/FIND OUT IF THIS ARRAY SPANS

	TAD	PR1	/ABSOLUTE 8K BOUDARY. HERE IS ABS. END ADDR.

	XOR	PR3	/ABSOLUTE BEGINNING ADDR.

	AND	(LAW 0	/IF THEY HAVE DIFFERENT BANK BITS, WE LOSE

	SNA		/IF LOSE, SKIP OVER RETURN TO ERROR CODE

	JMP	EXIT	/WHEW!

/

/  THIS ERROR ROUTINE MUST FOLLOW  TEXT IN ITS PRESENT PLACE

ERR7	AXR	2	/ERR6 IN DYSET-DYLINK

ERR5	AXR	1	/THE ENTRY POINT DETERMINES THE FINAL COUNT

ERR4	AXR	1	/TO BE GIVEN AS THE ERROR CODE

ERR3	AXR	1

ERR2	AXR	1

ERR1	AXR	1

	SKP		/MOVE OVER THE IOERR ENTRY

IOERR	PAX		/IOERR TAKES NEGATIVE EVENT VARIABLE AC TO XR

ERR0	LAC	(LY0-1	/SET UP 3 POINTERS TO THREE SLOTS IN ERROR

	DAC*	LIT10	/MSG. FOR VARIABLE INFO. USE AUTO INCR.#10

/			/FOR THE ERROR CODE NOW IN XR

	AAC	LDIAG-LY0 /POINTER BACK FOR ADDRESS

	DAC*	LIT11	/USE AUTO INCR. #11

	AAC	LSUB-LDIAG+1 /AND FOR TASK NAME. +1 SINCE WE NOT

	DAC	LX1	/GOING TO AUTO-INCR THIS ONE

	PXA		/GET BACK CODE

	JMS	BLEB	/ROUTINE MAKES 6 OCTAL CHAR'S, PLACES VIA

/			/AUTO INCR #10

	ISZ	BLEBP	/NOW BLEB USES AUTO INCR #11

	LAW	-1	/MAKE ADDR.  OF CALL

	TAD	RETURN	/THIS HD CALL+1

	JMS	BLEB	/PLACE ADDRESS IN MESSAGE

	CAL	WHO	/GET BACK TASK NAME

	LAC	WHO+2	/HERE IS FIRST HALF OF NAME

	JMS	BLECK	/PLACES 3 SIXBIT CHAR'S VIA LX1

	LAC	WHO+3	/AND SECOND HALF OF NAME

	JMS	BLECK	/LAST THREE CHAR'S

	CAL	TYPEIT	/GO TYPE OUT SILLY MESSAGE

	CAL	WATCAL	/WAIT FOR IT TO HAPPEN

	CAL	LIT10	/EXIT!!!!!

/

/	ENTRY POINT FOR ERROR FROM DYSET-DYLINK

/  XR STILL HAS CODE. AC HAS CALL+1, 

VTGL3	0

	DAC	RETURN	/PLACE CALL+1 HERE SO CAN JOIN ERR0

	LAC	LITD	/'D', SO WE CHANGE VPR TO DYS

	DAC	VPRDYS

	AAC	25	/'Y'

	DAC	VPRDYS+1

	AAC	-6	/'S'

	DAC	VPRDYS+2

	JMP	ERR0

/

/	ROUTINE TAKES QUANTITY IN AC, MAKES IT INTO ASCII OCTAL

/  PLACES IN AUTO INCR#10 (THIS IS LATER CHANGED TO 11)

/

BLEB	0

	LMQ		/PLACE IN MQ FOR SHIFTING OP.'S

	LAW	-6	/CONTROL COUNTER

	DAC	LX0	/USE THESE LOC.'S SO REGULAR ONE'S REMAIN

/			/FOR DEBUGGING EFFORT

BLEBL	CLA!CLL		/CLEAR UP FOR SHIFT

	LLS	3	/TOP OF MQ TO AC

	AAC	60	/MAKE OCTAL ASCII

BLEBP	DAC*	10	/PLACE VIA AUTO INCR

	ISZ	LX0	/DONE

	JMP	BLEBL	/NO

	JMP*	BLEB	/YES

/

/	ROUTINE TAKES QUANTITY IN AC AS 3 SIXBIT CHAR'S,

/  MAKES THEM ASCII, AND PLACES VIA POINTER AT LX1

/

BLECK	0

	LMQ		/PLACE IN S MQ FOR SHIFTING

	LAW	-3	/LOOP CONTROL

	DAC	LX0	/COUNTER

BLECKL	CLA!CLL		/CLEAR FOR SHIFTS

	LLS	6	/SIXBIT CHAR

	SNA		/SKIP UNLESS NULL

	JMP	.+3	/KEEP NULL LIKE IT IS

	AAC	40	/NEXT TWO MAKE IT ASCII, YES IT WORKS

	XOR	(140	/ALSO NO UNSIGHTLY CARRY INTO 200 BIT

	DAC*	LX1	/PLACE CHARACTER IN MESSAGE

	ISZ	LX1	/MOVE POINTER

	ISZ	LX0	/CHECK COUNT

	JMP	BLECKL	/MORE

	JMP*	BLECK	/NO MORE

/

/

/

CINIT	0		/START UP COMMON FILE TO 2 SLAVES.

	JMS	SETARG	/GO GET ARG.'S

	CLA		/SET UP TO JOIN DINIT AT DCINIT

	JMP	DCINIT

/

DINIT	0		/OPTIONAL SECOND ARG. PRESENT AND NON0,

/			/START UP ON BOTH SLAVE SCOPES.

	JMS	SETARG	/GET ARG'S FROM USER SET UP

DCINIT	AAC	2	/1 FOR MAIN (DINIT) 2 FOR COMMON (CINIT)

	DAC	PUTTAB	/THIS VALUE IS ONE SHORT OF THE ONE WANTED

/			/2 MAIN; 3 COMMON,. WE HAVE OHTER WORK TO DO

	TAD	CMPNT	/POINTER TO MAIN-COMMFL STORAGE PAIR

	DAC	T2	/BECAUSE WE NEED TO SAVE MAIN OR COMMON FILE ADDR

	LAC	PUTTAB	/BRING BACK THE 1 OR 2, WE NEED TO UPDATE

	AND	RUNLT	/RUNLT.THIS GROUP OF INST'S INCLUSIZE OR'S 2

/			/FOR MAIN, 1 FOR COMMON, INTO RUNLT

	XOR	PUTTAB	/DON'T WRRY ABOUT IT UNLESS YOU HAVE TO

	XOR	LIT3

	DAC	RUNLT	/RUNLT NOW UPDATED.

	ISZ	PUTTAB	/UPDATE OP CODE TO 2 OR 3 AS REQUIRED.

	LAC	ARG1	/GT MAIN FILE ADDR (RELATIVE!)

	DAC*	T2	/ INTO MAIN-COMM PAIR FOR THE GRAPHICS

	DAC	PUTBF	/FILE IN PUT STRUCTURE FOR STARTING (HANDLER

	ISZ	PUTBF	/MAKES ABSOLUTE. HERE MAKE FILE+1.

	TAD*	ARG1	/ADD IN TOP OF FILE  POINTER TO SEE IF NEW FILE

	SAD	ARG1	/IF NEW, THIS SAD =, LEAVES FILE ADDR IN AC

	JMS	NEW	/WITH WHICH TO CALL NEW.

DICC	JMS	DOPUT	/CALL THE GENERALIZED PUTTER

	JMP	STNDEX	/GO TO STADARD EXIT. -1 TO AC JMP* RETURN

/

CCLOSE	0		/STOP A COMMON FILE.

	LAC	CCLOSE	/FUDGE EXIT POINT TO GO IN COMMON WITH DCLOSE

	DAC	DCLOSE

	LAC	LIT5	/GET OP CODE FOR PUT TO HANDLER TO STOP COMMON

	JMP	DCCL	/GO JOIN

/

DCLOSE	0		/STOP THE MAIN FILE

	LAC	LIT4	/OP CODE FOR PUT

DCCL	DAC	PUTTAB	/PLACE OP CODE BOTH CASES

	AAC	-3	/MAKE MASK TO TORN OFF BIT IN RUNLT

	AND	RUNLT

	DAC	RUNLT

	JMS	DOPUT	/GO DO THE PUT TO THE HANDLER

	LAW	-1	/JUST IN CASE WE'RE A FUNCTION. HERE IS COMPLETE

	JMP*	DCLOSE	/GO BACK TO THE USER.

/

/

VTUNIT	0		/NEW CALL TO TELL US UNIT #

	JMS	SETARG	/GET ARG'S AS USUAL

	LAC*	ARG1	/GET UNIT #

	AAC	30	/UNITS ARE 24-27 BASE 10

	DAC	UNITP	/UNIT IN PUT PROCESSOR

	DAC	UNITG	/AND IN GET PROCESSOR

	JMP	STNDEX	/EXIT

/

/

TRACK	0		/TRACKING IS DONE, PRESENTLY WITHOUT

/			/OPTIONS BY INTERRUPT HANDLER

	JMS	SETARG	/ARG'S

	LAC*	ARG1	/GET INITIAL X

	DAC	GETBF	/INTO BUFFER FOR CAL

	LAC*	ARG2	/SAME FOR Y (COULD THIS ARG BE MISSING?)

	DAC	GETBF+1

	LAC	LIT10	/OP CODE FOR TRACKING

	JMS	DOGET	/GENERALIZED GETTER. GIVE OP CODE IN AC, GET

/			/BACK CONTENTS FIRST BUFFER LOC

	DAC*	ARG1	/TO USER, GUESS HE BETTER HAVE AN ARG.

	LAC	GETBF+1	/AND THE FINAL Y (HANDLER HAS CLIPPED TO 10 BITS

	DAC*	ARG2

STNDEX	LAW	-1	/OK FOR FUNCTION CALL

	JMP*	RETURN	/RETURN ADDR HAS BEEN PUT HERE BY SETARG.

/

/

LTORPB	0		/FACSIMILE OF DOS LTORPB

	JMS	SETARG	/SET UP THE ARGUMENTS

	LAC	LTGET	/FLAG, ARE WE ALREADY WAITING

	SNA!CLA		/SKIP IF WE ARE

	JMP	LSTART	/HEY THIS IS A NEW ONE, SET IT UP

	SAD	FEV	/HAS IT COMPLETED?

	JMP	DOWAT	/GO SEE IF HE WANTS US TO WAIT FOR HIM.

LTGOT	LAC	ARG5	/HAVE TO BE AT LEAST 5 ARG.'S

	SNA		/SKIP IF ARE

	JMP	ERR0	/ NOPE, GIVE ARGUMENT SPECIFICATION ERROR

	LAC	GETBF	/READ STATUS 3 WORD HERE. FIND OUT WHO KICKED

	RTL		/BITS IN QUESTION START AT 300000

	RTL		/THIS BRINGS TO 3

	AND	LIT3	/STRIP REST. IT IS CONCEIVABLE BOTH! ON.

	DAC*	ARG5	/1,2,3 INTO USER'S 5TH ARG.

	LAC	GETBF+2	/GET X POSITION

	DAC*	ARG1	/FIRST  ARG. FOR USER

	LAC	GETBF+3	/AND Y POSITION

	DAC*	ARG2

	LAC	GETBF+4	/NAME REGISTER

	DAC*	ARG3

	LAC	ARG4	/EDIT #33 NO INDIRECT. PLACE IN ARG1 FOR COMMON

	DAC	ARG1	/EDIT#33. PROCESSING WITH GETPSH

LGCOM	LAW	-6	/LOOP CONTRL

	DAC	LTGET	/HERE'S OK, WILL BE 0 WHEN WE'RE DONE

	LAC	GETBF+1	/6 BUTTON BITS IN TOP 6 BITS OF THIS WORD

	LMQ		/HANG IT INTO THE MQ

LLL	CLA		/THESE 3 INST' TO EXTEND TOP BIT OF MQ THRU

/			/ENTIRE AC. IE 0 IF OFF, -1 IF ON.

	LLS	1	/LEFT SHIFT, AC NOW 0 IF OFF, +1 IF ON

	CMA!IAC		/SO WE JUST NEED TO 2'S COMPLEMENT

	DAC*	ARG1	/INTO USER ARRAY

	ISZ	ARG1	/MOVE TO NEXT

	ISZ	LTGET	/TESTING

	JMP	LLL

	JMP	STNDEX	/GO TO STANDARD EXIT TO PICK UP -1 IN AC.

LSTART	ISZ	LTGET	/SET GET IN PROGERSS SWITCH

	AAC	6	/AC ALREADY 0

	DAC	GETTAB	/6 SPECIAL LTORPB FUNCTION FOR HANDLER

	CAL	GETCAL	/DO A READ ON CONDITIONS

DOWAT	LAC	ARG6	/IS WAITING ARG PRESENT

	SZA		/SKIP IF NOT

	LAC*	ARG6	/GET THE ARGUMENT

	SNA!CLA		/EXIT WHEN ARG=0 OR ABSENT

	JMP*	RETURN	/GO BACK TO USER AC=0 WHEN WE NOT WAIT, NOT GOT.

	CAL	WATCAL	/WAIT FOR HIM

	CLX		/DEFAULT INDEX REG. IN CASE OF ERROR

	LAC	FEV	/EVENT VARIABLE

	SPA		/SKIP IF OK

	JMP	IOERR	/RETURN SYSTEM NEGATIVE EVENT VARIABLE TO XR.

	JMP	LTGOT	/WE GOT IT, GO GIVE IT BACK

/

/  TRIAL FUNCTION GETPSH

/

/  RETURNS STATE OF PUSH BUTTONS IMMEDIATELY

/  WITHOUT LEAVING I/O OUTSTANDING

/

GETPSH	0

	JMS	SETARG	/SET UP ARG'S AND RETURN

	AAC	10	/AC WAS -1. GET CAL CODE 7 GENERALIZED

	JMS	DOGET	/THIS PUS CODE IN CAL. GETBF+2 HAS BITS

/			/TO SPECIFY BUTTONS

/			/EDIT #33 REMOVE LAC* ARG1. ALREADY OK!

	JMP	LGCOM	/FINISH WITH LTORPB

/

/

LTGET	0		/SWITCH 1 IF LTORPB GET IN PROGRESS

/			/OTHERWISE 0

LIT10	10		/LITERAL

	.END		/ZXCV
