C     .TITLE TPULSE
C
C  15 JUL 77 (PDH) ADD EXERCISE OF FCN=5
C   7 JUL 77 (PDH) DO INTERACTIVE SELECTION OF STORED FRAME
C  29 JUN 77 (PDH) ENABLE CALLS TO 'PULSE' AGAIN
C   2 FEB 77 (PDH) TRY TO MAKE IT WORK WITH DEC FORTRAN & XVM/RSX
C  31 MAR 76 (PDH) MAKE BOX GET SMALLER
C   4 MAR 76 (PDH) CHECK IT OUT WITH F4
C   3 MAR 76 (PDH) CONTINUE CHECK-OUT OF NEW PULSE
C  19 FEB 76 (PDH) CONVERT TO 'DSPLAY' AND NEW PULSE
C  25 FEB 74 - PAUL HENDERSON
C
C  TEST PROGRAM FOR SUBROUTINE 'PULSE'.
C
      LOGICAL ISENSW
      INTEGER IVECT(200)
      REAL PICT (4,2),PIC (2,20),KTHETA
      REAL FMT(1)
      COMMON /LIMITS/XMIN,XMAX,YMIN,YMAX
      DATA FMT(1)/4H(I7)/
C
  99  FORMAT (I6,7H FRAMES)
  98  FORMAT (20H INPUT FRAME NUMBER:)
  97  FORMAT (I6)
  96  FORMAT (I8,' BLOCKS IN REPLAY FILE')
C
   1  XMIN = -1.
      XMAX = +1.
      YMIN = -1.
      YMAX = +1.
      K = 0
      THETA = 3.14159265/32.
C
      CALL CLEAR
      CALL PREAL (9)
      CALL DSPLAY (0,3000,IERR,IGET)
      CALL TEXT (2,32000,600,0,7,2,FMT,0)
      CALL PULSE (5,K2)
      WRITE (4,96) K2
C
C  FIND HOW MANY FRAMES ARE RECORDED ON DISK
C
      IF (ISENSW(15)) GO TO 11
      CALL PULSE (1,ICOUNT)
      WRITE (4,99) ICOUNT
      K = ICOUNT
C
C  GENERATE A SET OF AXES
C
  11  PICT(1,1) = 0.
      PICT(2,1) = 1.
      PICT(3,1) = 0.
      PICT(4,1) = -1.
      PICT(1,2) = -1.
      PICT(2,2) = 0.
      PICT(3,2) = 1.
      PICT(4,2) = 0.
C
C  NOW GENERATE A DISPLAY FILE
C
      CALL VECTOR (1,PICT,1,2,IVECT,1,LAST,7,1,0)
      CALL DSPLAY (6,32001,IERR,IVECT,1,LAST)
C
C  NOW GENERATE A MOVING DISPLAY
C
   2  K = K+1
      AK = K
      KTHETA = AK*THETA
      A = 256./(255.+AK)
      PIC(1,1) = A*COS(KTHETA)-0.25*A
      PIC(2,1) = A*SIN(KTHETA)-0.25*A
      PIC(1,2) = A*COS(KTHETA)
      PIC(2,2) = A*SIN(KTHETA)-0.25*A
      PIC(1,3) = A*COS(KTHETA)
      PIC(2,3) = A*SIN(KTHETA)
      PIC(1,4) = A*COS(KTHETA)-0.25*A
      PIC(2,4) = A*SIN(KTHETA)
      PIC(1,5) = PIC(1,1)
      PIC(2,5) = PIC(2,1)
C
      CALL VECTOR (3,PIC,1,5,IVECT,1,LAST,7,1,0)
      KM1 = K-1
      CALL DSPLAY (6,K,IERR,IVECT,1,LAST)
      CALL TEXT (4,32000,FMT,K)
      CALL DSPLAY (3,KM1,IERR)
      CALL PULSE (0,ICOUNT)
      IF (MOD(ICOUNT,100) .EQ. 0) CALL PULSE (3,ICOUNT)
   3  IF (.NOT. ISENSW (0)) GO TO 2
      CALL PULSE (1,K2)
      WRITE (4,99) K2
C
C  AN 'END' STATEMENT FOLLOWS WHICH CUTS OFF THE EXERCISE OF
C  'DSTOP', 'DPASS', AND 'DGO'
C
   4  WRITE (4,98)
      READ  (4,97) K2
      CALL PULSE (2,K2)
      CALL DSPLAY (4,32767,IERR)
      IF (ISENSW(0)) GO TO 4
      CALL DSPLAY (3,32767,IERR)
      CALL DSPLAY (7,IGET,IERR)
      GO TO 2
      END
      DO 5 K2=1,ICOUNT
      CALL PULSE (2,K2)
      IF (ISENSW(1)) PAUSE 1
      CALL DSTOP
      CALL DSPLAY (4,32767,IERR)
      IF (ISENSW(2)) PAUSE 2
      CALL DPASS (100)
      IF (ISENSW(3)) PAUSE 3
      CALL DSPLAY (5,32767,IERR)
      CALL DGO
      IF (ISENSW(17)) GO TO 6
   5  CONTINUE
   6  IF (ISENSW(4)) PAUSE 4
      CALL DSPLAY (7,IGET,IERR)
      IF (ISENSW(5)) PAUSE 5
      IF (ISENSW(10)) GO TO 3
      GO TO 2
      END
