	.TITLE	.DJ	<COMPLETE ADB FOR ADJUSTABLE ARRAY>
/ 
/ 
/                   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 #000	9 FEB 1973		T.A. MURRAY
/
/ COPYRIGHT 1973, DIGITAL EQUIPMENT CORPORATION, MAYNARD, MASS. 01754
/
/	THIS FORTRAN IV OTS ROUTINE COMPLETES THE ARRAY DESCRIPTOR
/ BLOCK OF AN ADJUSTABLE ARRAY.  IT IS CALLED ONCE FOR EACH DUMMY
/ ARRAY IN A SUBPROGRAM THAT USES DUMMY PARAMETERS AS DIMENSIONING
/ INFORMATION.  IT COMPLETES THE DIMENSIONING INFORMATION IN THE ADB,
/ THE STARTING ADDRESS HAVING ALREADY BEEN PLACED INTO
/ THE ADB BY .DA.
/
/ CALLING SEQUENCE -
/
/	JMS*	.DJ
/	.DSA	ADDRESS OF LAST WORD OF THE LOCAL ADB FOR THIS ARRAY
/	.DSA	400000+ADDRESS IN DUMMY PARAMETER LIST OF ADJUSTABLE
/			FIRST DIMENSION .....
/	  OR
/	.DSA	CONSTANT, FIXED MAXIMUM VALUE OF THE FIRST DIMENSION
/	.DSA	SAME STUFF FOR SECOND DIMENSION, IF ANY
/	.DSA	SAME STUFF FOR THIRD DIMENSION, IF ANY
/
/ THE FORM OF THE ARRAY DESCRIPTOR BLOCK IS GIVEN BELOW.  ON ENTRY
/ TO .DJ, ONLY THE FIRST AND THE LAST WORDS ARE ASSUMED COMPLETE.
/ .DJ COMPLETES THE DIMENSION INFORMATION OF WORDS 2, 3 AND 4.
/
/	WD1: BITS 0-2 = NUMBER OF DIMENSIONS -1; BITS 16,17 = MODE
/	WD2: N*IMAX*JMAX*KMAX, THE ARRAY SIZE
/	WD3: N*IMAX
/	WD4: N*IMAX*JMAX
/	WD5: SA, ADRESS OF THE FIRST WORD OF THE ARRAY
/
/
	.GLOBL	.DJ
/
.DJ	CAL		/ SET UP.  LSTWD=.DJ, AND WILL INDEX THROUGH
	LAW	-4	/PARAMETER LIST.  ADBWD WILL INDEX THROUGHT THE ADB
	TAD*	LSTWD	/SUBTRACT 4 FROM ADB WD5 POINTER TO GET ADB WD1
	DAC	ADBWD	/POINTER.
	LAC*	ADBWD	/GET THE FIRST ADB WORD, SORT OUT NDIM-1 FOR USE AS
	LRSS	17	/A LOOP INDEX.
	CMA		/EFFECTIVELY GET 2'S COMP OF NUMBER OF DIMENS
	DAC	COUNT
	LLS!1000  17	/USE EAE TO CLA, THEN RECOVER MODE BITS
	SAD	(3)	/N= MODE+1, EXCEPT IF MODE=3, N=2. WHEN IS 3,
	RCR		/TURN IT INTO 1.  THEN ADD 1 TO ANY
	TAD	(1)	/VALUE
	DAC	N	/SAVE IT AS FIRST FACTOR IN MULTIPLICATION
/
	ISZ	ADBWD	/POINT TO ADBWD2; SAVE THIS ADDRESS, AS FINAL RESULT
	LAC	ADBWD	/IS PUT HERE.  IT IS ALSO USED FOR INTERMEDIATE
	DAC	ADBWD2	/RESULTS, AND IS THUS INITIALIZED TO ZERO
DJ02	DAC*	ADBWD	/ON FIRST ENTRY, THIS INSTRUCTION DOES NOTHING USEFUL.
	ISZ	ADBWD	/POINT TO 3RD, THEN 4TH AND 5TH ADB WORD
	ISZ	LSTWD	/POINT TO 1ST (THEN 2ND AND 3RD) DIMENSIONING
	LAC*	LSTWD	/VALUE, AND GET IT.  IF IT IS POSITIVE, IT IS
	SMA!CLL		/CONSTANT AND MAY BE USED IMMEDIATELY.
	JMP	DJ03	/OTHERWISE, WE HAVE A POINTER TO A DUMMY INTEGER
	DAC	DJ01	/POINTER.  FIRST GET THE DUMMY INTEGER POINTER
	LAC*	DJ01	/THEN SAVE IT, AND GET THE ACTUAL VALUE OF THE
	DAC	DJ01	/DUMMY INTEGER.
	LAC*	DJ01
DJ03	MUL		/MULTIPLY THE DIMENSIONING SIZE BY:
N	XX		/ 1. N, THE NUMBER OF WORDS PER ELEMENT
	LACQ		/ 2. N*IMAX; 3. N*IMAX*JMAX; 4. N*IMAX*JMAX*KMAX
	DAC*	ADBWD2	/AND SAVE IT IN THE FINAL LOCATION
	DAC	N	/AS WELL AS IN THE INTERMEDIATE MULTIPLIER
	ISZ	COUNT	/MULTIPLY ONCE FOR EACH DIMENSION
	JMP	DJ02	/MORE TO GO
/
	ISZ	LSTWD	/RETURN AT LOCATION JUST FOLLOWING PARAMETER
	JMP*	LSTWD	/LIST.
/
COUNT	LAW		/INDEX OF NUMBER OF DIMENSIONS, 2'S COMPLEMENT
ADBWD2	CAL		/ADDRESS OF SECOND WORD IN ADB
ADBWD	CAL		/POINTER TO ADB ENTRIES
LSTWD=.DJ			/POINTER TO PARAMETER LIST ENTRIES
DJ01	CAL		/TEMPORARY ADDRESS STORE
/
	.END
