C     .TITLE TPULSE
C
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(I4)/
C
   1  XMIN = -1.
      XMAX = +1.
      YMIN = -1.
      YMAX = +1.
      K = 0
      THETA = 3.14159265/32.
C
      CALL CLEAR (0)
      CALL DSPLAY (0,3000,IERR,IGET)
      CALL TEXT (2,32000,800,0,7,2,FMT,0)
      IF (ISENSW(12)) PAUSE 32000
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,32767,IERR,IVECT,1,LAST)
      IF (ISENSW(12)) PAUSE 32001
C
C  NOW GENERATE A MOVING DISPLAY
C
   2  K = K+1
      AK = K
      KTHETA = AK*THETA
      A = 64./(63.+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,0,IERR,IVECT,1,LAST)
      IF (ISENSW(12)) PAUSE 32002
      CALL TEXT (4,32000,FMT,K)
      IF (ISENSW(12)) PAUSE 32003
      IF (ISENSW(13)) CALL DSPLAY (3,0,IER)
      CALL PULSE (IDUM,ICOUNT)
   3  IF (.NOT. ISENSW (0)) GO TO 2
      CALL PULSE (1,ICOUNT)
      WRITE (4,99) ICOUNT
C
      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
  99  FORMAT (1XI5,7H FRAMES)
      END
