C
C   SUBROUTINE TO INPUT FROM THE CRT
C
      SUBROUTINE KEY
      INTEGER IN(5)/2,4,7,9,11/,NOTE(3),THM3(200,3)
      CHARACTER*3 AA,FLT/'FLT'/,SHP/'SHP'/,OK/'OK '/,END/'END'/
      CHARACTER*3 NUR(10),NME(110),TRG(5),DASH/'---'/
      CHARACTER*3 FOR(2)/'(A','3)'/
      LOGICAL LTPEN
      COMMON/CCC/ITAG,LTPEN,IX,IY
      COMMON/DDD/THM3,NST2
      COMMON/BBB/NME,NUR,TRG
      CALL CLEAR(.TRUE.)
C   DELETE ALL FILES UP TO ITAG 35
      DO 22 I=1,35
   22 CALL TEXT(3,I)
      NOTE(1)=0
      NC=1
      IX=780
      IY=960
      IX2=780
      NST2=0
      DO 3 I=1,8
      DO 2 J=1,12
      NC=NC+1
      DO 1 K=1,5
      IF(IN(K).EQ.J) GO TO 2
    1 CONTINUE
      AA=NME(NC)
      CALL TEXT(2,NC,IX,IY,7,1,FOR,AA)
      IX=IX+30
    2 CONTINUE
      IX=IX2-I*90
      IY=IY-60
    3 CONTINUE
      IX=60
      IY=270
      DO 4 I=1,10
      NC=NC+1
      AA=NUR(I)
      CALL TEXT(2,NC,IX,IY,7,1,FOR,AA)
      IX=IX+35
    4 CONTINUE
      IX=300
      IY=210
      DO 5 J=1,4
      NC=NC+1
      AA=TRG(J)
      CALL TEXT(2,NC,IX,IY,7,1,FOR,AA)
      IX=IX+50
    5 CONTINUE
      NC=NC+1
      AA=SHP
      IX=150
      IY=840
      CALL TEXT(2,NC,IX,IY,7,2,FOR,AA)
      NC=NC+1
      AA=FLT
      IX=720
      IY=600
      CALL TEXT(2,NC,IX,IY,7,2,FOR,AA)
      NC=NC+1
      AA=OK
      IX=60
      IY=90
      CALL TEXT(2,NC,IX,IY,7,2,FOR,AA)
      NC=NC+1
      AA=END
      IX=910
      IY=90
      CALL TEXT(2,NC,IX,IY,7,2,FOR,AA)
      IX=300
      IY=90
      DO 20 I=1,3
      NC=116+I
      AA=DASH
      CALL TEXT(2,NC,IX,IY,7,2,FOR,AA)
      IX=IX+90
   20 CONTINUE
      NC=1
      AA=NME(1)
      IX=450
      IY=360
      CALL TEXT(2,NC,IX,IY,7,2,FOR,AA)
   14 LTPEN=.FALSE.
   30 IF (LTPEN)GO TO 31
      GO TO 30
   31 N=ITAG
      IF(N.GT.97) GO TO 6
      NOTE(1)=N
      AA=NME(N)
      CALL TEXT(4,117,FOR,AA)
      GO TO 14
    6 N=N-97
      IF(N.GT.10) GO TO 7
      NOTE(2)=N
      AA=NUR(N)
      CALL TEXT(4,118,FOR,AA)
      GO TO 14
    7 N=N-10
      IF(N.GT.4) GO TO 8
      NOTE(3)=N
      AA=TRG(N)
      CALL TEXT(4,119,FOR,AA)
      GO TO 14
    8 N=N-4
      GO TO(9,10,11,12),N
    9 IF(NOTE(1).EQ.0) GO TO 14
      NOTE(1)=NOTE(1)+1
   13 AA=NME(NOTE(1))
      CALL TEXT(4,117,FOR,AA)
C   INTRODUCE A DELAY
      DO 100 KL=1,500
  100 X=12*3.14159
      GO TO 14
   10 IF(NOTE(1).EQ.0) GO TO 14
      NOTE(1)=NOTE(1)-1
      GO TO 13
   11 AA=DASH
      CALL TEXT(4,117,FOR,AA)
      CALL TEXT(4,118,FOR,AA)
      CALL TEXT(4,119,FOR,AA)
      DO 110 KL=1,500
  110 X=12*3.14159
      NST2=NST2+1
      DO 15 I=1,3
   15 THM3(NST2,I)=NOTE(I)
      GO TO 14
   12 RETURN
      END
