C***********************************************************************
C
C  THIS SUBROUTINE ENABLES FREE-FORMAT ENTRY OF A FLOATING POINT VALUE
C  USING THE CRT, LIGHT PEN, AND FUNCTION BOX ONLY.
C
C***********************************************************************
      SUBROUTINE TOUCHT(VAL)
C                                       THE ONLY ARGUMENT IS VAL
C                                       USED TO RETURN THE VALUE
C                                       ENTERED.
      LOGICAL POINT,NEG,E
C                                       INCAM2 IS THE MENU USED FOR
C                                       THE TOUCHT DISPLAY.
      DATA P1,P2/5HINCAM,4H2BIN/
      DATA FOR,F1/5H(G12.,5H4)   /
C                                       READ INCAM2 FROM DISK.
      CALL MENCRT(P1,P2,-1)
C                                       DISPLAY IT.
 1    CALL MENCRT(P1,P2,1)
C                                       SET UP INITIAL VALUES.
      E=.FALSE.
   22 POINT=.FALSE.
      VAL=0.
      NEG=.FALSE.
C                                       DELETE DUMMY DISPLAYS.
      CALL CRT(5,1515)
      CALL CRT(5,1516)
C                                       SET COUNTER.
      IP=0
C                                       WAIT FOR TAG.
   3  IT=ITAGS(1500,1514,1514,4)
C                                       GO TO 5 IF DIGIT ENTERED
      IF(IT.LT.1510)GO TO 5
C                                       OTHERWISE GO TO APPROPRIATE
C                                       SECTION.
      IT=IT-1509
      GO TO (6,7,8,4,1),IT
C                                       IF "DELETE" WAS ENTERED
C                                       GO TO 1 AND START OVER.
C                                       DEC. PT WAS ENTERED.
    8 POINT=.TRUE.
      CALL CRT(5,1512)
      GO TO 3
C                                       EXPONENT INDICATOR WAS
C                                       ENTERED.
    7 E=.TRUE.
      X=VAL/10.**IP
      CALL CRT(5,1511)
      IF(NEG)X=-X
      GO TO 22
C                                       "-" WAS ENTERED.
    6 NEG=.TRUE.
      CALL CRT(4,1515)
      GO TO 3
C                                       DIGIT WAS ENTERED.
    5 X1=IT-1500
      VAL=VAL*10.+X1
      IF(POINT)IP=IP+1
      X1=VAL/10.**IP
      CALL CRT(2,1516,0020,0300,7,1,FOR,X1)
      GO TO 3
C                                       "END" WAS ENTERED.
    4 VAL=VAL/10.**IP
      IF(E)GO TO 10
      IF(NEG)VAL=-VAL
      GO TO 11
   10 I=VAL+0.1
      IF(NEG)I=-I
      VAL=X*10.**I
C                                       DELETE TOUCHT DISPLAY
C                                       AND RETURN.
   11 CALL MENCRT(P1,P2,0)
      CALL MENCRT(P1,P2,-2)
      CALL CRT(3,1516)
      RETURN
      END
