      LOGICAL B1,B2,B3,B4,B5,B6,B7,B8,B9,B10
      DIMENSION FILE(2)
      COMMON/EYCEP/EYE(3),CEN(3),UP(3)
        COMMON/POINTS/INIT,PTS(6,32)
        COMMON/PULDAT/N
      COMMON/BULK/I3STRT,I3END,OBJ(6,32)
      COMMON/PAINT/I2STRT,I2END,PIC(4,32)
      COMMON/OIL/IVECT(200)
      COMMON/LIMITS/XMIN,XMAX,YMIN,YMAX
      DATA FILE(1),FILE(2)/4HCUBE,4H SRC/
      DATA ENFOR,EN2,EN3/5H(1X,2,5HHN=,I,2H4)/
      DATA IDS,IDL/2,1/
      CALL CLEAR(.TRUE.)
      CALL DISPLY (0,4000,IGET)
      CALL BUTTON(1)
      I3STRT=1
      I3END=32
      XMIN=-5.0
      XMAX=5.0
      YMIN=-5.0
      YMAX=5.0
      CALL SEEK (1,FILE)
      READ(1,501)((OBJ(I,J),I=1,6),J=1,32)
 501  FORMAT (6F5.1)
      EYE(1)=0.0
      EYE(2)=0.0
      EYE(3)=10.0
      CEN(1)=0.0
      CEN(2)=0.0
      CEN(3)=0.0
      UP(1)=0.0
      UP(2)=10.0
      UP(3)=0.0
      DIST=8.0
      I2STRT=1
      I2END=32
      MODE=1
      NN=0
      RD=0.01714511
      CALL ROTER
      CALL MAPPER(DIST)
      CALL VECTOR(1,PIC,I2STRT,I2END,IVECT,1,LAST,7,0,0)
      CALL DISPLY(6,IDL,IVECT,1,LAST)
      CALL DISPLY(6,IDS,IVECT,1,LAST)
      CALL DISPLY(3,IDL)
      IH=IDS
      IDS=IDL
      IDL=IH
10    CALL TEXT(0,0,0,0,0)
      CALL TEXT(800,800,7,1,ENFOR,NN)
      B1=.FALSE.
      B2=.FALSE.
      B3=.FALSE.
      B4=.FALSE.
      CALL BUTTON(3,B1,B2,B3,B4)
191   CALL BUTTON(2,B1,B2,B3,B4)
      IF(B1) GO TO 192
      IF(B2) GO TO 193
      IF(B3) GO TO 333
      IF(B4) GO TO 444
      GO TO 191
333   NN=0
      GO TO 10
192   B1=.FALSE.
      B2=.FALSE.
      B3=.FALSE.
      B4=.FALSE.
      B5=.FALSE.
      B6=.FALSE.
      B7=.FALSE.
      B8=.FALSE.
      B9=.FALSE.
      B10=.FALSE.
      CALL BUTTON(3,B1,B2,B3,B4,B5,B6,B7,B8,B9,B10)
101   CALL BUTTON(2,B1,B2,B3,B4,B5,B6,B7,B8,B9,B10)
      IF(B1) GO TO 41
      IF(B2) GO TO 42
      IF(B3) GO TO 43
      IF(B4) GO TO 44
      IF(B5) GO TO 444
      IF(B6) GO TO 46
      IF(B7) GO TO 47
      IF(B8) GO TO 48
      IF(B9) GO TO 49
      GO TO 101
193   B1=.FALSE.
      B2=.FALSE.
      B3=.FALSE.
      B4=.FALSE.
      B5=.FALSE.
      B6=.FALSE.
      B7=.FALSE.
      B8=.FALSE.
      B9=.FALSE.
      CALL BUTTON(3,B1,B2,B3,B4,B5,B6,B7,B8,B9)
194   CALL BUTTON(2,B1,B2,B3,B4,B5,B6,B7,B8,B9)
      IF(B1) GO TO 430
      IF(B2) GO TO 430
      IF(B4) GO TO 45
      IF(B5) GO TO 444
      IF(B3) GO TO 50
      IF(B6) GO TO 431
      IF(B7) GO TO 431
      IF(B8) GO TO 480
      IF(B9) GO TO 490     
      GO TO 194
45    CALL ZOOM(IDS,IDL,DIST,NN)
      GO TO 444
50    CALL CENA(IDS,IDL,DIST,NN)
      GO TO 444
