      SUBROUTINE SSUD(STR,FIN,CSTR,CFIN,YMIN,YMAX
     &,CYMIN,CYMAX,YCR,ISP,JSP,DSP,IFL,INST,YL,DSPACE,IX)
C
C READS SPAN OF X&Y AXIS
C CSTR,CFIN,CYMIN, & CYMAX CAN BE SUPPLIED HERE
C
C    SSUD  MEANS START STOP UP DOWN
C
      BYTE ISP,JSP,DSP,IFL,IX
      XMIN=99999.
      XMAX=-999.
C  ADDED RPG 3/12/85
	IF(INST.EQ.'ED') THEN
33	WRITE(6,1101) STR,FIN
1101	FORMAT(1X,'MINIMUM ENERGY=',F7.3,'  MAXIMUM ENERGY=',F7.3)
	WRITE(6,1102)
1102	FORMAT(1H$,'MINIMUM ENERGY=')
	READ(5,40,END=9999) XMIN
	WRITE(6,1103)
1103	FORMAT(1H$,'MAXIMUM ENERGY=')
	READ(5,40,END=9999) XMAX
	IF(XMIN.LE.0.0) XMIN=STR
	IF(XMAX.LE.0.0) XMAX=FIN
	IF(XMIN.GT.XMAX) GO TO 33
	CSTR=XMIN
	CFIN=XMAX
	GO TO 110
	ENDIF
C
      IF(INST.NE.'DI') GO TO 10
      D1=YL/(2.0*SIN(0.008726646*STR))
      D2=YL/(2.0*SIN(0.008726646*FIN))
      WRITE(6,30) D1,D2
   30 FORMAT(1X,'MAXIMUM DSPACE =',F7.3,2X,'MINIMUM DSPACE =',F7.3)
   10 IF(INST.NE.'XR') GO TO 11
      XL1=DSPACE*SIN(0.008726646*STR)
      XL2=DSPACE*SIN(0.008726646*FIN)
      WRITE(6,31) XL1,XL2
   31 FORMAT(1X,'MINIMUM LAMDA =',F7.3,'  MAXIMUM LAMDA =',F7.3)
   11 WRITE(6,32) STR,FIN
   32 FORMAT(1X,'MINIMUM 2THETA=',F7.3,'  MAXIMUM 2THETA=',F7.3)
      IF(IX.EQ.1.AND.INST.EQ.'DI') GO TO 100
  200 WRITE(6,6)
    6 FORMAT(1H$,'MINIMUM 2THETA=')
      READ(5,40,END=9999) XMIN
   40 FORMAT(F12.0)
      IF(XMIN.GT.180.00) CALL ERRMES(1)
      IF(XMIN.GT.180.00) GO TO 200
      IF(XMIN.LE.0.0) XMIN=STR
  201 WRITE(6,7)
    7 FORMAT(1H$,'MAXIMUM 2THETA=')
      READ(5,40,END=9999) XMAX
      IF(XMAX.GT.180.) CALL ERRMES(1)
      IF(XMAX.GT.180.) GO TO 201
      IF(XMAX.LE.0.0) XMAX=FIN
      IF(XMIN.GT.XMAX) CALL ERRMES(2)
      IF(XMIN.GT.XMAX) GO TO 11
      CSTR=XMIN
      CFIN=XMAX
      GO TO 110
  100 WRITE(6,1000)
 1000 FORMAT(1H$,'MAXIMUM DSPACING > ')
      READ(5,40,END=9999) XMAX
      IF(XMAX.GT.99.9) CALL ERRMES(1)
      IF(XMAX.GT.99.9) GO TO 100
      IF(XMAX.LE.0.0) XMAX=D1
      WRITE(6,1100)
 1100 FORMAT(1H$,'MINIMUM DSPACING > ')
  202 READ(5,40,END=9999) XMIN
      IF(XMIN.GT.99.9) CALL ERRMES(1)
      IF(XMIN.GT.99.9) GO TO 202
      IF(XMIN.LE.0.0) XMIN=D2
      IF(XMIN.GT.XMAX) CALL ERRMES(2)
      IF(XMIN.GT.XMAX) GO TO 100
      CSTR=114.592*ASIN(YL/(2.0*XMAX))
      CFIN=114.592*ASIN(YL/(2.0*XMIN))
  110 IF(YMAX.LT.10000.0) GO TO 20
      WRITE(6,35) YMIN,YMAX
   35 FORMAT(1X,'MINIMUM INTENSITY =',F12.1'  MAXIMUM INTENSITY ='
     ,F12.1)
      GO TO 25
   20 IF(YMAX.LT.100.0) GO TO 21
      WRITE(6,36) YMIN,YMAX
   36 FORMAT(1X,'MINIMUM INTENSITY =',F10.2,'  MAXIMUM INTENSITY ='
     1,F10.2)
      GO TO 25
   21 IF(YMAX.LT.1.0) GO TO 22
      WRITE(6,37) YMIN,YMAX
   37 FORMAT(1X,'MINIMUM INTENSITY =',F9.3,'  MAXIMUM INTENSITY =',F9.3)
      GO TO 25
   22 WRITE(6,38) YMIN,YMAX
   38 FORMAT(1X,'MINIMUM INTENSITY =',F10.7,'  MAXIMUM INTENSITY ='
     1,F10.7)
   25 WRITE(6,8)
    8 FORMAT(1H$,'MINIMUM INTENSITY =')
      READ(5,40,END=9999) ZMIN
      WRITE(6,9)
    9 FORMAT(1H$,'MAXIMUM INTENSITY =')
      READ(5,40,END=9999) ZMAX
      IF(ZMAX.EQ.0.0) ZMAX=YMAX
      CYMIN=ZMIN
      IF(YMIN.LT.0.0.AND.ZMIN.EQ.0.0) CYMIN=YMIN
      CYMAX=ZMAX
      RETURN
 9999 STOP
      END
C
      SUBROUTINE ERRMES(IM)
C
      IF(IM.EQ.2) GO TO 100
      TYPE *,' '
      TYPE *,'********************************************************'
      TYPE *,'   DID YOU USE A DECIMAL POINT IE 20. NOT 20'
      TYPE *,'******************************************************'
      TYPE *,' '
      RETURN
  100 TYPE *,' '
      TYPE *,'********************************************************'
      TYPE *,' THE MAXIMUM HAS TO BE SMALLER THAN THE MINIMUM'
      TYPE *,'********************************************************'
      TYPE *,' '
      RETURN
      END
