      SUBROUTINE PTIGER(X,Y,IND)
      INTEGER PIXROW, PIXCOL, PIXEL
      COMMON /TERM/ IMAXR, IMAXC, PIXROW, PIXCOL, PIXEL, LCOUNT, INGRAF,
     .              IXL, IXR, IYT, IYB, NCOLOR, MCOLOR( 64 ), ITTRM,
     .              MARGX, MARGY
* VARIABLES IN COMMON TERM:
*  IMAXR = MAX NUMBER OF ROWS
*  IMAXC = MAX NUMBER OF COLUMNS
*  PIXROW = NUMBER OF PIXELS PER ROW
*  PIXCOL = NUMBER OF PIXELS PER COLUMN
*  PIXEL  = LESSER OF PIXROW OR PIXCOL
*  LCOUNT = NUMBER OF LINES CURRENTLY WRITTEN TO DIALOG AREA
*  INGRAF = 0=> HOST TEXT GOES TO MONITOR SPACE\\ 1=> TEXT TO GRAPHICS
*  IXL    = LEFT MOST VALUE OF X
*  IXR    = RIGHT MOST VALUE OF X
*  IYT    = VALUE OF Y AT TOP OF SCREEN
*  IYB    = VALUE OF Y AT BOTTOM OF SCREEN
*  NCOLOR = NUMBER OF COLORS IN MCOLOR MAP
*  MCOLOR = MAP OF COLORS
*  ITTRM  = UNIQUE MODEL NUMBER OF GENERAL TERMINAL TYPE
*  MARGX  = NUMBER OF PIXELS PADDED TO X-COORDINATE
*  MARGY  = NUMBER OF PIXELS PADDED TO Y-COORDINATE
*
*
      COMMON /OUTPUT/ IPAPER,IPAGE
      INTEGER*2 NBITPC, IX1, IY1, IX2, IY2, MAXROW, MAXLIN, OPER
      INTEGER *4 OUT                  
      BYTE GRAPH(1050,200),RECORD(1000),BYTE(2),EXT,SXT,SO,HOLD,NULL
      COMMON /BITMAP/ IX1,IY1,IX2,IY2,GRAPH,MAXROW(200),MAXLIN
      EQUIVALENCE (OPER,BYTE(1))                         
**************
      COMMON /BITDEN/ NBITPC
**************
      CHARACTER*80 FILEIN,FILOUT,FILPLT, LLEGND
      COMMON /LEGEND/ FILEIN,FILOUT,FILPLT, LLEGND
**************
C      **                                                  
        DATA NULL,EXT,SXT,SO/128,131,130,142/                       
C
C   CODES FOR IND:
C
C     IND = 0   =>  REMOVE ALL GRAPHICS TO QUIT
C     IND = 1   =>  ANY ONE TIME ONLY INITIALIZATION
C     IND = 2   =>  MOVE GRAPHICS TO POINT (X,Y) -- DO NOT DRAW LINE
C     IND = 3   =>  DRAW LINE FROM LAST POINT TO NEW (X,Y)
C     IND = 6   =>  INITIALIZE & SET-UP FOR NEXT PICTURE
C     IND = 8   =>  TEMPORARY RELEASE FROM GRAPHICS
C     IND = 9   =>  RETURN TO GRAPHICS FROM TEMP RELEASE
*     IND = 10  =>  DONE DRAWING PICTURE
*
*     IND = 99  =>  CHANGE COLOR
*
      PIXEL=650.0 * IPAPER / 100

      IF (IND.EQ.O) THEN
C  ALL DONE -- CLEAR TERMINAL AND WE WILL QUIT
      ELSEIF (IND.EQ.1) THEN
C  ONE TIME ONLY INITIALIZATION OF TRMINAL  (IF NEEDED)
         RETURN
      ELSEIF (IND.EQ.2 ) THEN
C     LOCATION OF NEW POINT -- NO LINE TO IT
         IXLX = X * PIXEL
         IYLY = ( 1.0 - Y ) * PIXEL
         IXLAST = IXLX
         IYLAST = IYLY
      ELSEIF (IND.EQ.3) THEN
C DRAW LINE FROM LAST POINT TO NEW POINT
         IXLX = X * PIXEL
         IYLY = ( 1.0 - Y ) * PIXEL
         CALL BITLIN(IXLAST,IYLAST,IXLX,IYLY)
         IXLAST = IXLX
         IYLAST = IYLY
      ELSEIF (IND.EQ.6) THEN
C  INITIALIZE FOR DRAWING NEXT PICTURE
         CALL BMCLR
*
      OPEN( UNIT=11, FILE=FILPLT, ACCESS='SEQUENTIAL',
     +      STATUS='NEW', RECL=1024)
      REWIND 11

C      **                               
C      **
        NBITPC = 7
        WRITE ( 11, '(1X,A)' ) CHAR(138)
C      **
C      **
         RETURN
      ELSEIF (IND.EQ.8) THEN
C TEMPORARY RELEASE FROM GRPHICS  (USUALLY FOR TEXT)
         RETURN
      ELSEIF (IND.EQ.9) THEN
C RETURN TO GRAPHICS FROM TEMPORARY RELEASE
         RETURN
      ELSEIF (IND.EQ.10) THEN
C DONE DRAWING PICTURE
C      **                                                  
4      FORMAT(1X,A)                                        
C      **                                                  
        WRITE(11,100) EXT,NULL,EXT,SO
C      **                                                  
        DO 20 I=1,MAXLIN
        K=1
        RECORD(1)=0
        IF (MAXROW(I).LT.1) GO TO 10
        K=0                                                
        DO 10 J=1,MAXROW(I)
C      **                                                  
        BYTE(2)=0                                          
        BYTE(1)=GRAPH(J,I)                                 
        OPER=OR(OPER,NULL)                                
        HOLD =BYTE(1)                                 
C      **                                                  
        K=K+1                                              
        RECORD(K)=HOLD
        IF ( HOLD .EQ. EXT) THEN                       
        K=K+1                                              
        RECORD(K)=EXT                                      
        ENDIF                                
        IF ( K .GE. 200) THEN
           WRITE(11,100) (RECORD(L),L=1,K)
           K = 0
        ENDIF
10     CONTINUE                              
C      **                                    
        WRITE(11,100) (RECORD(L),L=1,K),EXT,SO
20     CONTINUE                               
C      **                                     
        WRITE(11,100) EXT,SXT                 
100    FORMAT(1024A1)                         
C      **                                     
C      **                                     
C      **                                     
C      **                                      
C      ** CLEAN UP                             
C      **                                      
        WRITE(11,23)140                        
23     FORMAT(1X,A1)
        CLOSE(UNIT=11)                        
C      **
      ELSEIF( IND.EQ.99) THEN
* REQUEST OT CHANGE COLOR OF LINE (NOT SUPPORTED)
         CONTINUE
      ELSE
C WE HAVE AN ERROR IN IND
      WRITE ( *, '( '' ERROR IN PLOT, IND='', I4)' ) IND
      ENDIF
      RETURN
      END
