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

      PROGRAM MAIN

      INTEGER*2 NEW_MODE, OLD_MODE
      INTEGER*2 X
      INTEGER*2 FG_BESTMODE, FG_GETMODE

C  initialize the video environment

      NEW_MODE = FG_BESTMODE(320,200,1)
      IF (NEW_MODE .LT. 0 .OR. NEW_MODE .EQ. 12) THEN
         STOP 'This program requires a 320 x 200 color graphics mode.'
      END IF
      OLD_MODE = FG_GETMODE()
      CALL FG_SETMODE(NEW_MODE)

C  draw some type of background

      CALL FG_SETCOLOR(15)
      CALL FG_RECT(0,319,0,199)

C  move the object across the screen

      DO 10 X = -20,315,5
         CALL FG_SETCOLOR(10)
         CALL FG_CLPRECT(X,X+19,95,104)
         CALL FG_WAITFOR(1)
         CALL FG_SETCOLOR(0)
         CALL FG_CLPRECT(X,X+19,95,104)
10    CONTINUE

C  restore the original video mode and return to DOS

      CALL FG_SETMODE(OLD_MODE)
      CALL FG_RESET

      STOP ' '
      END
