C**********************************************************************
C
	SUBROUTINE DEBUGF
C  Select debugging options
      INCLUDE 'COMMON.FTN'
	INCLUDE '[RADIX]INTERFACE.COM'
C
C	PRINT THE MENU AND GET AN OPTION
C
100	WRITE(ITYP,104) IRAW
104	FORMAT(/,' SELECT DEBUG OPTIONS:',/,
     &   '  0  print this menu',/,
     &   ' -1,0 disable output ',/,
     &   ' -1,',I2,' output to raw data file',/,
     &   ' -1,6 output to terminal',/,
     &   ' -1,7 output to FOR007.DAT',/,
     &   '  1,1  print times',/,
     &   '  2,1  dump common block status',/,
     &   '  3,1  view data comming from the radix databox',/,
     &   '  4,1  view angle, counts & temp at each step in scan',/,
     &   ' 18,n  write error messages on unit n',/,
     &   ' 19  list debug status',/,
     &   ' 20  back to main program',//
     &   ' (You can also view all the data comming from',/,
     &   ' the radix by saying $ RADIX$DEBUG:==YES',/,
     &   ' before you $ RUN AUTO.)',/)
110	WRITE(ITYP,114)
114	FORMAT(' Option number? ',$)
C
	READ(IRD,204,END=9999) IOPT1,IOPT2
204	FORMAT(2I)
C
C======================================================================
C
	IF(IOPT1.EQ.0) GOTO 100
	IF(IOPT1.EQ.-1) GOTO 1000
	IF(IOPT1.EQ.19) GOTO 1900
	IF(IOPT1.EQ.20) GOTO 9999
	IF(IOPT1.GT.0 .AND. IOPT.LE.20) GOTO 2000
	WRITE(ITYP,304)
304	FORMAT(' INVALID DEBUG OPTION; TRY AGAIN.')
	GOTO 100
C
C======================================================================
C
1000	IBUG=IOPT2
C	  WRITE(ITYP,1004)
C1004	  FORMAT(' Enter unit #',$)
	GOTO 110
C
C======================================================================
C
2000	NBUG(IOPT1)=IOPT2
	IF(IOPT1.EQ.3) DEBUG=(IOPT2.EQ.1)
	IF(IOPT1.EQ.18) IERR=IOPT2
	GOTO 110
C
C======================================================================
C
1900	WRITE(ITYP,1904) IERR, IBUG, NBUG
1904	FORMAT(/,' Error messages written to unit',I2,/,
     &  ' Debug messages written to unit',I2,/,
     &  ' Debug flags:',4(X,5I3))
	GOTO 110
C
C======================================================================
C
9999	RETURN
	END
