SUBROUTINE PLOTTIC
!****************************************************************************************
!*
!* THIS SUBROUTINE PLACES TIC MARKS OMN THE XY PLOT OF COLOR COMPONENT INTENSITY
!*
!****************************************************************************************
  USE DFLIB
  USE PLOTVAL
  USE FONTCOM
  USE VIDCONF
  IMPLICIT NONE


  CHARACTER NUMSTR*10

  INTEGER(KIND=2)ISTATUS, IXPIX, IYPIX, LENG, IPIXL, IPIXL2, IXTEXT, IYTEXT
  REAL(KIND=4)XTIC, YPIX, XPIX, YTIC
  INTEGER(KIND=4)I23, ILENG, ITMP, RGB

  ITMP = SETCOLORRGB(RGB(255,255,255))

!* DRAW TIC MAARKS ON AXISWS
!* X-AXIS
!* CHECK TO SEE IF STARTING POINT IS BETWEEN MAIN AND MAX VALUES
  IF(XTICSTR .GE. XMIN .AND. XTICSTR .LE. XMAX)THEN
!* GO TOWARDS - X VALUE
    XTIC = XTICSTR
    DO WHILE (XTIC .GE. XMIN)
!* GO TO TIC LOCATION
!* Y LOCATION
      YPIX = YPIXOFF - (XAXIS/YPIXVAL) 
      XPIX = (XTIC/XPIXVAL) - XPIXOFF
      IXPIX = INT(XPIX)
      IYPIX = INT(YPIX)
      CALL MOVETO(IXPIX, INT2(IYPIX+ITIC), XY)
      ISTATUS = LINETO(IXPIX,INT2(IYPIX-ITIC))
      IF(XTIC .NE. 0.00)THEN
    WRITE(NUMSTR,'(I5)')INT(XTIC)
    LENG = LEN(NUMSTR)
!* FIND FIRST NON BLANK CHARACTER
    DO I23 = 1, LENG
      IF(NUMSTR(I23:I23) .NE. ' ')THEN
        ILENG = LENG - I23 +1
        EXIT
      ENDIF
    END DO
    IPIXL = FONT.AVGWIDTH*ILENG
    IPIXL2 = IPIXL/2
    IXTEXT = IXPIX-IPIXL2
    IYTEXT = IYPIX+ITIC+FONT.PIXHEIGHT
    CALL MOVETO(IXTEXT,IYTEXT, XY)
    CALL OUTGTEXT(NUMSTR(I23:))
      ENDIF
      XTIC = XTIC - TICINTV

    END DO
    XTIC = XMIN
    YPIX = YPIXOFF - (XAXIS/YPIXVAL) 
    XPIX = (XTIC/XPIXVAL) - XPIXOFF
    IXPIX = INT(XPIX)
    IYPIX = INT(YPIX)
    CALL MOVETO(IXPIX, INT2(IYPIX+ITIC), XY)
    ISTATUS = LINETO(IXPIX,INT2(IYPIX-ITIC))
!* GO TOWARDS + X VALUE
    XTIC = XTICSTR
    DO WHILE (XTIC .LE. XMAX)
!* GO TO TIC LOCATION
!* Y LOCATION
      YPIX = YPIXOFF - (XAXIS/YPIXVAL) 
      XPIX = (XTIC/XPIXVAL) - XPIXOFF
      IXPIX = INT(XPIX)
      IYPIX = INT(YPIX)
      CALL MOVETO(IXPIX, INT2(IYPIX+ITIC), XY)
      ISTATUS = LINETO(IXPIX,INT2(IYPIX-ITIC))
      IF(XTIC .NE. 0.00) THEN
    WRITE(NUMSTR,'(I5)')INT(XTIC)
    LENG = LEN(NUMSTR)
!* FIND FIRST NON BLANK CHARACTER
    DO I23 = 1, LENG
      IF(NUMSTR(I23:I23) .NE. ' ')THEN
        ILENG = LENG - I23 +1
        EXIT
      ENDIF
    END DO
    IPIXL = FONT.AVGWIDTH*ILENG
    IPIXL2 = IPIXL/2
    IXTEXT = IXPIX-IPIXL2
    IYTEXT = IYPIX+ITIC+FONT.PIXHEIGHT
    CALL MOVETO(IXTEXT,IYTEXT, XY)
    CALL OUTGTEXT(NUMSTR(I23:))
      ENDIF
      XTIC = XTIC + TICINTV
    END DO
    XTIC = XMAX
    YPIX = YPIXOFF - (XAXIS/YPIXVAL) 
    XPIX = (XTIC/XPIXVAL) - XPIXOFF
    IXPIX = INT(XPIX)-1
    IYPIX = INT(YPIX)
    CALL MOVETO(IXPIX, INT2(IYPIX+ITIC), XY)
    ISTATUS = LINETO(IXPIX,INT2(IYPIX-ITIC))
  ELSE
    WRITE(*,*)' STARTING LOCATION FOR X-AXIS TIXK MARKS INVALID'
    GO TO 9999
  ENDIF
