       SUBROUTINE side2(start,end,step,Ctime,NDIGIT)
C*************************************************************************
C*
C* PROGRAM TO SETUP PARAMETERS FOR RUN
C*
C* AUTOR: S.I.ZDZIESZYNSKI
C*
C**************************************************************************
       BYTE SCREEN(10),CURSOR(7),CURSOR2(8),DEVICE(5),DAB(4)
     & ,DEVICE2(5),DEVICE3(5),CURSOR3(8),CURSOR4(9),CURS(9)
       CHARACTER CR*1,DAT*9,TIM*8
       CHARACTER FILOUT*14,NAME*12,SLID*60,START*6,END*6,STEP*6
     &          ,CTIME*4
       
       DATA SCREEN /0,27,91,50,74, 27,91,63,54,108/  !CLEAR, SET ORGIN
       DATA CURSOR /0,27,91,51,59,51,102/         !CURSOR L3  R3
       DATA CURSOR2 /0,27,91,54,59,49,50,102/     !CURSOR L6  R12
       DATA CURSOR3 /0,27,91,49,50,59,50,102/     !CURSOR L12 R3
       DATA CURSOR4 /0,27,91,49,50,59,49,51,102/  !CURSOR L12 R12
       DATA DEVICE /0,27,91,49,109/  !INCREASE INTENSITY
       DATA DEVICE2 /0,27,91,55,109/ !NEGATIVE SCREEN
       DATA DEVICE3 /0,27,91,48,109/ !OFF
       COMMON /FILE/ FILOUT
       COMMON /USER/ NAME
       COMMON /SAMPLE/ SLID

C       PARAMETER CR=CHAR(13)
C      SET TERMINAL:  INCREASE INTENSITY
C                     BLINKING
C                     REVERS VIDEO
C                     YELOW DISPLAY
       DATA DAB /0,27,35,54/
C
C*** SET SCREEN AND TITLE
C

       WRITE(6,1)(SCREEN(I),I=1,10)
1      FORMAT(10A1)
       WRITE(6,3)(DEVICE(I),I=1,5)
3      FORMAT(5A1)


       CALL DATE(DAT)
       CALL TIME(TIM)
       WRITE(6,2)(CURSOR(I),I=1,7),(DAB(I),I=1,4),DAT,TIM
2      FORMAT(7A1,4A1,' DATE:',A9,3X,' TIME: ',A8)

       WRITE(6,8)(CURSOR2(I),I=1,8),(DAB(I),I=1,4)
8      FORMAT(8A1,4A1,' *** WDXS ***')

50     CURSOR(4)=57
       CURSOR(6)=50
       WRITE(6,6)(DEVICE(I),I=1,5),(CURSOR(I),I=1,7),(DEVICE2(I),I=1,5)
     & ,(DEVICE3(I),I=1,5),(DEVICE(I),I=1,5),(DEVICE2(I),I=1,5)  
     & ,(DEVICE3(I),I=1,5)
6      FORMAT(5A1,7A1,' FILE NAME:',5A1,14X,5A1,19X,5A1,
     & ' USER NAME:',5A1,15X,5A1)

       WRITE(6,7)(DEVICE(I),I=1,5),(CURSOR3(I),I=1,8),(DEVICE2(I),I=1,5)  
     & ,(DEVICE3(I),I=1,5)
7      FORMAT(5A1,8A1,' SAMPLE ID:',5A1,59X,5A1)

       CURSOR3(5)=53
       WRITE(6,4)(DEVICE(I),I=1,5),(CURSOR3(I),I=1,8),(DEVICE2(I),I=1,5)
     & ,(DEVICE3(I),I=1,5),(DEVICE(I),I=1,5),(DEVICE2(I),I=1,5)  
     & ,(DEVICE3(I),I=1,5)
4      FORMAT(5A1,8A1,' STARTING 2-THETA:',5A1,7X,5A1,10X,5A1,
     & ' 2-THETA STEP:',5A1,7X,5A1)

       CURSOR3(5)=56
       WRITE(6,5)(DEVICE(I),I=1,5),(CURSOR3(I),I=1,8),(DEVICE2(I),I=1,5)
     & ,(DEVICE3(I),I=1,5),(DEVICE(I),I=1,5),(DEVICE2(I),I=1,5)  
     & ,(DEVICE3(I),I=1,5)
5      FORMAT(5A1,8A1,'   ENDING 2-THETA:',5A1,7X,5A1,12X,5A1,
     & ' COUNT TIME:',5A1,2X,5A1)

      CURSOR2(4)=57
      CURSOR2(5)=59
      CURSOR2(6)=49
      CURSOR2(7)=51
      WRITE(6,31)(DEVICE(I),I=1,5)
31    FORMAT(5A1)

16    WRITE(6,9)(CURSOR2(I),I=1,8),(DEVICE2(I),I=1,5),FILOUT
9     FORMAT(8A1,5A1,A)      

      READ(6,15) FILOUT
15    FORMAT(A14)
      CURSOR2(6)=53
      CURSOR2(7)=55

      WRITE(6,18)(CURSOR2(I),I=1,8),(DEVICE2(I),I=1,5),NAME
18    FORMAT(8A1,5A1,A)  
      READ(6,19) NAME
19    FORMAT(A14)

      WRITE(6,21)(CURSOR4(I),I=1,9),(DEVICE2(I),I=1,5),SLID
21    FORMAT(9A1,5A1,A)
      READ(6,22) SLID
22    FORMAT(A60)

      CURSOR4(4)=49
      CURSOR4(5)=53
      CURSOR4(7)=50
      CURSOR4(8)=48
      WRITE(6,23)(CURSOR4(I),I=1,9),(DEVICE2(I),I=1,5),START
23    FORMAT(9A1,5A1,A)
      READ(6,24) START
24    FORMAT(A7)
      
      CURSOR4(4)=49
      CURSOR4(5)=56
      WRITE(6,25)(CURSOR4(I),I=1,9),(DEVICE2(I),I=1,5),END
25    FORMAT(9A1,5A1,A)
      READ(6,26) END
26    FORMAT(A7)

      CURSOR4(4)=49
      CURSOR4(5)=53
      CURSOR4(7)=53
      CURSOR4(8)=49
      WRITE(6,27)(CURSOR4(I),I=1,9),(DEVICE2(I),I=1,5),STEP
27    FORMAT(9A1,5A1,A)
      READ(6,28) STEP
28    FORMAT(A7)

      CURSOR4(5)=56
      WRITE(6,29)(CURSOR4(I),I=1,9),(DEVICE2(I),I=1,5),CTIME
29    FORMAT(9A1,5A1,A)
      READ(6,30)NDIGIT,CTIME
30    FORMAT(Q,A4)

      CURSOR3(4)=50
      CURSOR3(5)=52      
      CURSOR3(7)=52
17    WRITE(6,11)(CURSOR3(I),I=1,8),(DEVICE3(I),I=1,5),
     &(DEVICE2(I),I=1,5),(DEVICE3(I),I=1,5)
11    FORMAT(8A1,5A1,' PUSH RETURN TO START:',5A1)
     

14    READ(6,12) CR
12    FORMAT(A1)

      IF(CR.EQ.CHAR(32))THEN
      TYPE 10,(SCREEN(I),I=1,10)
10    FORMAT(10A1)
      GO TO 20
      ENDIF
      IF(CR.NE.CHAR(32))THEN
      TYPE 13,7,7,7,7,7
13    FORMAT(5A1)
      GO TO 14
      ENDIF
20    RETURN
      END     
