
c     Purpose: Graphics routines for Tektronix outputs

      integer*2 function vopnwk()

c.... open tektronix 4012 device

      vopnwk = 0
      end

      integer*2 function vclrwk()

c.... clear tektronix 4012 device

      write(*,1000) char(27),char(12)
      vclrwk = 0
1000  format(2a1)
      end

      integer*2 function vslcol(icol)

c.... set line type

      iln = 0
      if(icol.eq.4) iln = 3
      write(*,1000) char(27),char(iln+96)
      vslcol = 0
1000  format(2a1)
      end

      integer*2 function vrqstr(i1,i2,ixy,xx)

c.... input character to quit plot

      integer   i1,i2
	  integer*2 ixy
      character xx*1
      read(*,1000) xx
      vrqstr = 0
1000  format(a1)
      end

      integer*2 function vencur()

c.... enter text mode with cursor

      write(   *,1000) char(31),char(27),char(50),char(27),
     .                 char(91),char(50),char(74)
      vencur = 0
1000  format(7a1)
      end

      integer*2 function vclswk()

c.... close tektronix 4012 device

      vclswk = 0
      end

      subroutine dplot(x,y,ipen)
      character str4*4,stro*4
      real*8    x,y
      common /tekt1/ stro

c.... tektronix 4012 device or emulator
c     pen command motions: ipen = 1, move to position x,y
c                          ipen = 2, drawline from to x,y

      jx1 = x*700
      jy1 = y*770
      call brk4(jx1,jy1,str4)
      if(ipen.eq.2) then
        write(*,1000) char(13),char(29),stro,str4
      endif
      stro = str4

c.... format statements

1000  format(2a1,2a4)
      end

      subroutine brk4(jx1,jy1, str)
      character*1 str(4)

c.... convert integers for tektronix 4012

      str(1) = char(32 + jy1/32)
      str(2) = char(96 + mod(jy1,32))
      str(3) = char(32 + jx1/32)
      str(4) = char(64 + mod(jx1,32))

      end