41    IK=46
42    IK=46
      CPI= COS( 2.0*RD)
      SPI=+SIN(2.0*RD)
      GO TO 411
46    IK=23
47    IK=23
      SPI=+SIN(-4.0*RD)
      CPI= COS(-4.0*RD)
411   DO 412 K=1,IK
      IF(B1.OR.B6) GO TO 413
      IF(B7) GO TO 414
      OBJ(6,11)=-1.2
      OBJ(2,12)=-0.6
      OBJ(4,13)=-0.9
      GO TO 416
414   OBJ(6,11)=0.0
      OBJ(2,12)=0.0
      OBJ(4,13)=0.0
416   I3STRT=14
      I3END=22
413   CALL PIRX(CPI,SPI,CEN(2),CEN(3))
      I3STRT=1
      I3END=32
      CALL ROTMAP(IDS,IDL,DIST)
      CALL PULSE(N,N)
412   NN=NN+1
444   DO 445 J=1,24
      CALL PULSE(N,N)
445   NN=NN+1
      GO TO 10
43    IK=46
44    IK=46
      CYA=COS(-2.0*RD)
      SYA=SIN(-2.0*RD)
      GO TO 421
48    IK=23
49    IK=23
      CYA=COS(+4.0*RD)
      SYA=SIN(+4.0*RD)
421   DO 422 K=1,IK
      IF(B3.OR.B8) GO TO 423
      I3STRT=23
423   CALL YARY(CYA,SYA,CEN(1),CEN(3))
      I3STRT=1
      CALL ROTMAP(IDS,IDL,DIST)
      CALL PULSE(N,N)
422   NN=NN+1
      GO TO 444
430   IK=46
      CRO=COS(2.0*RD)
      SRO=SIN(2.0*RD)
      GO TO 432
431   IK=23
      CRO=COS(-4.0*RD)
      SRO=SIN(-4.0*RD)
432   DO 433 K=1,IK
      IF(B1.OR.B6) GO TO 434
      I3STRT=23
434   CALL RORZ(CRO,SRO,CEN(1),CEN(2))
      I3STRT=1
      CALL ROTMAP(IDS,IDL,DIST)
      CALL PULSE(N,N)
433   NN=NN+1
      GO TO 444
480   IK=23
      CRO=COS(+4.0*RD)
      SRO=SIN(+4.0*RD)
      DO 481 K=1,23
      I3STRT=4
      I3END=4
      CALL RORZ(CRO,SRO, 0.0,-2.0)
      I3STRT=24
      I3END=24
      CALL RORZ(CRO,SRO,+2.0, 0.0)
      I3STRT=26
      I3END=26
      CALL RORZ(CRO,SRO, 0.0,-2.0)
      SRO=-1.0*SRO
      I3STRT=16
      I3END=16
      CALL RORZ(CRO,SRO, 0.0,+2.0)
      I3STRT=1
      I3END=1
      CALL RORZ(CRO,SRO,-2.0, 0.0)
      I3STRT=22
      I3END=22
      CALL RORZ(CRO,SRO,-2.0, 0.0)
      I3STRT=1
      I3END=32
      CALL ROTMAP(IDS,IDL,DIST)
      DO 482 KK=1,4
      CALL PULSE(N,N)
482   NN=NN+1
481   SRO=-1.0*SRO
      GO TO 10
490   IK=23
      CRO=COS(+4.0*RD)
      SRO=SIN(+4.0*RD)
      DO 491 K=1,23
      I3STRT=1
      I3END=1
      CALL RORZ(CRO,SRO,-2.0, 0.0)
      I3STRT=16
      I3END=16
      CALL RORZ(CRO,SRO, 0.0,+2.0)
      I3STRT=22
      I3END=22
      CALL RORZ(CRO,SRO,-2.0, 0.0)
      SRO=-1.0*SRO
      I3STRT=4
      I3END=4
      CALL RORZ(CRO,SRO, 0.0,-2.0)
      I3STRT=24
      I3END=24
      CALL RORZ(CRO,SRO,+2.0, 0.0)
      I3STRT=26
      I3END=26
      CALL RORZ(CRO,SRO, 0.0,-2.0)
      I3STRT=1
      I3END=32
      CALL ROTMAP(IDS,IDL,DIST)
      DO 492 KK=1,4
      CALL PULSE(N,N)
492   NN=NN+1
491   SRO=SRO*(-1.0)
      GO TO 10
      GO TO 444
      END
