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

      PROGRAM MAIN

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

      CALL FG_INITPM
      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)
      CALL FG_VBINIT

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

      CALL FG_SETCOLOR(7)
      CALL FG_RECT(0,159,0,99)
      CALL FG_SETCOLOR(9)
      CALL FG_LOCATE(6,6)
      CALL FG_TEXT('quadrant',8)

      CALL FG_VBCOPY(0,159,0,99,160, 99,HANDLE,HANDLE)
      CALL FG_VBCOPY(0,319,0,99,  0,199,HANDLE,HANDLE)
      CALL FG_VBPASTE(0,319,0,199,0,199)
      CALL FG_WAITKEY
    
      CALL FG_VBCLOSE
      CALL FG_VBFREE(HANDLE)
      CALL FG_SETMODE(OLD_MODE)
      CALL FG_RESET

      STOP ' '
      END
