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

      PROGRAM MAIN

      INTEGER*1 BUFFER[FAR](64016)
      INTEGER*2 OLD_MODE
      INTEGER*4 SEG_ADDR
      INTEGER*2 PAGE_ADDR(2)
      INTEGER*2 STATUS
      INTEGER*2 FG_GETMODE

      EQUIVALENCE (SEG_ADDR,PAGE_ADDR)

      OLD_MODE = FG_GETMODE()
      CALL FG_SETMODE(19)
      SEG_ADDR = LOCFAR(BUFFER)
      PAGE_ADDR(1) = PAGE_ADDR(2) + (PAGE_ADDR(1) + 15) / 16
      CALL FG_SETENTRY(1,PAGE_ADDR(1),2)

      CALL FG_SETPAGE(1)
      CALL FG_ERASE
      CALL FG_SETCOLOR(9)
      CALL FG_TEXT('This is page 1.',15)
      CALL FG_WAITKEY

      CALL FG_COPYPAGE(1,0)
      CALL FG_SETENTRY(1,0,0)
      CALL FG_WAITKEY

      CALL FG_SETMODE(OLD_MODE)
      CALL FG_RESET

      STOP ' '
      END
