$INCLUDE: 'C:\FG\FASTGRAF.FI'

      PROGRAM MAIN

      INTEGER*1 ESC
      PARAMETER (ESC=27)

      INTEGER*1 KEY, AUX
      INTEGER COLOR
      INTEGER OLD_MODE
      INTEGER FG_AUTOMODE, FG_GETMAXX, FG_GETMAXY, FG_GETMODE
      INTEGER FG_PLAYING

      CALL FG_INITPM
      OLD_MODE = FG_GETMODE()
      CALL FG_SETMODE(FG_AUTOMODE())
      COLOR = 0

      CALL FG_MUSICB('O4L16 CC#DD#EFF#GG#AA#B O+ CC#DD#EFF#GG#AA#B$',-1)

10    IF (FG_PLAYING() .EQ. 1) THEN
         COLOR = IAND(COLOR+1,15)
         CALL FG_SETCOLOR(COLOR)
         CALL FG_RECT(0,FG_GETMAXX(),0,FG_GETMAXY())

         CALL FG_WAITFOR(4)
         CALL FG_INTKEY(KEY,AUX)
         IF (KEY .EQ. ESC) THEN
            CALL FG_HUSH
         ELSE IF (KEY+AUX .NE. 0) THEN
            CALL FG_HUSHNEXT
         END IF
         GO TO 10
      END IF

      CALL FG_SETMODE(OLD_MODE)
      CALL FG_RESET

      STOP ' '
      END
