/

/COPYRIGHT (C) 1975

/DIGITAL EQUIPMENT CORPORATION, MAYNARD, MASS.

/

/THIS SOFTWARE IS FURNISHED UNDER A LICENSE FOR USE ONLY

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

/THE INCLUSION OF THE ABOVE COPYRIGHT NOTICE.  THIS

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

/VIDED OR OTHERWISE MADE AVAILABLE TO ANY OTHER PERSON

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

/THESE LICENSE TERMS.  TITLE TO AND OWNERSHIP OF THE

/SOFTWARE SHALL AT ALL TIMES REMAIN IN DEC.

/

/THE INFORMATION IN THIS DOCUMENT IS SUBJECT TO CHANGE

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

/MITMENT BY DIGITAL EQUIPMENT CORPORATION.

/

/DEC ASSUMES NO RESPONSIBILITY FOR THE USE OR RELIABILITY

/OF ITS SOFTWARE ON EQUIPMENT WHICH IS NOT SUPPLIED BY DEC.

	.EJECT

/VT15 DISPLAY - FORTRAN CALLABLE SUBPROGRAM PACKAGE

/DISPLAY FILE RELOCATION ROUTINES

/

/ EDIT	#001	SCR	8/11/75		FIX UP FOR XVM, ETC.

/ EDIT	#002	SCR	9/2/75		COPYRIGHT

/

/

/VT15 COMMANDS

CHARSI=060000			/CHARACTER STRING INDIRECT INSTRUCTION.

SAVE=240000			/SAVE INSTRUCTION.

RSTR=260000			/RESTORE INSTRUCTION.

DJMSI=660000			/SUBPICTURE CALL

DJMPI=620000			/SUBPICTURE RETURN

DJMP=600000			/DISPLAY JUMP INSTRUCTION.

	.EBREL

	.GLOBL	DYSET,DYLINK

/SUBROUTINE DYSET

DYSET	XX

	LAC	DYL34		/SET SWITCH TO SHOW DYSET ENTRY

	DAC	DYS24

/SET UP POINTERS TO START AND END OF ARGUMENT LIST.

	LAC	DYSET		/GET A POINTER TO THE ARGUMENT LIST.

