Google
 

Trailing-Edge - PDP-10 Archives - bb-kl11c-bm_tops20_v6_1_atpch1_16 - autopatch/mscgen.c12
There are 3 other files named mscgen.c12 in the archive. Click here to see a list.
 REP 11/1	;12C1
	COPYRIGHT (C) 1974, 1983, 1984 BY DIGITAL EQUIPMENT CORPORATION
 WIT
	COPYRIGHT (C) 1974, 1983, 1984, 1985 BY DIGITAL EQUIPMENT CORPORATION
 INS 28/1	;12C2
	;MJC	18-JUL-85	[1604] SET FLAG ALITSV TO UPDATE CURIRG WHEN XPNLIT
	;				IS CALLED FOR INSPECT
	;MJC	21-JUN-85	[1600] Add code to INITIALIZE to do tables
 INS 17/13	;12C3
		SETOM	ALITSV##	;[1604]SET FLAG INCASE XPNLIT IS CALLED
 REP 13/14	;12C4
	FINTL3:	PUSHJ	PP,POOL		;POOLED ARGUMENT LIST!
 WIT
	FINTL3:	SETZM	ALITSV		;[1604]RESET XPNLIT FLAG
		PUSHJ	PP,POOL		;POOLED ARGUMENT LIST!
 INS 37/50	;12C5

 REP 5/51	;12C6
		ADDI	TC,1		; to point to first item
 WIT
		ADDI	TC,5		;[1600] Skip two dummy DATAB and VALTAB entries
 REP 23/51	;12C7
		LDB	TB,DA.SON##	;Is this an elementary item?
 WIT
		LDB	TB,DA.DLL##	;[1600] Is there a depending clause?
		JUMPN	TB,INITDP	;[1600]  at a lower level?
		LDB	TB,DA.OCC	;[1600] Is this an occurs item?
		SKIPE	TB		;[1600] No OK
		LDB	TB,DA.DEP##	;[1600]  depending on this level?
		JUMPE	TB,INIG2A	;[1600] No - OK
	INITDP:	MOVEI	DW,E.856	;[1600] Yes -- Can't Initialize it
		JRST	INIG2E		;[1600] Give error

	INIG2A:	LDB	TB,DA.SUB	;[1600] Subscript needed?
		JUMPE	TB,INIG2B	;[1600] No - Skip check
		PUSH	PP,TA		;[1600] Save TA		
		PUSHJ	PP,INSUBS	;[1600] Count the number of subscripts needed
		PUSHJ	PP,CNTSUB	;[1600] Go count given subscripts
		POP	PP,TA		;[1600] Restore TA
		CAMN	TB,SUBNUM##	;[1600] The same?
		JRST	INIG2B		;[1600] Yes - continue
		MOVEI	DW,E.250	;[1600] No - wrong number of subscripts
	INIG2E:	PUSHJ	PP,OPNFAT	;[1600] Give error
		JRST	INITGX		;[1600] Give up on this one

	INIG2B:	LDB	TB,DA.SON##	;[1600]Is this an elementary item?
 REP 36/51	;12C8
		PUSHJ	PP,INITG6	;Do the MOVE
	INITG4:	HLRZ	TA,CURDAT	;Get datab link back incase something moves
	INITG5:	PUSHJ	PP,LNKSET	;Get table address back
		LDB	TB,DA.BRO##	;Get brother link
 WIT
		PUSH	PP,CURDAT	;[1600] save curdat from subscr
		PUSHJ	PP,INITG6	;Do the MOVE
		POP	PP,CURDAT	;[1600] get curdat back
	INITG4:	HLRZ	TA,CURDAT	;Get datab link back incase something moves
		PUSHJ	PP,LNKSET	;[1600] Get table address back
	INITG5:	LDB	TB,DA.BRO##	;[1600] Get brother link
 REP 44/51	;12C9
		MOVE	TA,TB		;No, back up one and try again
		JRST	INITG5
 WIT
		MOVE	TA,TB		;No, back up one
		HRLZM	TA,CURDAT	;[1600] Save the pointer for later
		PUSHJ	PP,LNKSET	;[1600] Get table address
		LDB	TC,DA.OCC	;[1600] Is it a table?
		SKIPE	TC		;[1600]
		PUSHJ	PP,INITOC	;[1600] Yes - Go init the table
		JRST	INITG4
	;[1600] Define a macro to push entries in to EOPTAB when building operands
	;[1600] for calling MOVGEN.  Both A and B must be ACs.

	DEFINE	PUSHOP	(A,B)<		;[1600] Push B onto EOPTAB using pointer A
		MOVEM	B,(A)		;[1600] Save the data
		AOBJN	A,.+2		;[1600] Point to the next one
		PUSHJ	PP,EOPFUL	;[1600] Get more space if it overflowed
	> ;[1600] End define PUSHOP

	;[1600]Here to generate code to initialize the second and subsequent
	;[1600]occurences of a table.  The first occurence is copied to each of
	;[1600]the remaining occurences.  The code is generated as follows.
	;[1600]		MOVEI	0,number_of_occurences-1 ;Init the loop counter
	;[1600]		MOVEI	1,2		;move to subscript 2 first
	;[1600]		MOVE	1,-GENERATED-INITIALIZE-COUNTER- ;used by move code
	;[1600]	%n	|
	;[1600]	{Call MOVGEN to generate:
	;[1600]	MOVE table(1...1) TO table(1...1,-GENERATED-INITIALIZE-COUNTER-)}
	;[1600]		|
	;[1600]		AOS	-GENERATED-INITIALIZE-COUNTER- ;next subscript
	;[1600]		SOJG	0,%n		;loop to the last subscript	
	;[1600]The VALTAB entery (1) and DATAB entry (-GENERATED-INITIALIZE-COUNTER-)
	;[1600]are provided by phase D as operands to INITIALIZE.
	;[1600]
	;[1600]Note: This algorithm has a known side effect when the REPLACING clause
	;[1600]	     is used.  The standard states that items not of the replacing
	;[1600]	     type will be uneffected.  If a table occurence contains items
	;[1600]	     not of the replacing type then the group move used by this
	;[1600]	     algorithm will effect these items.  The value of all items is
	;[1600]	     set to the value of the first occurence.  It is assumed that
	;[1600]	     that in most cases a table containing valuable data will not
	;[1600]	     be initialized and that strait COBOL code can be used to aviod
	;[1600]	     this side effect when it does appear.  If this side effect is
	;[1600]	     required to be fixed then a new algorithm must be used for the
	;[1600]	     replacing case that does not use the group move.  The INITOC
	;[1600]	     routine could be replaced for the replacing case with a routine
	;[1600]	     that would generate elementary moves inside nested loops.  Each
	;[1600]	     nest of the loop would count off one of the required subscripts
	;[1600]	     through its range.  Only one set of nested loops would be needed
	;[1600]	     if the elementary moves are placed at the proper place in the
	;[1600]	     set of nested loops.  The DATAB entrys would be generated in
	;[1600]	     phase D after counting the number of subscripts that would be
	;[1600]	     needed.  Walk the DATAB tree saving occurs and items of the
	;[1600]	     replacement type in HLDTAB.  Clean entrys form HLDTAB when
	;[1600]	     no entrys of the correct type are found.  Walk down the HLDTAB
	;[1600]	     entrys generating looping code and elementary moves as needed
	;[1600]	     and saving the loop target tags in HLDTAB.  This algorithm
	;[1600]	     was not elaborated in this PCO because the side effect did not
	;[1600]	     seem serious enough to require the necessary coding effort.
	;[1600]	     It is included here in case of future need.

	INITOC: PUSH	PP,CURDAT	;[1600] Save DATAB pointer
		PUSH	PP,CUREOP	;[1600] Save where we are working
		;[1600]Count the number of subscripts needed
		;[1600]subtract the number that we were given in phase D.
		PUSHJ	PP,INSUBS	;[1600]count the levels of subscripts
		PUSHJ	PP,CNTSUB	;[1600]Get the number of subscripts given
		MOVE	TA,SUBNUM	;[1600]Get the level count back
		SUB	TA,TB		;[1600]The number of valtab entries needed
		MOVEM	TA,VSUBS##	;[1600]Save it for later
		;[1600]Save the end of EOPTAB
		MOVE	TD,EOPNXT	;[1600]the current end
		MOVEM	TD,EOPHLD##	;[1600]so we can clean up later
		;[1600]Gen MOVEI 0,number_of_occurrences - 1 for the loop counter
		SETZM	EAC		;[1600]Restart AC counter
		HLRZ	TA,CURDAT	;[1600]Get the saved curdat
		PUSHJ	PP,LNKSET	;[1600]Convert the relative address
		LDB	TB,DA.NOC	;[1600]How many we need to do
		SOS	TB		;[1600]Less one
		JUMPE	TB,INITO6	;[1600]OCCURS 1 TIMES - this code not needed
		MOVSI	CH,MOV##	;[1600]Gen <MOVEI 0,DA.NOC-1>
		HRRZ	TC,TB		;[1600]Get DA.NOC from TB
		PUSHJ	PP,PUT.LA	;[1600]Put it into the ASYFIL
		;[1600]Gen MOVEI 1,2 to initialize the subscript counter
		AOS	EAC		;[1600]Next AC
		MOVSI	CH,MOVEI.	;[1600]Use a MOVEI
		HRRI	CH,2		;[1600]Start with the second occurence
		MOVE 	TB,EAC		;[1600]Use this AC
		DPB	TB,CHAC##	;[1600]Put it in CH
		PUSHJ	PP,PUTASY##	;[1600]Gen MOVEI 1,2
		;[1600]Gen MOVEM 1,-GENERATED-INITIALIZE-COUNTER-
		;[1600]    This counter is used in the move code as a subscript.
		MOVE	TC,EOPLOC	;[1600]Off set from the top of EOP
		HRRZ	TB,2(TC)	;[1600]get the DATAB entry passed from D
		MOVEM	TB,EBASEA	;[1600]set up as 'A'
		HRRZI	TC,1(TC)	;[1600]Point to EOP for the init counter
		HRLZM	TC,OPERND	;[1600]Store it for the setopn code
		HRRZI	LN,EBASEA	;[1600]Set up as "A" for the PUT.AA call
		PUSHJ	PP,SETOPN	;[1600]Set up "A"
		MOVSI	CH,MOVEM.	;[1600]A move to memory instruction
		PUSHJ	PP,PUT.AA##	;[1600] MOVEM 1,-GENERATED-INITIALIZE-COUNTER-
		SOS	EAC		;[1600]Give AC back
		;[1600]Put a tag here so that we can do the move again.
	INITO5:	PUSHJ	PP,GETTAG	;[1600]Get a tag for the loop
		JUMPE	CH,INITO5	;[1600]Can't use tag 0
		MOVEM	CH,OCCTAG##	;[1600]Save the tag number
		PUSHJ	PP,PUTTAG##	;[1600]The tag goes here
		;[1600]Set up EOPTAB entrys to call MOVGEN
		;[1600]create the "from" datab entry and put it in EOPTAB
		MOVE	TD,EOPNXT	;[1600]the current end
		AOBJN	TD,INITO7	;[1600]point to empty spot
		PUSHJ	PP,EOPFUL	;[1600]Full- Expand EOPTAB
	INITO7:	SETZM	TB		;[1600]Start with zero. Use DPB to set fields
		PUSHOP	TD,TB		;[1600]Save it in EOPTAB
		MOVE	TA,TD		;[1600]point at the entry being built
		SOS	TA		;[1600]which is one back
		SETOM	TB		;[1600]To set some flags
		DPB	TB,EO.IDO##	;[1600]Set operand bit
		HRRZI	TB,%US.DS	;[1600]Usage is display for group move
		DPB	TB,EO.USG##	;[1600]Set usage
		HRRZ	TC,CUREOP	;[1600]Point to the current item
		HLRZ	TB,1(TC)	;[1600]The size of the given subscripts
		ADD	TB,VSUBS	;[1600]Plus the added VALTAB entrys
		HRLZ	TB,TB		;[1600]Put it in the left half
		HLR	TB,CURDAT	;[1600]the datab entry
		PUSHOP	TD,TB		;[1600]Put it in EOPTAB
		;[1600]add the VALTAB =1 enterys as needed
		MOVE	TC,EOPLOC	;[1600]get the start of this operator
		MOVE	TA,VSUBS	;[1600]Get the number of dummy "1" subscr
		JUMPE	TA,INITO4	;[1600]Don't need any
	INITO1:	MOVE	TB,3(TC)	;[1600]just the flag of the VALTAB entry
		PUSHOP	TD,TB		;[1600]Put it in EOPTAB
		MOVE	TB,4(TC)	;[1600]The VALTAB offset provided by phase D.
		PUSHOP	TD,TB		;[1600]Put it in EOPTAB
		SOJN	TA,INITO1	;[1600]Loop till done
		;[1600]Copy the given subscipts given in phase D so that
		;[1600]they can be used for the group move.
	INITO4:	MOVEM	TD,EOPNXT	;[1600]Save the pointer
		PUSHJ	PP,BLTEOP	;[1600]Copy the given subscripts
		;[1600]Set up EBASEA
	INITO3:	HRRZ	TC,EOPHLD	;[1600]Point to the A operand
		AOS	TC		;[1600]Starts one past the old end of EOPTAB
		HRLZM	TC,OPERND	;[1600]Start of the A operand in EOPTAB
		MOVEI	LN,EBASEA	;[1600]Set up A operand
		PUSHJ	PP,SETOPN	;[1600]Set up EBASEA flags and check subscripts
		MOVE	TD,EOPNXT	;[1600]Get the EOPTAB pointer back
		HRRM	TD,OPERND	;[1600]Start of the B operand in EOPTAB
		;[1600]create the "to" DATAB entry (copy "from" entry)
		MOVE	TA,EOPHLD##	;[1600]Offset from the old end of EOPTAB
		MOVE	TB,1(TA)	;[1600]Get the first of the two word
		PUSHOP	TD,TB		;[1600]Put it in EOPTAB
		MOVE	TB,2(TA)	;[1600]The same for the second word
		PUSHOP	TD,TB		;[1600]Put it in EOPTAB
		;[1600]get the DATTAB for the counter from COBOLD
		MOVE	TC,EOPLOC	;[1600]so we can offset from here
		MOVE	TB,1(TC)	;[1600]The DATAB entry form cobold
		PUSHOP	TD,TB		;[1600]Put it in EOPTAB
		MOVE	TB,2(TC)	;[1600]-GENERATED-INITIALIZE-COUNTER-
		;[1600]put it into EOPTAB as the last subscript
		PUSHOP	TD,TB		;[1600]Put it in EOPTAB
		;[1600]add n-1 VALTAB=1 entrys
		MOVEM	TD,EOPNXT	;[1600]Put the updated pointer back
		HRRZ	TC,CUREOP	;[1600]Point to the current item
		HLRZ	TB,1(TC)	;[1600]The size of the given subscripts
		ADD	TB,VSUBS	;[1600]Plus the added VALTAB entrys
		SOS	TB		;[1600]Less one
		JUMPE	TB,INITO2	;[1600]Only one subscript - skip this
		HRLI	TC,5(TA)	;[1600]address of second VALTAB entry
		PUSHJ	PP,BLTEP1	;[1600]Go copy the subscripts to EOPNXT
		;[1600]finish set up of ESIZEB 
	INITO2:	HRRZ	TC,OPERND	;[1600]Get the start of B back
		MOVEI	LN,EBASEB	;[1600]Point to B
		PUSHJ	PP,SETOPN	;[1600]Set up B operand
		;[1600]call MOVGEN to generate one group move.
		PUSHJ	PP,GRPMOV	;[1600]Should be a group move
		PUSHJ	PP,MXX.		;[1600]The general move routine
		;[1600]Gen AOS -GENERATED-INITIALIZED-COUNTER-
		;[1600]	  to point at the next subscript to initialize
		MOVE	TC,EOPLOC	;[1600]Get the counter entry
		HRRZ	TB,2(TC)	;[1600]The DATAB entry
		MOVEM	TB,EBASEA	;[1600] for ebasea
		HRRZI	TC,1(TC)	;[1600]Set up a pointer into EOPTAB
		HRLZM	TC,OPERND	;[1600]point at -GEN..COUNTER-
		HRRZI	LN,EBASEA	;[1600]use -GEN..COUNTER- in the instruction
		PUSHJ	PP,SETOPN	;[1600]set it up as A temporarily
		MOVSI	CH,AOS.##	;[1600]GEN <AOS -GENERATED-INITIALIZE-COUNTER->
		PUSHJ	PP,PUT.A##	;[1600]Call to generate OP EBASEA
		;[1600]Gen SOJG 0,%n to jump back to the group move if all of the
		;[1600]    occurrences have not been initialized.
		HRRZ	TA,OCCTAG	;[1600]Get the saved tag
		PUSHJ	PP,REFTAG##	;[1600]I am using the tag here
		MOVSI	CH,SOJG.##	;[1600]GEN  SOJG AC,OCCTAG
		MOVE	TE,EAC		;[1600]Use this AC
		DPB	TE,CHAC		;[1600] for the test
		HRR	CH,OCCTAG	;[1600]Jump back to saved tag
		PUSHJ	PP,PUTASY	;[1600]Put the instruction into ASYFIL
		;[1600]All done. Restore the things we stepped on.
	INITO6:	MOVE	TD,EOPHLD	;[1600]Get the old eopnxt
		MOVEM	TD,EOPNXT	;[1600] and put it back
		POP	PP,CUREOP	;[1600] Get saved pointer back
		POP	PP,CURDAT	;[1600] Restore Father pointer
		POPJ	PP,		;[1600] initialize the occurs
		
	;[1600]Count the number of subscripts needed by MOVGEN to generate
	;[1600]a move to the DATAB item in CURDAT.
	;[1600]Return the count in SUBNUM.
		
	INSUBS: HLRZ	TA,CURDAT	;[1600]count from here
		PUSHJ	PP,LNKSET	;[1600]get the absolute address
		SETZM	SUBNUM## 	;[1600]Start with zero subscripts
		LDB	TB,DA.OCC##	;[1600]occurs on this level?
		SKIPE	TB		;[1600]no - start with 0
		AOS	SUBNUM		;[1600]yes - start with 1
	INSUB2:	LDB	TA,DA.OCH## 	;[1600]is there one above?
		SKIPN	TA	 	;[1600]jump if so
		POPJ	PP,		;[1600]done
		AOS	SUBNUM		;[1600]bump count
		PUSHJ	PP,LNKSET	;[1600]Get the address
		JRST	INSUB2		;[1600]loop for more

	;[1600]Count the number of subscripts passed in EOPTAB from phase D.
	;[1600]CUREOP points to the subscripted data item.
	;[1600]The count is returned in TB and GSUB.

	CNTSUB:	SETZM	GSUB##		;[1600]Start with zero given subscripts
		MOVE	TC,CUREOP	;[1600]Point to the current item
		HLRZ	TA,1(TC)	;[1600]initialize the counter
		JUMPN	TA,CNTSB1	;[1600]Subscripts?
		SETZM	TB		;[1600]No
		POPJ	PP,		;[1600]done
	CNTSB1:	ADDI	TC,2		;[1600]Point to the next one
		MOVE	TB,(TC)		;[1600]Get the flags
		TLNE	TB,GNLIT	;[1600]Is it a dataname?
		JRST	CNTSB2		;[1600]No - skip adder check
		HLRZ	TB,1(TC)	;[1600]Get the flag
		JUMPE	TB,CNTSB2	;[1600]Is there an adder?
		ADDI	TC,2		;[1600]Yes - bump past it
		SOS	TA		;[1600]And count it
	CNTSB2:	AOS	GSUB		;[1600]No - bump the count
		SOJG	TA,CNTSB1	;[1600]Loop till done
		HRRZ	TB,GSUB		;[1600]Put the result in TB
		POPJ	PP,		;[1600]Done

	;[1600] Here to expand EOPTAB

	EOPFUL: PUSHJ	PP,XPNEOP##	;[1600]Call the table expanding routine
		HLRZ	TE,EOPHLD	;[1600]get saved size
		SUBI	TE,^D20		;[1600]The table was expanded by 20
		HRLM	TE,EOPHLD	;[1600]so update it
		HLRZ	TE,TD		;[1600]get the EOPTAB stack pointer
		SUBI	TE,^D20		;[1600]Update it too
		HRLM	TE,TD		;[1600]put it back
		HLRE	TE,EOPNXT	;[1600]Was that enough?
		JUMPGE	TE,EOPFUL	;[1600]NO - jump back and do it again
		POPJ	PP,		;[1600]done

	;[1600] Here to copy a set of subscripts from one part of EOPTAB to
	;[1600] EOPNXT.  Enter with CUREOP pointing to the from location or
	;[1600] at BLTEP1 with TC pointing to the source and TB holding the size
	;[1600] of the block to be moved.

	BLTEOP:	HRRZ	TE,CUREOP	;[1600]Start of an item from phase D
		HLRZ	TB,1(TE)	;[1600]The size of the subscripts given
		JUMPE	TB,CPOPJ	;[1600]None - Don't need to do the BLT
		HRLI	TC,2(TE)	;[1600]The first subscript starts here
	BLTEP1:				;[1600]Enter here with TB and TC set up
		HRR	TC,EOPNXT	;[1600]Put the copy here
		LSH	TB,1		;[1600]Two words per subscript entry
		HRL	TB,TB		;[1600]2*subnum,,2*subnum
		ADDB	TB,EOPNXT	;[1600]Point to the end of the copy area
		HLRE	TE,EOPNXT	;[1600]Must check for EOPTAB overflow
		SKIPL	TE		;[1600]No - OK
		PUSHJ	PP,EOPFUL	;[1600]Overflow - Go expand EOPTAB
		HRRZ	TB,TB		;[1600]Zero left half
		SOS	TB		;[1600]The last subscript goes here
		BLT	TC,(TB)		;[1600]Copy the subscripts
		POPJ	PP,		;[1600]Done
 REP 49/51	;12C10
	INITG6:	LDB	TB,DA.CLA
 WIT
	INITG6:	PUSH	PP,CUREOP	;[1600]Save the item we are working on
		PUSHJ	PP,INITEL	;[1600]Set up subscripts
		SETZ	TB,		;[1600]Zero out the pointer to "A"
		HRLM	TB,OPERND	;[1600]"A" is not in EOPTAB
		LDB	TB,DA.CLA
 REP 58/51	;12C11
		JUMPE	TE,MFCX.	;No
 WIT
		JUMPE	TE,INIG6C	;[1600]No
 REP 64/51	;12C12
		JRST	MFCX.##		;Call MOVGEN
 WIT
	INIG6C:	PUSHJ	PP,MFCX.##	;[1600]Call MOVGEN at Move Figurative Constant.
		MOVE	TD,EOPHLD	;[1600]Get the old eopnxt
		MOVEM	TD,EOPNXT	;[1600] and put it back
		POP	PP,CUREOP	;[1600]get saved pointer back
		POPJ	PP,		;[1600]
 REP 1/52	;12C13
	;Here to see if current elememtary item is eligible for MOVE
	;Enter with TA = datab link
	;Return .+1 if MOVE cannot be done
 WIT
	;Here to see if current elementary item is eligible for MOVE
	;[1600]If the elementary item has an occurs clause then initialize it.
	;Enter with TA = datab link
	;[1600]Return .+1 if MOVE cannot be done or an occurs item was initialized.
 REP 9/52	;12C14
		JUMPN	TB,CPOPJ	;Ignore indexed data items
 WIT
		JUMPN	TB,INITG1	;[1600]Indexed elementary special case
 INS 22/52	;12C15
		AOS	(PP)		;[1600]Set for OK return
		LDB	TB,DA.SUB	;[1600]Do we need a subscript?
		SKIPE	TB		;[1600]If so
		POPJ	PP,		;[1600]Not the simple case - exit
 REP 27/52	;12C16
		AOS	(PP)		;Set for OK return
		JRST	SETOPN##	;Return with "B" operand set up
 WIT
		PUSH	PP,CUREOP	;[1600]Save the pointer
		PUSHJ	PP,SETOPN##	;Return with "B" operand set up
		POP	PP,CUREOP	;[1600]Get it back
		POPJ	PP,		;[1600] Return

	;[1600] Here for the special case of an occurs clause with a picture clause
	;[1600] In this case the elementary item and the occurrences of it are
	;[1600] here and the plus 1 return is taken

	INITG1:	MOVE	W1,OPLINE	;[1600]Get operator back
		TLNE	W1,OPM.IZ	;[1600]Replacing clause?
		JRST	INITR1		;[1600]Initialize with the replacing item
		PUSH	PP,CURDAT	;[1600]Save curdat
		PUSHJ	PP,INITG6	;[1600]Init the first one
		POP	PP,CURDAT	;[1600]Get curdat back
		PJRST	INITOC		;[1600]Do the rest of them

	INITR1: PUSHJ	PP,INITRA	;[1600]Set up "A"
		SETOM	REPFLG		;[1600]Flag that an item was found
		PUSHJ	PP,INIMV	;[1600]INIT the first one
		PJRST	INITOC		;[1600]Go do the rest
	;[1600]Here to set up subscripts for an elementary move
	;[1600]If subscripts are needed to generate a MOVE to the current item
	;[1600]then provide a subscript of (1,...,1) for MOVGEN
	;[1600]Otherwize return.

	INITEL:	MOVE	TD,EOPNXT	;[1600]the current end
		MOVEM	TD,EOPHLD##	;[1600]so we can clean up later
		HLRZ	TA,CURDAT	;[1600]Get the DATAB pointer to be sure
		PUSHJ	PP,LNKSET	;[1600]Get the absolute address
		LDB	TB,DA.SUB##	;[1600]Does this item need a subscript?
		JUMPE 	TB,INIEL4	;[1600]no - clean up and exit
		PUSH	PP,TA		;[1600]Save the datab pointer
		;[1600]Count the number of subscripts needed
		;[1600]subtract the number that we were given
		PUSHJ	PP,INSUBS	;[1600]count levels of subscripts for curdat
		PUSHJ	PP,CNTSUB	;[1600]count the subscripts from phase D
		MOVE	TA,SUBNUM	;[1600]get the count back
		SUB	TA,TB		;[1600]The number of valtab entries needed
		MOVEM	TA,VSUBS	;[1600]Save it for later
		;[1600]Save the end of EOPTAB
		MOVE	TD,EOPNXT	;[1600]in case td was stepped on
		AOBJN	TD,INIEL5	;[1600]point to empty spot
		PUSHJ	PP,EOPFUL	;[1600]Full- Expand EOPTAB
		;[1600]set the pointer to the B operand for movgen
	INIEL5:	HRRM	TD,OPERND	;[1600]Start of the B operand in EOPTAB
		;[1600]create the "to" datab entry and put it in EOPTAB
		SETZM	TB		;[1600]Start with zero. Use DPB to set fields
		PUSHOP	TD,TB		;[1600]Save it in EOPTAB
		MOVE	TA,CUREOP	;[1600]get the line number of this item
		LDB	TC,EO.LN##	;[1600]from the EOPTAB entry
		MOVE	TA,TD		;[1600]point at the entry being built
		SOS	TA		;[1600]which is one back
		SETOM	TB		;[1600]To set some flags
		DPB	TB,EO.IDO##	;[1600]Set operand bit
		HRRZI	TB,%US.DS	;[1600]Usage is display for group move
		DPB	TB,EO.USG##	;[1600]Set usage
		DPB	TC,EO.LN##	;[1600]LN for truncation warnings
		HRRZ	TC,CUREOP	;[1600]Point to the current item
		HLRZ	TB,1(TC)	;[1600]The size of the given subscripts
		ADD	TB,VSUBS	;[1600]Plus the added VALTAB entrys
		HRLZ	TB,TB		;[1600]Put it in the left half
		HLR	TB,CURDAT	;[1600]the datab entry
		PUSHOP	TD,TB		;[1600]Put it in EOPTAB
		;[1600]add the VALTAB =1 enterys as needed
		HRRZ	TC,EOPLOC	;[1600]Offset from here
		MOVE	TA,VSUBS	;[1600]Get the count of subscripts back
		JUMPE	TA,INIEL2	;[1600]Don't need any
	INIEL1:	MOVE	TB,3(TC)	;[1600]just the flag of the VALTAB entry
		PUSHOP	TD,TB		;[1600]Put it in EOPTAB
		MOVE	TB,4(TC)	;[1600]The VALTAB offset provided by phase D.
		PUSHOP	TD,TB		;[1600]Put it in EOPTAB
		SOJN	TA,INIEL1	;[1600]Loop till done
		;[1600]copy the given subscripts
	INIEL2:	MOVEM	TD,EOPNXT	;[1600]Save the counter
		PUSHJ	PP,BLTEOP	;[1600]Copy the given subscripts
		;[1600]Set up EBASEB etc
	INIEL3:	HRRZ	TC,OPERND	;[1600]get the EOPTAB pointer
		MOVEI	LN,EBASEB	;[1600]Set up "B"
		PUSHJ	PP,SETOPN	;[1600]Set it up
		;[1600]Restore the absolute DATAB pointer saved on the stack
		POP	PP,TA		;[1600]get the datab pointer back
	INIEL4:	POPJ	PP,		;[1600]go do the move
 REP 3/53	;12C17
	INITRP:	CAIL	TC,-2(EACA)	;Do we have at least 2 operands?
		JRST	BADEOP		;No, error
 WIT
	INITRP:	CAIL	TC,-4(EACA)	;Do we have at least 3 operands?
		JRST	BADEOP		;No, error
		HRRZ	TB,(EACA)	;[1600]Size of the replacing item
		HRRZ	TA,(EACA)	;[1600]Save it for the check
		AOS	TB		;[1600]Plus one for the size entry
		LSH	TB,1		;[1600]Two words per entry
		HRL	TB,TB		;[1600]Do the left half too
		SUB	EACA,TB		;[1600]Adjust the pointer
		HLRZ	TB,(EACA)	;[1600]Get the entry count
		CAME	TB,TA		;[1600]The same?
		JRST	BADEOP		;[1600]NO - Must be bad ref. mod.
		MOVEM	EACA,REPSAV#	;[1600]Save it for later
 REP 45/53	;12C18
	INITR2:	MOVE	TC,CUREOP
 WIT
	INITR2:	SETZM	REPFLG##	;[1600] Flag no items initialized
		MOVE	TC,CUREOP
 REP 54/53	;12C19
		JUMPN	TB,INITGX	;Give up if error found
		LDB	TB,DA.SON	;Is this an elementary item?
 WIT
		JUMPN	TB,INITRX	;Give up if error found
		LDB	TB,DA.DLL##	;[1600] Is there a depending clause?
		JUMPN	TB,INIRDP	;[1600]  at a lower level?
		LDB	TB,DA.OCC	;[1600] Is this an occurs item?
		SKIPE	TB		;[1600] No OK
		LDB	TB,DA.DEP##	;[1600]  depending on this level?
		JUMPE	TB,INIR2A	;[1600] No - OK
	INIRDP:	MOVEI DW,E.856		;[1600] Yes -- Can't Initialize it
		JRST	INIR2E		;[1600] Give error

	INIR2A:	LDB	TB,DA.SUB	;[1600] Subscript needed?
		JUMPE	TB,INIR2B	;[1600] No - Skip check
		PUSH	PP,TA		;[1600] Save the DATAB pointer		
		PUSHJ	PP,INSUBS	;[1600] Count the number of subscripts needed
		PUSHJ	PP,CNTSUB	;[1600] Count the subscripts given
		POP	PP,TA		;[1600] Restore the saved DATAB pointer
		CAMN	TB,SUBNUM##	;[1600] The same?
		JRST	INIR2B		;[1600] Yes - continue
		MOVEI	DW,E.250	;[1600] No - wrong number of subscripts
	INIR2E:	PUSHJ PP,OPNFAT		;[1600] Give error
		JRST  INITRX		;[1600] Give up on this one

	INIR2B:	LDB	TB,DA.SON##	;[1600]Is this an elementary item?
 REP 79/53	;12C20
		PUSHJ	PP,MXX.##	;Do the MOVE
	INITR4:	HLRZ	TA,CURDAT	;Get datab link back incase something moves
	INITR5:	PUSHJ	PP,LNKSET	;Get table address back
		LDB	TB,DA.BRO##	;Get brother link
 WIT
		SETOM	REPFLG		;[1600] Flag that one was found
		PUSHJ	PP,INIMV	;[1600] Do the MOVE
	INITR4:	HLRZ	TA,CURDAT	;Get datab link back incase something moves
		PUSHJ	PP,LNKSET	;[1600] Get table address back
	INITR5:	LDB	TB,DA.BRO##	;[1600] Get brother link
 REP 87/53	;12C21
		MOVE	TA,TB		;No, back up one and try again
		JRST	INITR5
 WIT
		MOVE	TA,TB		;No, back up one
		HRLZM	TA,CURDAT	;[1600] Save the pointer for later
		PUSHJ	PP,LNKSET	;[1600] Get table address
		LDB	TC,DA.OCC	;[1600] Is it an occurs table?
		SKIPE	TC		;[1600]
		SKIPN	REPFLG		;[1600] Don't init if no items found
		SKIPA			;[1600]
		PUSHJ	PP,INITOC	;[1600] Yes - Go init the table
		JRST	INITR4		;[1600] Go do next brother or father
 REP 93/53	;12C22
		HRRZ	TC,EOPNXT
 WIT
		HRRZ	TC,REPSAV	;[1600]Get pointer to REPLACING item
 REP 118/53	;12C23
		PUSHJ	PP,MXX.##	;Do the MOVE
	;	JRST	INITRX		;See if any more
 WIT
		PUSHJ	PP,INIMV	;[1600]Do the MOVE
		JRST	INITRX		;[1600]See if any more

	;[1600]Here to move the replacing item

	INIMV:	PUSH	PP,CUREOP	;[1600]Save current EOPTAB
		PUSHJ	PP,INITEL	;[1600]Set up subscripts for B
		PUSH	PP,CURDAT	;[1600]save curdat
		PUSHJ	PP,MXX.##	;[1600]Call MOVGEN
		POP	PP,CURDAT	;[1600]restore curdat
		MOVE	TD,EOPHLD	;[1600]Get the saved EOPTAB pointer
		MOVEM	TD,EOPNXT	;[1600]Return the EOPTAB space used
		POP	PP,CUREOP	;[1600]Restore the pointer
		POPJ	PP,		;[1600]
 REP 126/53	;12C24
		MOVE	EACA,EOPNXT
 WIT
		MOVE	EACA,REPSAV	;[1600]Get the start of the replacing item
 SUM 147434