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

      PROGRAM MAIN

      INTEGER*2 OLD_MODE
      INTEGER*2 READ_STATUS, WRITE_STATUS
      INTEGER*2 FG_GETMODE, FG_MAKEGIF, FG_SHOWGIF, FG_TESTMODE

      IF (FG_TESTMODE(19,1) .EQ. 0) THEN
         STOP 'This program requires a 320 x 200 MCGA graphics mode.'
      END IF
      OLD_MODE = FG_GETMODE()
      CALL FG_SETMODE(19)

      READ_STATUS = FG_SHOWGIF('CORAL.GIF'//CHAR(0),0)
      CALL FG_WAITKEY
      IF (READ_STATUS .EQ. 0) THEN
         WRITE_STATUS = FG_MAKEGIF(0,319,80,99,'NEW.GIF'//CHAR(0))
      ELSE
         WRITE_STATUS = 1
      END IF

      CALL FG_SETMODE(OLD_MODE)
      CALL FG_RESET

      IF (READ_STATUS .EQ. 1) THEN
         WRITE(6,*) 'CORAL.GIF not found.'
      ELSE IF (READ_STATUS .EQ. 2) THEN
         WRITE(6,*) 'CORAL.GIF is not a GIF file.'
      END IF
      IF (WRITE_STATUS .EQ. 1) WRITE(6,*) 'NEW.GIF not created.'

      STOP ' '
      END