DYS05	DAC	ARGP

	LAC*	DYSET		/GET A POINTER (13 BIT) TO THE

	AND	(17777		/END OF THE ARGUMENT LIST.

	DAC	ARGEND

/ANY MORE ARGUMENTS?

DYS10	ISZ	ARGP		/POINT AT DISPLAY POINTER

	LAC	ARGP		/CHECK FOR ANY MORE ARGUMENTS.

	AND	(17777		/KEEP 13 BITS.

	SAD	ARGEND

	JMP*	DYSET		/NO MORE ARGUMENTS, RETURN.

/SET UP DISPLAY FILE POINTERS

	LAC*	ARGP

	DAC	TEMP

	LAC*	TEMP

	SNA			/0= TEXT ARRAY FLAG

	JMP*	DYSET		/RETURN IF REMAINING ARGS ARE TEXT ARRAYS.

	LAC*	ARGP		/GET ARG POINTER AGAIN.

	JMS	INDRCT		/GET ACTUAL POINTER.

	DAC	PNAME

	DAC	PNPTR		/POINTER TO THE DISPLAY FILE.

	LAC*	PNPTR		/GET DISPLAY LENGTH.

	TAD	PNPTR		/ADD LOCATION.

	DAC	EPTR		/POINTER TO END OF DISPLAY FILE.

	DAC	EOF		/(001) EPTR OVER-USED, HAVE ANOTHER.

	ISZ	PNPTR		/(001) DON'T PICK UP ENTRY POINT!!

	ISZ	ARGP		/POINT AT ASCII POINTER.

/FIND SUBPICTURE CALLS

DYS20	ISZ	PNPTR		/POINT AT NEXT DISPLAY COMMAND.

	LAC*	PNPTR		/GET IT.

	AND	(760000		/MASK IT.

	SAD	(DJMSI		/IF DJMS*

	JMP	DYS30		/GO CHANGE OPERAND.

	SAD	(CHARSI		/IF CHARS*

	JMP	DYS30		/GO CHANGE OPERAND.

	SAD	(SAVE		/(001) SAVE INST?

	JMP	DYS91		/(001) GO CLEAR OPERAND

DYS22	LAC	PNPTR		/ELSE CHECK IF END OF

	SAD	EOF		/(001) END? EOF UNCHANGED, EPTR MOVES.

DYS24	XX			/RECYCLE IF SET, SET PNAME IF LINK.

	JMP	DYS20		/NOT YET, RECYCLE.

	.EJECT

/LOOK FOR DJMS* OPERAND IN THE ARGUMENT LIST.

DYS30	LAC	DYSET		/SET UP AN ARGUMENT POINTER FOR

	DAC	ARGP2		/THIS PASS THRU THE ARGUMENT LIST.

	LAC	D.1		/ADD 2

	TAD	PNPTR		/TO FILE POINTER, TO

	DAC	PNPTR		/POINT AT OPERAND OF DJMS*.

	LAC	DYS24		/WAS THIS A CALL TO DYSET

	SAD	DYL31		/OR

	JMP	DYL10		/DYLINK.

DYS32	ISZ	ARGP2		/POINT AT DISPLAY FILE PTR.

	LAC	ARGP2		/CHECK FOR END OF ARGUMENT LIST.

	AND	(17777

	SAD	ARGEND

	JMP	DYS20		/GO CHECK NEXT DISPLAY COMMAND.

	LAC*	ARGP2		/GET DISPLAY FILE PTR.

	DAC	TEMP

	LAC*	TEMP

	SNA			/IF TEXT ARRAY FLAG (ARG=0)

	JMP	DYS32	/GO GET NEXT ARG.

	LAC*	ARGP2		/GET DISPLAY FILE POINTER.

	JMS	INDRCT	/GET ACTUAL ARG POINTER.

	DAC	TEMP		/(001) REMOVE AND (77777

	ISZ	ARGP2		/POINT AT ASCII POINTER.

	LAC*	PNPTR		/GET DJMS* OR CHARS* OPERAND.

/				/(001) REMOVE AND (77777)

	SAD	TEMP		/IF EQUAL TO ARGUMENT (TEXT ARRAY),

	JMP	DYS40		/GO SET UP RELATIVE POINTER.

	ISZ	TEMP		/BUMP TO CHECK DJMS* PNAME+1

	SAD	TEMP		/IF EQUAL TO ARG (PNAME+1),

	JMP	DYS40		/GO SET UP RELATIVE POINTER.

	JMP	DYS32		/ELSE RECYCLE.

/SEARCH THRU END OF DISPLAY FILE FOR ASCII SUBPICTURE NAMES.

DYS40	LAC	EPTR

DYS42	DAC	EPTR2		/(001)PTR TO MOVE UP FROM END OF FILE.

	SAD	EOF		/(001) UP TO DIPLAY CODE YET

	JMP	DYS50		/GO INSERT ASCII IN DISPLAY FILE.

	TAD	(-3		/4-WORD ASCII BLOCK.

	DAC	EPTR2

	JMS	COMPR		/COMPARE ASCII STRINGS.

	JMP	DYS44		/SAME.

	LAW	-1		/(001) MOVE REST OF 4 LOC.'S

	TAD	EPTR2		/(001)

	JMP	DYS42		/RECYCLE.

	.EJECT

/INSERT RELATIVE POINTER TO ASCII OPERAND OF DJMS*

DYS44	LAC	PNAME		/SET UP POINTER TO ASCII STRING

	CMA; TAD (1		/RELATIVE TO THE BEGINNING

	TAD	EPTR2		/OF THIS DISPLAY FILE.

	DAC*	PNPTR		/INSERT AS OPERAND OF PJMP.

	JMP	DYS20		/RETURN FOR NEXT DISPLAY COMMAND.

/INSERT NEW ASCII BLOCK AT END OF DISPLAY FILE.

DYS50	LAC*	ARGP2		/GET PTR TO ASCII BLOCK POINTER.

	JMS	INDRCT		/CORRECT FOR INDIRECT CALL ARG.

	DAC	TEMP		/(001)REMOVE XTRA INDIRECT

	LAW	-4		/4 WORDS INTO FILE

	DAC	CNTR

DYS52	ISZ	EPTR		/MOVE END PTR DOWN FOR ASCII.

	LAC*	TEMP		/GET ASCII.

	DAC*	EPTR		/INSERT IN FILE.

	ISZ	TEMP

	ISZ	CNTR		/DONE 4?

	JMP	DYS52		/NO, RECYCLE.

	LAC	EPTR		/SET UP POINTER

	TAD	(-3		/TO START OF NEW BLOCK.

	DAC	EPTR2

	LAC*	PNAME		/UPDATE FILE LENGTH.

	TAD	(4

	DAC*	PNAME

	JMP	DYS44		/GO SET DJMS* OPERAND.

	.EJECT

/COMPARE ASCII STRINGS. AC=STRING IN DISPLAY FILE, ARGP2=POINTER IN ARG LIST.

COMPR	XX

	DAC	TEMP2		/SAVE PTR TO ASCII IN DISPLAY FILE

	LAC*	ARGP2		/GET A POINTER FROM THE ARGUMENT

	JMS	INDRCT

	DAC	TEMP		/(001) REMOVE XTRA INDIRECT

	LAW	-4		/4 WORD BLOCK.

	DAC	CNTR

COM10	LAC*	TEMP		/COMPARE A WORD OF ASCII.

	SAD*	TEMP2

	JMP	COM20		/SAME, SET UP FOR NEXT WORD.

	ISZ	COMPR

	JMP*	COMPR		/DIFFERENT, RETURN.

COM20	ISZ	TEMP		/NEXT WORD OF ARGUMENT ASCII.

	ISZ	TEMP2		/NEXT WORD OF DISPLAY FILE ASCII.

	ISZ	CNTR		/DONE 4 WORDS?

	JMP	COM10		/NO, RECYCLE

	JMP*	COMPR		/RETURN.

/

/GET ACTUAL ARGUMENT INTO AC IF GIVEN ARGUMENT (IN AC) WAS INDIRECT.

INDRCT	XX

	SMA			/INDIRECT IF MINUS.

	JMP*	INDRCT		/DIRECT,RETURN.

	DAC	TEMP		/SAVE INDIRECT POINTER.

	LAC*	TEMP		/GET ACTUAL POINTER.

	JMP*	INDRCT		/RETURN

/

DYS91	LAC*	PNPTR		/(001)ZERO SAVVE OPERAND, SO IT

/				/(001) DOESN'T LOOK LIKE A VT-15 OP.

	XOR	PNPTR		/(001)TOP 5 BITS PNPTR. BOTTOM 13

	AND	(17777		/(001) INDIR FROM PNPTR

	XOR	PNPTR		/(001)

	DAC	TEMP		/(001) ADDR OF OFFENDING WORD

	DZM*	TEMP		/(001)ALSO DO AT DYLINK TIME,

	JMP	DYS20		/(001)IRRELEVANT.

/

	.EJECT

/SUBROUTINE DYLINK

DYLINK	XX

	LAC	DYL31		/SET UP BRANCH TO INDICATE DYLINK

	DAC	DYS24		/ENTRY.

	LAC	DYLINK		/SET UP COMMON EXIT.

	DAC	DYSET

	JMP	DYS05		/GO START.

/SEARCH ARGUMENT LIST FOR ASCII POINTED AT BY DJMS* OPERAND.

DYL10	ISZ	ARGP2		/NEXT DISPLAY FILE.

	LAC	ARGP2		/CHECK FOR END OF ARGUMENT

	AND	(17777

	SAD	ARGEND		/LIST.

	JMP	DYS20

	LAC*	ARGP2		/IF TEXT ARRAY FLAG (ARG=0),

	DAC	TEMP 	

	LAC*	TEMP

	SNA

	ISZ	ARGP2		/GO TO NEXT ARG.

	ISZ	ARGP2		/NEXT ASCII POINTER IN ARG LIST.

	LAC*	PNPTR		/COMPUTE ABS PTR TO DISPLAY FILE

	TAD	PNAME		/ASCII FROM DJMS* OPERAND.

	JMS	COMPR		/COMPARE ASCII STRINGS.

	JMP	DYL20		/SAME, GO SET UP DJMS* OPERAND.

	JMP	DYL10		/DIFFERENT, RECYCLE.

/INSERT DISPLAY FILE LOCATION AS OPERAND OF DJMS*.

DYL20	LAC	ARGP2		/MOVE ARGUMENT PTR BACK TO PNAME

	TAD	(-1		/CORRESPONDING TO THIS ASCII.

	DAC	TEMP

	LAC*	TEMP		/GET DISPLAY FILE POINTER.

	JMS	INDRCT		/GET ACTUAL ARG PTR.

/				/(001) REMOVE  AND  (77777)

	DAC*	PNPTR		/INSERT AS DJMS* OR CHARS* OPERAND.

	DZM	SRFLG		/CLEAR OUT SAVE-RESTORE FLAG

	LAC	PNPTR		/GET FILE POINTER,

	AND	(17777		/KEEP 13 BITS,

	DAC	TEMP		/SAVE AS INSERT LOC. FOR INDIRECT REFERENCE.

	LAC	PNPTR		/GET FILE POINTER (15 BITS),

	TAD	(-3		/MOVE BACK 3 LOCS,

	DAC	TEMP2		/AND SAVE IT.

	LAC*	TEMP2		/GET CONTENTS OF PNPTR-3,

	AND	(760000		/MASK,

	SAD	(SAVE		/AND TEST FOR SAVE INSTRUCTION.

	SKP			/EQUAL SAVE INSTRUCTION.

	JMP	DYL25		/NOT SAVE, CONTINUE.

	XOR	TEMP

	TAD	(1		/FORM AND

	DAC*	TEMP2		/STORE NEW SAVE INSTRUCTION.

	ISZ	SRFLG		/SET SAVE-RESTORE FLAG.

DYL25	ISZ	TEMP2		/POINT TO CHARS* OR DJMS*,

	LAC*	TEMP2		/GET IT,

	AND	(760000		/AND MASK IT.

	SAD	(DJMSI		/IF DJMS*,

	ISZ*	PNPTR		/BUMP EFFECTIVE OPERAND TO PNAME+1.

	TAD	TEMP		/FORM NEW ADDRESS PORTION,

	DAC*	TEMP2		/AND STORE IT.

	ISZ	TEMP2		/POINT TO DJMP.

	ISZ	TEMP		/POINT TO LOC AFTER INDIRECT WORD.

	LAC	(DJMP		/FORM DJMP INSTRUCTION

	TAD	TEMP		/WITH NEW ADDRESS,

	DAC*	TEMP2		/AND STORE IT.

	LAC	SRFLG		

	SZA

	ISZ*	TEMP2		/INCREMENT DJMP IF SAVE-RESTORE GROUP.

	SNA

	JMP	DYS20		/DONE, IF NOT SAVE-RESTORE GROUP.

	LAC	TEMP2

	TAD	(3

	DAC	TEMP2		/POINT TO LOC FOR RSTR INSTRUCTION.

	LAC	(RSTR		/FORM RSTR INSTRUCTION

	TAD	TEMP		/WITH NEW ADDRESS PORTION,

	DAC*	TEMP2		/AND STORE IT.

	JMP	DYS20		/NEXT DISPLAY COMMAND.

/FIND LAST DISPLAY COMMAND (DJMPI) AND SET RELATIVE POINTER (FILE LENGTH) TO IT AT

/WORD 0, EXCLUDING ASCII BLOCKS AT END OF FILE.

DYL30	LAC*	EPTR		/GET LAST DISPLAY FILE WORD.

	AND	(760000

	SAD	(DJMPI		/DJMPI IS THE LAST DISPLAY COMMAND.

	JMP	DYL32		/GO SET UP POINTER.

	LAC	EPTR		/DECREMENT END POINTER.

	TAD	(-1

	DAC	EPTR

DYL31	JMP	DYL30		/GET NEXT.

DYL32	LAC	PNAME		/FORM NEW

	AND	(17777

	TAD	(DJMPI+1	/DJMP* INSTRUCTION

	DAC*	EPTR		/AND STORE IT.

	LAC	PNAME		/POINTS TO BEGINNING OF FILE.

	CMA			/SUBTRACT FROM

	TAD	(1

	TAD	EPTR		/END POINTER.

	DAC*	PNAME		/STORE RELATIVE POINTER.

DYL34	JMP	DYS10		/BACK FOR NEXT DISPLAY FILE.

/CONSTANTS AND TEMPORARY STORAGE

ARGP				/ARGUMENT LIST POINTERS

ARGP2

ARGEND

PNAME				/DISPLAY FILE POINTERS

PNPTR

EPTR

EOF				/(001) END OF FILE ADDR (STABLE)

EPTR2

D.1	2			/DISTANCE FROM START OF FILE TO FIRST COMMAND.

TEMP				/TEMPORARY STORAGE

TEMP2

CNTR				/COUNTER

SRFLG				/SAVE-RESTORE GROUP FLAG.

	.END
