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

      PROGRAM MAIN

      INTEGER*1 KEY, AUX
      INTEGER*2 NEW_MODE, OLD_MODE
      INTEGER*2 STATUS
      INTEGER*2 FG_ALLOCATE, FG_FREEPAGE
      INTEGER*2 FG_BESTMODE, FG_GETMODE

      NEW_MODE = FG_BESTMODE(320,200,2)
      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)
      STATUS = FG_ALLOCATE(1)
      CALL FG_SETHPAGE(1)

      CALL FG_SETCOLOR(9)
      CALL FG_RECT(0,319,0,199)
      CALL FG_SETCOLOR(15)
      CALL FG_RECT(132,188,50,150)

      CALL FG_SETCOLOR(10)
      CALL FG_MOVE(160,67)
      CALL FG_DRAW(175,107)
      CALL FG_DRAW(140,82)
      CALL FG_DRAW(180,82)
      CALL FG_DRAW(145,107)
      CALL FG_DRAW(160,67)
      CALL FG_PAINT(160,77)
      CALL FG_PAINT(150,87)
      CALL FG_PAINT(160,87)
      CALL FG_PAINT(170,87)
      CALL FG_PAINT(155,97)
      CALL FG_PAINT(165,97)

      CALL FG_INTKEY(KEY,AUX)
10    IF (KEY+AUX .EQ. 0) THEN
         CALL FG_WAITFOR(1)
         CALL FG_SCROLL(136,184,50,150,-4,0)
         CALL FG_INTKEY(KEY,AUX)
         GO TO 10
      END IF

      CALL FG_WAITKEY

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

      STOP ' '
      END
