/339 DISPLAY - FORTRAN CALLABLE SUBPROGRAM PACKAGE
/MAIN DISPLAY FILE GENERATION       H. SPENCER 9/68
/COPYRIGHT 1968, DIGITAL EQUIPMENT CORP., MAYNARD, MASS.
/
/CALLING SEQUENCES:
/	1) TO INITIALIZE AND START UP THE DISPLAY FILE
/		JMS	DINIT
/		JMP	.+2
/		.DSA	MAINFL	/FIRST LOCATION OF THE DISPLAY FILE
/
/	2) TO SET THE POSITION OF THE BEAM
/		JMS	SETPT
/		JMP	.+4
/		.DSA	Y	/Y POSITION, 10 BITS, 2'S COMPLEMENT.
/		.DSA	X	/X POSITION ...
/		.DSA	CNAME	/POINTS TO THE DISPLAY CODE PRODUCED BY THIS CALL
/
/	3) TO DRAW A COPY OF A PREVIOUSLY DEFINED SUBPICTURE
/		JMS	PLOT
/		JMP	.+4
/		.DSA	(0	/INDICATES SUBPICTURE CALL.
/		.DSA	PNAME	/SUBPICTURE TO BE PLOTTED.
/		.DSA	CNAME	/DISPLAY CODE POINTER
/
/	4) TO DRAW A LINE FROM THE CURRENT BEAM POSITION
/		JMS	PLOT
/		JMP	.+6
/		.DSA	(1	/INDICATES LINE CALL.
/		.DSA	DELTAY	/Y INCREMENT, 10 BITS, 2'S COMPLEMENT
/		.DSA	DELTAX	/X INCREMENT ...
/		.DSA	LT	/LINE TYPE (1=INTENSIFY, 0=OFF)
/		.DSA	CNAME	/DISPLAY CODE POINTER
/
/	5) TO INSERT PARAMETER SETTINGS
/		JMS	PLOT
/		JMP	.+N	/N=3+# OF SETTINGS REQUESTED
/		.DSA	(2	/INDICATES PARAMETER CALL
/		.DSA	FEATR[S]	/SUM OF IDS OF FEATURES BEING SET
/		.DSA	VALUE1	/VALUES OF SETTINGS, IN ASCENDING
/		...		/NUMERICAL ORDER OF ID
/		.DSA	VALUEM
/		.DSA	CNAME	/DISPLAY CODE POINTER
/
/	6) TO REPLACE EXISTING DISPLAY CODE WITH NEW, THE CALLS
/		JMS	RSETPT	AND
/		JMS	REPLOT
/	   HAVE THE SAME ARGUMENTS AND PRODUCE THE SAME CODE AS
/	   SETPT AND PLOT RESPECTIVELY.  IN THIS CASE CNAME IS A
/	   REQUIRED INPUT POINTING TO THE FIRST LOCATION INTO
/	   WHICH THE NEW DISPLAY CODE SHOULD BE PUT.
/
/	7) TO CLOSE THE MAIN FILE AND END DISPLAYING:
/		JMS	DCLOSE
/		JMP	.+2
/		.DSA	MAINFL	/FIRST LOCATION OF THE DISPLAY FILE
/
/	8) TO DELETE THE BLOCK OF DISPLAY COMMANDS COMPRISING A
/	SPECIFIED DISPLAY ENTITY FROM THE MAIN DISPLAY FILE:
/		JMS	DELETE
/		JMP	.+2
/		.DSA	CNAME	/DISPLAY CODE POINTER
/
DAT339=10
/339 DISPLAY CODE
VEC=1120				/VECTOR MODE
EDS=1101				/ENTER DATA STATE
POINT=1100			/POINT MODE
CCSB=1006			/CLEAR COORDINATE AND SECTOR BITS.
PJMP=2010				/PUSH-JUMP
POP=3000				/RETURN FROM PUSH-JUMP
JUMP=2000
SC=400				/ENABLE SCALE SETTING
INT=10				/ENABLE INTENSITY SETTING
LPOF=40				/ENABLE LIGHT PEN SETTING
BKOF=6301				/ENABLE BLINK SETTING
STOP=1400				/DISPLAY INTERNAL STOP
/
	.GLOBL	DINIT,PLOT,DCLOSE,SETPT,RSETPT,REPLOT,DELETE
	.GLOBL	MF.100,MF.101,MF.102
	.IODEV	10		/DISPLAY HANDLER ASSIGNED TO DAT10
