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

      PROGRAM MAIN

      INTEGER*2 ROW
      INTEGER*2 OLD_MODE
      INTEGER*2 STATUS
      INTEGER*2 FG_ALLOCATE, FG_FREEPAGE
      INTEGER*2 FG_GETMODE, FG_TESTMODE
      CHARACTER*16 STRING

      OLD_MODE = FG_GETMODE()

      IF (FG_TESTMODE(3,2) .EQ. 1) THEN
         CALL FG_SETMODE(3)
      ELSE IF (FG_TESTMODE(7,2) .EQ. 1) THEN
         CALL FG_SETMODE(7)
      ELSE
         STOP 'This program requires an 80-column display.'
      END IF

      CALL FG_CURSOR(0)
      CALL FG_SETATTR(9,7,0)

      DO 10 ROW = 0,24
         WRITE(STRING,1000) ROW
         CALL FG_LOCATE(ROW,0)
         CALL FG_TEXT(STRING,16)
         CALL FG_TEXT(STRING,16)
         CALL FG_TEXT(STRING,16)
         CALL FG_TEXT(STRING,16)
         CALL FG_TEXT(STRING,16)
10    CONTINUE
      CALL FG_WAITKEY

      STATUS = FG_ALLOCATE(1)
      CALL FG_TRANSFER(32,47,11,13,0,24,0,1)
      CALL FG_SETCOLOR(1)
      CALL FG_RECT(32,47,11,13)
      CALL FG_SETATTR(15,1,0)
      CALL FG_LOCATE(12,33)
      CALL FG_TEXT('Press any key.',14)
      CALL FG_WAITKEY

      CALL FG_TRANSFER(0,15,22,24,32,13,1,0)
      CALL FG_WAITKEY

      STATUS = FG_FREEPAGE(1)
      CALL FG_SETMODE(OLD_MODE)
      CALL FG_RESET

      STOP ' '
1000  FORMAT(' This is row ',I2,1X)
      END
