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

      PROGRAM MAIN

      INTEGER*2 OLD_MODE
      INTEGER*2 X
      INTEGER*2 FG_GETMODE, FG_TESTMODE

C  initialize the video environment

      IF (FG_TESTMODE(13,1) .EQ. 0) THEN
         STOP 'This program requires EGA.'
      END IF
      OLD_MODE = FG_GETMODE()
      CALL FG_SETMODE(13)
      CALL FG_SETFUNC(3)

C  draw some type of background

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

C  move the object across the screen

      CALL FG_SETCOLOR(IEOR(10,15))
      DO 10 X = -20,315,5
         CALL FG_CLPRECT(X,X+19,95,104)
         CALL FG_WAITFOR(1)
         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
