C
C SUBROUTINE 'QGCURS'
C ===================
C
C GET CURSOR POSITION ON GRAPHICS SCREEN (QGINIT MUST HAVE BEEN CALLED)
C
      SUBROUTINE QGCURS(X,Y,CH)
C
C PARAMETERS
C
C      X (O)   X POSITION IN PIXELS (0.0 TO 1023.0) (OR MAPPED COORDINATE
C                                   IF 'QGMAPC' HAS BEEN CALLED)
C      Y (O)   Y POSITION IN PIXELS (0.0 TO 767.0) (OR MAPPED COOORDINATE
C                                   IF 'QGMAPC' HAS BEEN CALLED)
C     CH (O)   CHARACTER PRESSED ON KEYBOARD TO ENTER GRAPHICS POSN.
C
C
C SPECIFICATION STATEMENTS
C ------------------------
C
      CHARACTER*1 CH
      CHARACTER*1 MODE, ESC, GS, US, FS, CR, FF, SUB
      COMMON /QQCHR/ MODE, ESC, GS, US, FS, CR, FF, SUB
      CHARACTER*2 GETCS
      CHARACTER*6 POS
      LOGICAL PSET
      COMMON /QQLAST/ PSET, KXH, KXL, KYH, KYL
      LOGICAL MAP
      COMMON /QQMAP/ MAP, XPMIN, XPMAX, YPMIN, YPMAX, 
     *               XMMIN, XMMAX, YMMIN, YMMAX, XSC, YSC
      SAVE /QQCHR/,/QQLAST/,/QQMAP/
C
C CODE
C ----
C
      PSET = .FALSE.
      IF (MODE.EQ.' ') CALL QGSEND(GS)
      GETCS(1:1) = ESC
      GETCS(2:2) = SUB
      CALL QGSEND(GETCS)
      CALL QGREAD(POS)
      CH = POS(1:1)
      JXH = MOD(ICHAR(POS(2:2)),32)
      IX = MOD(ICHAR(POS(3:3)),32) + 32*JXH 
      JYH = MOD(ICHAR(POS(4:4)),32)
      IY = MOD(ICHAR(POS(5:5)),32) + 32*JYH
      XP = FLOAT(IX)
      YP = FLOAT(IY)
      IF (MAP) THEN
         X = XMMIN + (XP-XPMIN)/XSC
         Y = YMMIN + (YP-YPMIN)/YSC
      ELSE
         X = XP
         Y = YP
      ENDIF
      CALL QGSEND(CR)
      MODE = 'T'
      RETURN
      END
