      SUBROUTINE RESET$
      INTEGER A,BC,DE,HL,CDRV
      BC=25
      CALL CPM$(A,BC,DE,HL)
      CDRV=A
      BC=13
      CALL CPM$(A,BC,DE,HL)
      DE=CDRV
      BC=14
      CALL CPM$(A,BC,DE,HL)
      RETURN
      END


      SUBROUTINE SELCT$(I)
      INTEGER A,BC,DE,HL,I
      BC=14
      DE=I
      CALL CPM$(A,BC,DE,HL)
      RETURN
      END


      SUBROUTINE KILL$(A$)
      INTEGER A,BC,DE,HL, DRV
      BYTE FCB$(35)
      BYTE A$(1), B$(32)
      EQUIVALENCE (B$(1),FCB$(2))
      CALL DEFD$(FCB$)
      CALL DEFD$(B$)
      DRV=NFORM$(B$,A$,1)
      DE=LOC$(FCB$)
      FCB$(1)=DRV
      BC=19
      CALL CPM$(A,BC,DE,HL)
      RETURN
      END


      SUBROUTINE REN$(A$)
      INTEGER A,BC,DE,HL, DRV
      BYTE FCB$(35)
      BYTE A$(1), B$(16), C$(16)
      EQUIVALENCE (B$(1),FCB$(2)), (C$(1),FCB$(18))
      CALL DEFD$(B$)
      CALL DEFD$(C$)
      CALL DEFD$(FCB$)
      IOS='@'
      IOS=IEOS$(IOS)
      DRV=NFORM$(C$,A$,1)
      I=MATCH$(A$,'=@',1)
      IF (I.EQ.0) GOTO 10
      I=I+1
      I=NFORM$(B$,A$,I)
      DE=LOC$(FCB$)
      FCB$(1)=DRV
      FCB$(17)=DRV
      BC=23
      CALL CPM$(A,BC,DE,HL)
      IOS=IEOS$(IOS)
10    RETURN
      END


      FUNCTION LOOK$(A$)
      INTEGER A,BC,DE,HL, DRV
      BYTE FCB$(35)
      BYTE A$(1), B$(32)
      EQUIVALENCE (B$(1),FCB$(2))
      CALL DEFD$(B$)
      CALL DEFD$(FCB$)
      DRV=NFORM$(B$,A$,1)
      DE=LOC$(FCB$)
      FCB$(1)=DRV
      BC=17
      CALL CPM$(A,BC,DE,HL)
      LOOK$=A
      RETURN
      END


      SUBROUTINE PUT$(A$)
      BYTE A$(80)
      J=LEN$(A$)
      IF(J.EQ.0)GO TO 20
      WRITE(5,10)(A$(I),I=1,J)
10    FORMAT(1X,80A1)
      RETURN
20    CONTINUE
      WRITE(5,30)
30    FORMAT(1X)
      RETURN
      END


      SUBROUTINE GET$(A$)
      BYTE A$(80)
      READ(5,10)A$
10    FORMAT(80A1)
      CALL STRIP$(A$)
      RETURN
      END


      SUBROUTINE WRITE$(A$,N)
      BYTE A$(80)
      INTEGER N
      J=LEN$(A$)
      IF(J.EQ.0)GO TO 20
      WRITE(N,10)(A$(I),I=1,J)
10    FORMAT(1X,80A1)
      RETURN
20    CONTINUE
      WRITE(N,30)
30    FORMAT(1X)
      RETURN
      END


      SUBROUTINE READ$(A$,N)
      BYTE A$(80)
      INTEGER N
      READ(N,10,END=20)A$
10    FORMAT(80A1)
      CALL STRIP$(A$)
      RETURN
20    CONTINUE
      N=-1
      RETURN
      END


      SUBROUTINE TRACE$(N)
      INTEGER N
      WRITE(5,10)N
10    FORMAT(1X,'***',I3,'***')
      RETURN
      END


C
C I$IN,S$IN,D$IN,C$IN are input subroutines which print a
C passed string and then wait for a input fron the console.
C I$IN inputs an integer, S$IN inputs a single precision
C value, D$IN inputs a double precision value, and C$IN
C inputs a string.
C
C eg.
C
C      DOUBLE PRECISION  D
C      BYTE A$(80)
C
C      CALL I$IN('INPUT AN INTEGER > @',I)
C      CALL S$IN('INPUT A SINGLE PRECISION VALUE > @',S)
C      CALL D$IN('INPUT A DOUBLE PRECISION VALUE > @',D)
C      CALL C$IN('INPUT A BYTE ARRAY OR STRING > @',A$)
C
      SUBROUTINE I$IN(A$,K)
      BYTE A$(1),B$(80),C$(40)
      COMMON /IO$IN/ B$,C$
      B$(1)=0
      C$(1)=0
      I=LEN$(A$)
      IF (I.EQ.0) GO TO 10
      WRITE(5,20) (A$(J),J=1,I)
10    READ(5,30) B$
      CALL STRIP$(B$)
      I=NVAL$(C$,B$,1)
      DECODE(C$,40) K
20    FORMAT(1X,80A1)
30    FORMAT(80A1)
40    FORMAT(9X,I10)
      END


      SUBROUTINE S$IN(A$,A)
      BYTE A$(1),B$(80),C$(40)
      COMMON /IO$IN/ B$,C$
      B$(1)=0
      C$(1)=0
      I=LEN$(A$)
      IF (I.EQ.0) GO TO 10
      WRITE(5,20) (A$(J),J=1,I)
10    READ(5,30) B$
      CALL STRIP$(B$)
      I=NVAL$(C$,B$,1)
      DECODE(C$,40) A
      RETURN
20    FORMAT(1X,80A1)
30    FORMAT(80A1)
40    FORMAT(9X,F21.11)
      END


      SUBROUTINE D$IN(A$,A)
      DOUBLE PRECISION A,D$IN
      BYTE A$(1),B$(80),C$(40)
      COMMON /IO$IN/ B$,C$
      B$(1)=0
      C$(1)=0
      I=LEN$(A$)
      IF (I.EQ.0) GO TO 10
      WRITE(5,20) (A$(J),J=1,I)
10    READ(5,30) B$
      CALL STRIP$(B$)
      I=NVAL$(C$,B$,1)
      DECODE(C$,40) A
      RETURN
20    FORMAT(1X,80A1)
30    FORMAT(80A1)
40    FORMAT(F40.21)
      END


      SUBROUTINE C$IN(A$,B$)
      BYTE A$(1),B$(80)
      I=LEN$(A$)
      IF (I.EQ.0) GO TO 10
      WRITE(5,20) (A$(J),J=1,I)
10    READ(5,30) B$
      CALL STRIP$(B$)
      RETURN
20    FORMAT(1X,80A1)
30    FORMAT(80A1)
      END
