CC  CURSOR.FOR - Illustrates cursor functions including:
CC               settextcursor  gettextcursor  displaycursor

      INCLUDE  'FGRAPH.FI'
      INCLUDE  'FGRAPH.FD'

      INTEGER*2            dummy, oldcursor, newcursor,
     +                     curs_start, curs_end, block
      CHARACTER*40         str
      RECORD /rccoord/     curpos
      RECORD /videoconfig/ vc

C
C     Save old cursor shape and make sure cursor is on.
C
      CALL clearscreen( $GCLEARSCREEN )
      oldcursor = gettextcursor()
      dummy     = displaycursor( $GCURSORON )
      CALL settextposition( 1, 1, curpos )
      CALL outtext( 'Press ENTER to continue . . .' )
C
C     Change cursor shape.
C     Color cursor uses scan lines 0-7, monochrome uses 0-13.
C
      CALL getvideoconfig( vc )
      block = 7
      IF( vc.mode .EQ. $TEXTMONO ) block = 13
      curs_start = 0
      DO curs_end = block, 0, -1
         CALL settextposition( 10, 1, curpos )
         WRITE (str, 9000) curs_start, curs_end
         CALL outtext( str )
         newcursor = (curs_start * 256) + curs_end
         dummy     = settextcursor( newcursor )
         READ (*,*)
         curs_start = curs_start + 1
      END DO

      WRITE (str, '(A13)') 'Cursor off:  '
      CALL settextposition( 12, 1, curpos )
      CALL outtext( str )
      dummy = displaycursor( $GCURSOROFF )
      READ (*,*)
      WRITE (str, '(A13)') 'Cursor on :  '
      CALL settextposition( 13, 1, curpos )
      CALL outtext( str )
      dummy = settextcursor( block )
      dummy = displaycursor( $GCURSORON )
      READ (*,*)
C
C     Restore original cursor shape.
C
      dummy = settextcursor( oldcursor )
      CALL clearscreen( $GCLEARSCREEN )

 9000 FORMAT ( 'Start line:', I4, 8x, 'Endline:', I4, 3x )

      END
