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

      PROGRAM MAIN

      INTEGER PAGES
      PARAMETER (PAGES=4)

      INTEGER COLOR
      INTEGER OLD_MODE
      INTEGER PAGE
      CHARACTER*6 STRING
      INTEGER FG_GETMAXX, FG_GETMAXY, FG_GETMODE, FG_TESTMODE

      CALL FG_INITPM
      IF (FG_TESTMODE(1,PAGES) .EQ. 0) THEN
         STOP 'This program requires color.'
      END IF

      OLD_MODE = FG_GETMODE()
      CALL FG_SETMODE(1)

      DO 10 PAGE = 0,PAGES-1
         CALL FG_SETPAGE(PAGE)
         COLOR = PAGE + 1
         CALL FG_SETCOLOR(COLOR)
         CALL FG_RECT(0,FG_GETMAXX(),0,FG_GETMAXY())
         CALL FG_SETATTR(0,COLOR,0)
         CALL FG_LOCATE(12,17)
         WRITE(STRING,1000) PAGE
         CALL FG_TEXT(STRING,6)
10    CONTINUE

      DO 20 PAGE = 0,PAGES-1
         CALL FG_SETVPAGE(PAGE)
         CALL FG_WAITKEY
20    CONTINUE

      CALL FG_SETMODE(OLD_MODE)
      CALL FG_RESET

      STOP ' '
1000  FORMAT('page',I2)
      END