/SUBROUTINE DINIT
DINIT	0
	LAC	DINIT		/RETURN ADDRESS IN AC.
	DAC	PLOT
	JMS	GETARG		/GET ARGUMENT (FILENAME).
	LAC	ARG1
	DAC	MAINFL		/SAVE LOCATION OF CURRENT MAIN FILE.
	LAC*	MAINFL		/MAINFL (1)=0 FOR NEW FILES,
	SNA			/LENGTH OF FILE FOR OLD FILES.
	LAC	D.1		/LENGTH OF NEW FILE = D.1.
	TAD	MAINFL		/ADD FIRST LOCATION TO GET
	DAC	MFPTR		/FILE ACTIVE POINTER
/
/COMPUTE DISPLAY JUMP FOR THE RIGHT CORE BANK.
/
	LAC	MAINFL		/GET ADDRESS OF DISPLAY FILE.
	RTL			/SHIFT 3 HIGH-ORDER BITS INTO
	RTL			/BITS 15-17.
	RTL
	RAL
	AND	(7		/CLEAR JUNK
	TAD	(JUMP		/ADD DISPLAY JUMP
	DAC	DJUMP		/JUMP + BREAK FIELD
	DAC*	MFPTR		/INSERT DISPLAY JUMP
	LAC	MAINFL		/TO FIRST DISPLAY-EXECUTABLE
	TAD	D.1		/LOCATION
	ISZ	MFPTR
	DAC*	MFPTR		/AT END OF THIS FILE.
	DAC	MF.1
DINT10	.INIT	DAT339,0,0	/INITIALIZE DISPLAY.
	LAC	DINT10+3		/GET VALUE OF PUSH-DOWN POINTER.
	DAC	MF.100		/INTO GLOABL VARIABLE.
	JMP	RTRN30		/RETURN.
/SUBROUTINE SETPT
SETPT	0
	LAC	SETPT		/SET UP RETURN ADDRESS
	DAC	PLOT
	JMS	GETARG		/GET ARGUMENT POINTERS.
	JMS	PNT		/GO SET UP REQUISITE POINT MODE COMMANDS
	JMP	RETRN		/GO INSERT THE CODE AND RETURN.
/ROUTINE TO GENERATE POINT MODE COMMANDS
PNT	0
	LAC	(030000!POINT!EDS!CCSB /NUMBER OF WORDS IN HIGH 6 BITS.
	DAC	TEMP1		/TEMPI GET INSERTED IN FILE
	LAC*	ARG1		/POINTER TO DELTA Y
	JMS	CONVT		/CONVERT TO SIGN-MAGNITUDE.
	DAC	TEMP2
	LAC*	ARG2		/POINTER TO DELTA X.
	JMS	CONVT		/SIGN-MAGNITUDE
	XOR	(4000		/EXCAPE BIT.
	DAC	TEMP3
	LAC	ARG3		/GET CNAME PTR INTO AC
	JMP*	PNT		/RETURN
/SUBROUTINE PLOT
PLOT	0
	LAC	PLOT		/RETURN ADDRESS INTO AC
	JMS	GETARG		/GET ARGUMENT POINTERS
	LAC*	ARG1		/WHICH KIND OF PLOT IS THIS?
	TAD	(JMS* JMSLST	/SET UP JMS TO APPROPRIATE PLOT
	DAC	.+1		/SUBROUTINE
	XX			/DO IT
	JMP	RETRN		/GO INSERT CODE AND RETURN
JMSLST	PLCOPY			/PLOT A SUBPICTURE
	PLLINE			/PLOT A LINE
	PLPRAM			/PLOT A PARAMETER SETTING COMMAND
/PLOT A SUB-PICTURE FROM THE MAIN FILE
PLCOPY	0
/COMPUTE PJMP APPROPRIATE FOR CORE BANK ADDRESSED.
	LAC	ARG2		/GET ADDRESS OF SUBPICTURE.
	RTL; RTL; RTL; RAL		/SHIFT BITS 3-5 TO 15-17.
	AND	(7		/CLEAR EVERYTHING ELSE.
	TAD	PJUMP		/ADD PJMP WITH CORRECT HIGH 6 BITS.
	DAC	TEMP1		/INTO FILE
	LAC	ARG2		/POINTER TO BEGINNING OF SUBPIC
	TAD	D.1		/POINT TO FIRST DISPLAY INSTRUCTION
	AND	(7777		/CLEAR HI-ORDER COUNT BITS.
	DAC	TEMP2
MINUS1	LAW	-1	/-1 INDICATES NO MORE TO FOLLOW.
	DAC	TEMP3
	LAC	ARG3		/CNAME POINTER INTO AC.
	JMP*	PLCOPY		/RETURN.
/PLOT A LINE
PLLINE	0
	LAC	(030000!VEC!EDS	/NUMBER OF WORDS IN HIGH 6 BITS
	DAC	TEMP1		/INTO FILE.
	LAC*	ARG2		/DELTA Y.
	JMS	CONVT		/CONVERT TO SIGN-MAGNITUDE
	DAC	ARG2		/PUT ASIDE
	LAC*	ARG4		/LINE TYPE.
	SZA			/INTENSIFY IF 1, OFF IF 0
	LAC	(4000		/INSERT INTENSIFY BIT.
	XOR	ARG2		/INSERT DELTA Y.
	DAC	TEMP2		/INTO FILE.
	LAC*	ARG3		/DELTA X
	JMS	CONVT		/SIGN-MAGNITUDE.
	XOR	(4000		/INSERT ESCAPE BIT.
	DAC	TEMP3		/INTO FILE.
	LAC	ARG5		/CNAME, IF GIVEN.
	JMP*	PLLINE		/RETURN
/ENTER PARAMETER SETTINGS
PLPRAM	0
	LAC	(ARG2		/SET UP POINTER TO VALUES OF
	DAC	ARGP		/FEATURES WANTING SETTING
	DZM	TEMP4		/CLEAR WORDS TO BE INSERTED IN
	DZM	TEMP5		/DISPLAY FILE.
	LAC*	ARG2		/BITS INDICATING WHAT FEATURES TO SET.
	SKP
PRM10	LAC	TEMP3		/REMAINING FEATURE BITS.
	SNA			/DONE IF AC = 0.
	JMP	PRM25
	RCR			/PUT ONE IN L.
	DAC	TEMP3		/SAVE THE REST.
	SNL			/FEATURE BIT IN L.
	JMP	PRM20		/NOT ON.
	ISZ	ARGP		/GET NEXT SETTING VALUE
	LAC*	ARGP		/POINTER.
	DAC	ARG1
	LAC*	ARG1		/GET ACTUAL VALUE.
PRM15	JMP*	PRMTBL		/GO TO APPROPRIATE SETTING ROUTINE.
PRM20	ISZ	PRM15		/POINT TO NEXT ROUTINE
	JMP	PRM10		/RECYCLE.
PRM25	LAC	(JMP* PRMTBL	/RESET ROUTINE DISPATCHER
	DAC	PRM15
/MOVE NON-0 VALUES OF TEMP 4&5 TO TEMP 1&2 FOR FILE INSERTION.
	LAC	(TEMP1		/SET UP APOINTER TO FILE TEMPS.
	DAC	TEMP
	LAC	TEMP4		/GET PARAMETER WORD.
	SNA
	JMP	PRM30		/0,DONT SAVE IT.
	XOR	(010000		/INSERT COUNT IN HIGH-ORDER BITS.
	DAC*	TEMP		/SAVE IT.
	ISZ	TEMP		/NEXT LOCATION.
PRM30	LAC	TEMP5		/GET BLINK WORD.
	SNA
	JMP	PRM35		/0,DONT SAVE IT.
	XOR	(010000		/INSERT COUNT
	DAC*	TEMP		/SAVE IT.
	ISZ	TEMP
PRM35	LAW	-1		/SET FENCE FOR FILE INSERTION.
	DAC*	TEMP
	ISZ	ARGP
	LAC*	ARGP		/GET CNAME POINTER INTO AC.
	JMP*	PLPRAM		/RETURN.
/GENERATE SCALE SETTING FROM VALUE IN AC
SCALE	RTL			/LEFT SHIFT 6.
	RTL
	RTL
	AND	(300
	XOR	(SC		/ENABLE SCALE CHANGE.
	DAC	TEMP4		/SET ASIDE FOR LATER INSERTION IN FILE.
	JMP	PRM20		/RETURN TO DISPATCHER.
/GENERATE INTENSITY SETTING FROM VALUE IN AC
INTENS	XOR	(INT		/ENABLE INTENSITY CHANGE.
	XOR	TEMP4		/INCLUDE IN WORD TO BE
	DAC	TEMP4		/INSERTED IN DISPLAY FILE
	JMP	PRM20		/RETURN TO DISPATCHER.
/GENERATE LIGHT PEN SETTING FROM VALUE IN AC.
LTPN	SZA			/1=LPON, 0=LPOF.
	LAC	(20		/ON BIT.
	TAD	(LPOF		/ENABLE LIGHT PEN SETTING.
	XOR	TEMP4		/INCLUDE IN DISPLAY FILE WORD
	DAC	TEMP4
	JMP	PRM20		/RETURN TO DISPATCHER
/GENERATE BLINK SETTING FROM VALUE IN AC.
BLINK	SZA			/1=BKON, 0=BKOF.
	LAC	(1		/ON BIT.
	TAD	(BKOF		/SET BLINK CIRCUIT.
	DAC	TEMP5		/SAVE FOR DISPLAY FILE.
	JMP	PRM20		/RETURN TO DISPATCHER.
PRMTBL	SCALE
	INTENS
	LTPN
	BLINK
/RETURN SEQUENCE FOR NEW DISPLAY CODE (PLOT, SETPT)
 
RETRN	SNA			/WAS CNAME GIVEN?
	JMP	RTRN10		/NO.
	DAC	CNAME
	LAC	MFPTR		/INSERT POINTER TO NEW CODE
	DAC*	CNAME		/INTO CNAME.
RTRN10	LAC	MFPTR		/POINTS TO LOC FOR STOP.
	JMS	STOPTV		/GO STOP DISPLAY.
/INSERT NEW CODE IN DISPLAY FILE AND RESTART.
	LAC	(TEMP1		/SET UP A POINTER TO THE FIRST DISPLAY
	DAC	TEMP		/COMMAND TO BE ADDED.
RTRN15	LAC*	TEMP		/GET NEXT DISPLAY COMMAND.
	SAD	FENCE		/-1 INDICATES NO MORE TO FOLLOW
	JMP	RTRN20		/JUMP OUT IF FINISHED
	DAC*	MFPTR		/INSERT IN DISPLAY FILE.
	ISZ	MFPTR		/NEXT LOC IN DISPLAY FILE.
	ISZ	TEMP		/NEXT NEW DISPLAY COMMAND.
	JMP	RTRN15		/RECYCLE.
 
RTRN20	LAC	DJUMP		/INSERT DISPLAY JUMP TO START
	DAC*	MFPTR
	ISZ	MFPTR
	LAC	MF.1		/OF FILE AT NEW END OF FILE.
	DAC*	MFPTR
 
RTRN30	LAC	MF.1		/PUT A POINTER TO THE DISPLAY
	DAC	RTRN32+2		/INTO THE .WRITE MACRO.
RTRN32	.WRITE	DAT339,4,0,0	/START UP THE DISPLAY.
	LAC	MFPTR		/SET UP POINTER TO JUMP (THIS IS
	TAD	MINUS1		/WHERE NEW CODE WOULD GO)
	DAC	MFPTR
	CMA			/COMPUTE LENGTH OF FILE.
	TAD	MAINFL
	CMA
	DAC*	MAINFL		/INSERT LENGTH IN FIRST LOCATION.
	JMP*	PLOT		/RETURN TO CALLER.
/SUBROUTINE REPLOT
REPLOT	0
	LAC	REPLOT		/RETURN ADDRESS INTO AC.
	JMS	GETARG		/GET ARGUMENT POINTERS.
	LAC*	ARG1		/WHICH KIND OF REPLOT IS THIS?
	TAD	(JMS* JMSLST	/SET UP JMS TO APPROPRIATE REPLOT
	DAC	.+1		/SUBROUTINE.
	XX			/DO IT.
RPLT10	DAC	CNAME		/POINTER TO POINTER.
	LAC*	CNAME		/GET ACTUAL POINTER TO DISPLAY
	DAC	CNAME		/CODE TO BE REPLACED AND SAVE
	DAC	CNAME2		/2 COPIES OF IT.
/COMPUTE TOTAL WORDS TO BE INSERTED, IN LH 6 BITS
	LAC	(TEMP1		/SET UP POINTER TO FIRST OF NEW
	DAC	TEMP		/DISPLAY COMMANDS.
	DZM	NEED
RPLT20	LAC*	TEMP		/GET FIRST DISPLAY COMMAND
	SAD	FENCE		/-1 = NO MORE TO FOLLOW
	JMP	RPLT30		/GO CHECK FOR SPACE REQUIRED.
	AND	(770000		/HIGH 6 BITS = NUMBER OF WORDS NEEDED.
	TAD	NEED		/ACCUMULATE
	DAC	NEED		/TOTAL BLOCK SIZE FOR THIS INSERTION
	ISZ	TEMP		/NEXT COMMAND.
	JMP	RPLT20		/RECYCLE
 
/ROUTINE TO CHECK SUFFICIENCY OF ROOM AT CNAME FOR THIS INSERTION.
 
RPLT30	LAC*	CNAME2		/GET PROPOSED INSERT LOCATION.
	AND	(770000		/LEAVE BITS CONTAINING BLOCK SIZE.
	SNA			/IF 0, THIS IS MIDDLE OF A BLOCK.
	JMP	F.RTRN		/RETURN, UNSUCCESSFUL.
	DAC	R		/KEEP BLOCK SIZE.
	CMA
	TAD	NEED		/SUBTRACT BLOCK SIZE NEEDED.
	CMA
	DAC	RMN		/REMAINDER.
	SMA			/OK IF BLOCK SIZE AVAILABLE IS
	JMP	T.RTRN		/GREATER THAN BLOCK SIZE NEEDED.
/MOVE POINTER DOWN TO THE END OF THIS BLOCK.
	LAC	R		/GET BLOCK SIZE.
RPLT33	TAD	(-010000		/REDUCE BY ONE.
	ISZ	CNAME2		/MOVE POINTER DOWN ONE.
	SZA			/FINISHED IF 0.
	JMP	RPLT33		/ELSE RECYCLE.
 
RPLT35	LAC*	CNAME2		/GET PROPOSED INSERT LOCATION.
	AND	(7777		/LOOK AT OP CODE BITS
	SZA			/0 = DISPLAY NOP (IE EXPENDABLE).
	JMP	F.RTRN		/UNSUCCESSFUL RETURN.
	LAC	RMN		/FOUND ANOTHER LOCATION,
	TAD	(010000		/ONE LESS NEEDED.
	DAC	RMN
	SNA
	JMP	T.RTRN		/DONE IF NO MORE NEEDED.
	ISZ	CNAME2		/LOOK AT NEXT LOCATION IN FILE
	JMP	RPLT35		/RECYCLE.
 
/SUBROUTINE RSETPT
 
RSETPT	0
	LAC	RSETPT		/SET UP RETURN.
	DAC	REPLOT
	JMS	GETARG		/GET ARGUMENT POINTERS.
	JMS	PNT		/GENERATE POINT MODE COMMANDS.
	JMP	RPLT10		/GO FINISH UP.
 
/RETURN SEQUENCE FOR REPLACING DISPLAY CODE (REPLOT, RESETPT)
 
T.RTRN	LAC	CNAME		/RESET WORKING POINTER TO
	JMS	STOPTV		/GO STOP DISPLAY.
 
/INSERT NEW CODE AND CLEAR REMAINING LOCATIONS OF THIS BLOCK, IF ANY.
 
	LAC	(TEMP1		/SET UP POINTER TO FIRST
	DAC	TEMP		/NEW DISPLAY COMMANDS.
TRTN10	LAC*	TEMP		/GET DISPLAY COMMAND.
	SAD	FENCE		/-1 = NO MORE TO COME.
	JMP	TRTN20
	DAC*	CNAME2		/INSERT IN FILE.
	ISZ	CNAME2		/NEXT LOC IN FILE.
	ISZ	TEMP		/NEXT NEW COMMAND.
	JMP	TRTN10		/RECYCLE.
 
TRTN20	LAC	RMN		/REMAINING LOCATIONS IN THIS BLOCK.
TRTN22	SNA			/DONE IF 0.
	JMP	TRTN30
	DAC*	CNAME2		/INSERT DISPLAY NOP WITH BLOCK SIZE.
	ISZ	CNAME2		/NEXT LOC IN FILE.
	TAD	(-010000		/REDUCE REMAINDER BY ONE.
	JMP	TRTN22		/RECYCLE.
 
TRTN30	.WRITE	DAT339,0,0,0	/RESTART DISPLAY.
/SEQUENCE TO GO UP THE DISPLAY FILE AND INSURE THAT BLOCK SIZES ARE CONSISTENT
/WITH INSERTION JUST MADE.
	LAC	R		/GET SIZE OF BLOCK AT WHICH INSERTION
	CMA			/WAS MADE AND CHANGE SIGN.
	DAC	R
	ISZ	R
	LAC	CNAME		/MOVE POINTER UP ONE.
	TAD	(-1
	DAC	CNAME
	LAC*	CNAME		/GET FILE LOCATION NEXT ABOVE.
	TAD	R		/SUBTRACT VALUE THAT WAS AT INSERT.
	SMA
	SNA
	JMP	TRTN40		/DONE IF AC IS LESS THAN OR = 0
	DAC*	CNAME		/INSERT DISPLAY NOP WITH NEW BLOCK SIZE
	JMP	TRTN30		/RECYCLE.
 
TRTN40	LAC	TRUE		/INDIATE SUCCESS.
	JMP*	REPLOT		/RETURN.
 
F.RTRN	LAC	FALSE		/INDICATE FAILURES.
	JMP*	REPLOT		/RETURN.
/DELETION SUBROUTINE.
DELETE	0
	LAC	DELETE		/RETURN ADDRESS.
	DAC	REPLOT
	JMS	GETARG		/GET ARGUMENT (POINTS TO DELETION)
	LAC*	ARG1		/GET POINTER INTO DISPLAY FILE.
	DAC	CNAME
	LAC*	CNAME		/GET FIRST COMMAND.
	AND	(770000		/NUMBER IN HIGH 6 BITS SHOWS
	SNA			/LENGTH OF THIS BLOCK.
	JMP	F.RTRN		/0=NOT THE BEGINNING OF A BLOCK.
	DAC	R		/SAVE BLOCK LENGTH.
	LAC	CNAME		/GET DISPLAY STOP LOCATION.
	JMS	STOPTV		/STOP DISPLAY.
	LAC	R		/GET NUMBER OF FREED LOCATIONS.
DEL20	DAC*	CNAME		/INSERT DISPLAY NOP WITH LENGTH.
	TAD	(-010000		/REDUCE R BY ONE.
	SNA			/DONE IF 0.
	JMP	DEL25	
	ISZ	CNAME		/NEXT LOC IN FILE.
	JMP	DEL20		/RECYCLE.
DEL25	.WRITE	DAT339,0,0,0	/RESTART DISPLAY.
	JMP	TRTN40		/GIVE USER .T.
/GENERAL GET - ARGUMENTS ROUTINE
 
GETARG	0
	DAC	ARGP		/POINTS TO RETURN ADDRESS OF CALLER
	LAC*	ARGP		/GET JMP OVER ARGUMENT LIST.
	AND	(17777		/LEAVE ADDRESS (13 BITS).
	DAC	TEMP		/SAVE.
	LAC	(ARG1		/SET UP POINTER TO LOCAL
	DAC	TEMP1		/ARGUMENT STORAGE.
GTRG10	ISZ	ARGP		/NEXT ARGUMENT.
	LAC	ARGP		/GET ARGUMENT POINTER.
	AND	(17777		/SEE IF IT POINTS PAST THE END
	SAD	TEMP		/OF THE ARGUMENT LIST.
	JMP	GTRG20		/GO FINISH UP IF SO.
	LAC*	ARGP		/GET VALUE OF ARGUMENT.
	SMA			/INDIRECT POINTER IF MINUS.
	JMP	GTRG15
	DAC	TEMP2		/GET ACTUAL VALUE.
	LAC*	TEMP2
GTRG15	DAC*	TEMP1		/INSERT ARGUMENT.
	ISZ	TEMP1		/NEXT WORD IN LOCAL STORE.
	JMP	GTRG10		/RECYCLE.
 
GTRG20	LAC	TEMP1		/DOES ARGUMENT POINTER POINT TO
	SAD	ARGEND		/END OF LOCAL STORE?
	JMP*	GETARG		/YES, EXIT
	DZM*	TEMP1		/CLEAN REMAINDER OF LOCAL STORE
	ISZ	TEMP1
	JMP	GTRG20		/RECYCLE.
/INSERT A STOP IN THE DISPLAY FILE AND WAIT FOR IT.
STOPTV	0
	DAC	CNAME2		/POINTS TO STOP LOCATION.
	.INIT	DAT339,0,1	/CLEAR ANY PENDING ACTIVITY.
	.READ	DAT339,7,TEMP,1	/SET UP TO READ
	020002			/ISTOP INTERRUPT,NO REGISTERS.
	LAC	(STOP		/INSERT DISPALY STOP
	DAC*	CNAME2		/IN THE DISPLAY FILE.
	.WAIT	DAT339		/WAIT FOR IT.
	JMP*	STOPTV		/RETURN.
 
/ROUTINE TO CONVERT INPUT COORDINATES FROM 2'S COMPLEMENT TO SIGN-MAGNITUED.
 
CONVT	0
	SMA
	JMP*	CONVT		/DONE IF POSITIVE.
	CMA			/CHANGE TO POSITIVE MAGNITUDE
	TAD	(1
	XOR	(2000		/INSERT MINUS SIGN BIT.
	JMP*	CONVT		/RETURN.
 
/SUBROUTINE DCLOSE
 
DCLOSE	0
	.CLOSE	DAT339		/TURN OFF DISPLAY.
	LAC	(POP		/GET DISPLAY POP
	DAC*	MFPTR		/INSERT AT END OF FILE.
	JMP*	DCLOSE		/RETURN.
	.EJECT
/CONSTANTS AND STORAGE
MF.100		/GLOBAL FOR PUSH-DOWN LOCATION.
MF.101		/GLOBAL FOR FIRST LOCATION OF CURRENT FILE.
MF.102		/GLOBAL FOR CURRENT END OF CURRENT FILE.
 
D.1	2	/MAINFL+D.1=FIRST DISPLAY COMMAND.
MFPTR=MF.102	/POINTER TO CURRENT END OF DISPLAY FILE.
MF.1		/POINTER TO FIRST DISPLAY COMMAND.
MAINFL=MF.101	/POINTER TO BEGINNING OF CURRENT DISPLAY FILE.
ARG1		/LOCAL STORAGE FOR ARGUMENTS.
ARG2
ARG3
ARG4
ARG5
ARG6
ARG7
ARGEND	.	/POINTER TO END OF ARGUMENT STORE.
DJUMP		/DISPLAY JUMP + BREAK FIELD.
PJUMP	022010	/DISPLAY PJMP + NUMBER OF WORDS REQUIRED.
TEMP		/TEMPORARY STORE.
TEMP1		/STORAGE FOR CODE TO BE INSERTED IN FILE.
TEMP2
TEMP3
FENCE	-1	/-1 NEEDED AT END OF FILE STORAGE.
TEMP4		/STORAGE FOR PRAMTR CALLS.
TEMP5
TRUE=FENCE	/FORTRAN VALUE OF .T.
FALSE	0	/FORTRAN VALUE OF .F.
 
CNAME=DINIT	/POINTS TO DISPLAY COMMANDS INSERTED.
CNAME2=SETPT
R=RSETPT		/LOCAL COUNT OF WORDS IN DISPLAY FILE (HIGH 6 BITS)
NEED=DCLOSE	/WORD NEEDED BY A REQUESTED INSERTION.
RMN=PLOT		/R-NEED.
ARGP		/ARGUMENT POINTER.
 
 
	.END