!* Y-AXIS
!* CHECK TO SEE IF STARTING POINT IS BETWEEN MAIN AND MAX VALUES
  IF(YTICSTR .GE. YMIN .AND. YTICSTR .LE. YMAX)THEN
!* GO TOWARDS -Y VALUE
    YTIC = YTICSTR
    DO WHILE (YTIC .GE. YMIN)
!* GO TO TIC LOCATION
!* Y LOCATION
      YPIX = YPIXOFF - (YTIC/YPIXVAL) 
      XPIX = (YAXIS/XPIXVAL) - XPIXOFF
      IXPIX = INT(XPIX)
      IYPIX = INT(YPIX)
      CALL MOVETO(INT2(IXPIX+ITIC), IYPIX, XY)
      ISTATUS = LINETO(INT2(IXPIX-ITIC),IYPIX)
      IF(YTIC .NE. 0)THEN
    WRITE(NUMSTR,'(I5)')INT(YTIC)
    LENG = LEN(NUMSTR)
!* FIND FIRST NON BLANK CHARACTER
    DO I23 = 1, LENG
      IF(NUMSTR(I23:I23) .NE. ' ')THEN
        ILENG = LENG - I23 +1
        EXIT
      ENDIF
    END DO
    IPIXL = FONT.PIXWIDTH*ILENG
    IPIXL2 = IPIXL/2
    IXTEXT = IXPIX+3
    IYTEXT = IYPIX-FONT.PIXHEIGHT/2
    CALL MOVETO(IXTEXT,IYTEXT, XY)
    CALL OUTGTEXT(NUMSTR(I23:))
      ENDIF
      YTIC = YTIC - TICINTV
    END DO
    YTIC = YMIN
    YPIX = YPIXOFF - (YTIC/YPIXVAL) 
    XPIX = (YAXIS/XPIXVAL) - XPIXOFF
    IXPIX = INT(XPIX)
    IYPIX = INT(YPIX) - 1
    CALL MOVETO(INT2(IXPIX+ITIC),IYPIX, XY)
    ISTATUS = LINETO(INT2(IXPIX-ITIC),IYPIX)
!* GO TOWARDS +Y VALUE
    YTIC = YTICSTR
    DO WHILE (YTIC .LE. YMAX)
!* GO TO TIC LOCATION
!* Y LOCATION
      YPIX = YPIXOFF - (YTIC/YPIXVAL) 
      XPIX = (YAXIS/XPIXVAL) - XPIXOFF
      IXPIX = INT(XPIX)
      IYPIX = INT(YPIX)
      CALL MOVETO(INT2(IXPIX+ITIC), IYPIX, XY)
      ISTATUS = LINETO(INT2(IXPIX-ITIC),IYPIX)
      IF(YTIC .NE. 0.00)THEN
    WRITE(NUMSTR,'(I5)')INT(YTIC)
    LENG = LEN(NUMSTR)
!* FIND FIRST NON BLANK CHARACTER
    DO I23 = 1, LENG
      IF(NUMSTR(I23:I23) .NE. ' ')THEN
        ILENG = LENG - I23 +1
        EXIT
      ENDIF
    END DO
    IPIXL = FONT.PIXWIDTH*ILENG
    IPIXL2 = IPIXL/2
    IXTEXT = IXPIX+3
    IYTEXT = IYPIX-FONT.PIXHEIGHT/2
    CALL MOVETO(IXTEXT,IYTEXT, XY)
    CALL OUTGTEXT(NUMSTR(I23:))
      ENDIF
      YTIC = YTIC + TICINTV
    END DO
    YTIC = YMAX
    YPIX = YPIXOFF - (YTIC/YPIXVAL) 
    XPIX = (YAXIS/XPIXVAL) - XPIXOFF
    IXPIX = INT(XPIX)
    IYPIX = INT(YPIX)
    CALL MOVETO(INT2(IXPIX+ITIC), IYPIX, XY)
    ISTATUS = LINETO(INT2(IXPIX-ITIC),IYPIX)
  ELSE
    WRITE(*,*)' STARTING LOCATION FOR Y-AXIS TIXK MARKS INVALID'
    GO TO 9999
  ENDIF

9999  CONTINUE

  RETURN
END
