C REFLECT EXTENDED CELL ADDRESSES BACK TO PRIME WORK AREA.
	SUBROUTINE REFLEC(ID1,ID2,ID)
C FORM ID OUT OF ID1,ID2 BUT USING REFLECTED VALUES SO THAT
C RESULT ID IS ALWAYS IN PRIME AREA.
	INCLUDE 'VKLUGPRM.FTN'
C ABOVE DEFINES LOGICALS USED
	InTEgeR*4 ICREF,IRREF,ID,ID1,ID2,IDD1,IDD2
	COMMON/MIRROR/ICREF,IRREF
	InTEgeR*4 FORMFG,RCFGX,PZAP,RCONE,RCMODE,IRCE1,
     1  IRCE2
	COMMON/FFGG/FORMFG,RCFGX,PZAP,RCONE,RCMODE,IRCE1,
     1  IRCE2
C DON'T MESS UP ARGUMENTS; USE INTERNAL COPY. ALSO MAY
C BE FASTER ON SOME ARCHITECTURES.
	IDD1=MAX0(ID1,1)
	IDD2=ID2
	IF(ID1.LT.1)GOTO 2000
C ALLOW TRICK ENTRIES WITH ID1=0 TO MEAN ID2 IS THE COMPLETE INDEX
C GMSUBS, MTXEQU AND MDET USE THESE CALLS
C TRICKERY HERE FIXES UP XVBLGT AND XVBLST
4000	CONTINUE
	IF(IDD2.LE.RRW)GOTO 1000
	IDD2=IDD2-RRW
	IDD1=IDD1+IRREF
c	RCMODE=0
C IF OFF ROOT AREA, CAN'T FIND DISPLAY SO FORCE FULL RECALC
C MODE (RI AND RE FAIL...)
	GOTO 4000
1000	CONTINUE
	IF(IDD1.LE.RCL)GOTO 2000
	IDD1=IDD1-RCL+1
	IDD2=IDD2+ICREF
c	RCMODE=0
C IF OFF ROOT AREA, CAN'T FIND DISPLAY SO FORCE FULL RECALC
C MODE (RI AND RE FAIL...)
	GOTO 4000
2000	CONTINUE
	ID=(IDD1-1)*RRW+IDD2
	RETURN
	END
