      include 'tencomn'
      call init
      call skipdat( skip0 )
      if (eoflag) call exodus
      call menu
17500 continue
      do 12500 j = 1, 10
            record( j ) = 0
12500 continue
      do 12501 j = 1, 10
            icount = j
            call getdat
            record( icount ) = firstrecord
      if (eoflag) goto 22501
            if ( icount .eq. 1 ) then
               call vsbcol(dev, backcol)
               call vclrwk(dev)
            end if
            call compact
            call windower
            if ( (((xpix1-xpix0+1) .eq.  nrows) .and.  ((ypix1-ypix0+1) 
     *.eq.  ncols)))  ) then
               call pixie( HARDXDIM, nrows, ncols,
     *                     xpix0, PHYSHEIGHT - 1 - ypix1,
     *                     buffer )
            else
               call winfill( HARDXDIM, nrows, ncols,
     *                       xpix0, xpix1,
     *                       PHYSHEIGHT - 1 - ypix1,
     *                       PHYSHEIGHT - 1 - ypix0,
     *                       buffer )
            end if
            status = vsmstr( dev, ten, zero, echoxy, dummy)
            if ( status .gt. 0 ) then
20000 continue
      if (( upper( dummy(1:1) ) ).eq.( 'Q' )) then
      call exodus
      else if (( upper( dummy(1:1) ) ).eq.( 'R' )) then
      goto 22501
      else if (( upper( dummy(1:1) ) ).eq.( 'B' )) then
      goto 22501
      end if
            end if
12501 continue
22501 continue
         call skipdat( skip )
         if ( moviemode ) then
            if (eoflag) call exodus
            call dump
         else
17501 continue
20001 continue
               lastkey = key(dev)
      if (( lastkey ).eq.( 'D' )) then
      call dump
      goto 20001
      else if (( lastkey ).eq.( 'Q' )) then
      call exodus
      else if (( lastkey ).eq.( 'R' )) then
      call restart
      else if (( lastkey ).eq.( 'B' )) then
      call pop( recn )
                               recn = max0( recn, 1 )
                               eoflag = .false.
      else
      call push( max0( record(1), 1 ) )
                               call enlarger
      end if
      if (.not.( eoflag )) goto 15001
      goto 17501
15001 continue
         end if
      goto 17500
15000 continue
      call exodus
      end
