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

      PROGRAM MAIN

      INTEGER*2 OLD_MODE
      INTEGER*2 FG_GETMODE, FG_TESTMODE
      CHARACTER*3 STRING

      OLD_MODE = FG_GETMODE()

      IF (FG_TESTMODE(13,1) .EQ. 1) THEN
         CALL FG_SETMODE(13)
      ELSE IF (FG_TESTMODE(19,1) .EQ. 1) THEN
         CALL FG_SETMODE(19)
      ELSE IF (FG_TESTMODE(4,1) .EQ. 1) THEN
         CALL FG_SETMODE(4)
      ELSE
         STOP 'This program requires an EGA, MCGA, or CGA.'
      END IF

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

      CALL FG_SETMODE(OLD_MODE)
      CALL FG_RESET

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