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

      PROGRAM MAIN

      INTEGER*2 OLD_MODE
      INTEGER*2 NEW_MODE
      INTEGER*2 FG_BESTMODE, FG_GETMODE
      CHARACTER*3 STRING

      OLD_MODE = FG_GETMODE()
      NEW_MODE = FG_BESTMODE(320,200,1)

      IF (NEW_MODE .LT. 0) THEN
         STOP 'This program requires a 320 by 200 graphics mode.'
      END IF

      CALL FG_SETMODE(NEW_MODE)

      CALL FG_SETCOLOR(15)
      CALL FG_TEXT('I''m running in mode ',20)
      WRITE(STRING,1000) NEW_MODE
      CALL FG_TEXT(STRING,3)
      CALL FG_WAITKEY

      CALL FG_SETMODE(OLD_MODE)
      CALL FG_RESET

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