$INCLUDE: 'C:\FG\INTRFACE.FOR'

      PROGRAM MAIN

      LOGICAL   DECREASING
      INTEGER*2 I
      INTEGER*2 OLD_MODE
      INTEGER*1 RGBVALUES(21)
      INTEGER*2 FG_GETMODE

      OLD_MODE = FG_GETMODE()
      CALL FG_SETMODE(19)

      DO 10 I = 9,15
         CALL FG_SETCOLOR(I)
         CALL FG_TEXT('*',1)
10    CONTINUE

      CALL FG_GETDACS(9,7,RGBVALUES)
      CALL FG_WAITFOR(18)

20    DECREASING = .FALSE.
      DO 30 I = 1,21
         IF (RGBVALUES(I) .GT. 0) THEN
            RGBVALUES(I) = RGBVALUES(I) - 1
            DECREASING = .TRUE.
         END IF
30    CONTINUE
      CALL FG_SETDACS(9,7,RGBVALUES)
      CALL FG_WAITFOR(1)
      IF (DECREASING) GO TO 20
      
      CALL FG_SETMODE(OLD_MODE)
      CALL FG_RESET

      STOP ' '
      END
