$INCLUDE: 'C:\FG\FASTGRAF.FI'

      PROGRAM MAIN

      INTEGER HANDLE, OLD_MODE, STATUS
      INTEGER FG_GETMODE, FG_VBALLOC, FG_VBOPEN

      CALL FG_INITPM
      OLD_MODE = FG_GETMODE()
      CALL FG_SETMODE(22)
      CALL FG_VBINIT

      HANDLE = FG_VBALLOC(320,240)
      IF (HANDLE .LT. 0) THEN
         CALL FG_SETMODE(OLD_MODE)
         CALL FG_RESET
         STOP 'Could not create the virtual buffer.'
      END IF

      CALL FG_SETCOLOR(9)
      CALL FG_FILLPAGE
      CALL FG_SETCOLOR(15)
      CALL FG_BOX(0,319,0,239)
      STATUS = FG_VBOPEN(HANDLE)
      CALL FG_VBCUT(0,319,0,239,0,239)
      CALL FG_VBCLOSE
      CALL FG_WAITKEY

      CALL FG_SETMODE(OLD_MODE)
      CALL FG_CURSOR(0)
      CALL FG_SETCOLOR(15)
      CALL FG_TEXT('Press any key.',14)
      CALL FG_WAITKEY

      CALL FG_SETMODE(22)
      STATUS = FG_VBOPEN(HANDLE)
      CALL FG_VBPASTE(0,319,0,239,0,239)
      CALL FG_WAITKEY

      CALL FG_VBCLOSE
      CALL FG_VBFREE(HANDLE)
      CALL FG_SETMODE(OLD_MODE)
      CALL FG_RESET

      STOP ' '
      END
