      SUBROUTINE IMPULSE
C*BEGIN COMMON 
      COMMON SNAP,SNAPSHT(247), 
     +   DATE,REMKL,REMCOM,REMBASE,REMRES,REMTIME,STARKL,BASEKL,
     +   KILLK,KILLC,GALAXY(8,8),CX(10),CY(10),BASEQX(5),BASEQY(5), 
     +   NEWSTUF(8,8),PLNETS(10,5),ISX,ISY,NSCREM,NROMKL,NROMREM,
     +   NSCKILL,NPLANKL,ISATB,BATX,BATY,THINGX,THINGY,
     +   QUAD(10,10),KX(20),KY(20),KPOWER(20),KDIST(20),KSTUF(20),  
     +   FUTURE(10),MESSAGE(5,10),
     +   INKLING,INBASE,INRESOR,INCOM,INTIME,INSTAR,INENRG,INSHLD,
     +   INTORPS,INLSR,INDATE,ENERGY,SHLD,SHLDUP,CONDIT,TORPS,SHIP, 
     +   QUADX,QUADY,SECTX,SECTY,WARPFAC,WFACSQ,LSUPRES,DAMAGE(20), 
     +   LENGTH,SKILL,PASSWD,DIST,DIREC,TIME,BASEX,BASEY,DOCKFAC, 
     +   KLHERE,COMHERE,CASUAL,NHELP,NKINKS,STARCH(8,8),
     +   DEVICE(2,14),IDIDIT,GAMEWON,ALIVE,JUSTIN,RESTING,ALLDONE,
     +   DAMFAC,SHLDCHG,NDEVICE,PLNETX,PLNETY,INORBIT,LANDED,IPLANET,
     +   IMINE,ICRYSTL,INPLAN,NENHERE,ISHERE,NEUTZ,IRHERE,ICRAFT,
     +   IENTESC,ISCRAFT,ISCATE,CRYPROB,ICITE,IPHWHO,
     +   CRACKS(12) 
      INTEGER SHLDUP,CONDIT,QUADX,QUADY,SECTX,SECTY,TORPS,
     +   REMKL,REMBASE,SKILL,REMCOM,GALAXY,STARCH,CX,CY, 
     +   SHIP,ALLDONE,BASEQX,BASEQY,BASEX,BASEY,GAMEWON, 
     +   ALIVE,STARKL,BASEKL,CASUAL,COMHERE,RESTING,SNAP,SHLDCHG, 
     +   THINGX,THINGY,BATX,BATY,PLNETX,PLNETY,PLNETS
      REAL KDIST,KPOWER,LSUPRES,INTIME,INRESOR,INDATE,INSHLD,   
     +   INENRG,INLSR 
	BYTE QUAD
	REAL*8 DEVICE,PASSWD
C*END COMMON 
      IDIDIT=0
      IF(DAMAGE(7).NE.0) GO TO 40 
C--------READ IN COURSE AND DISTANCE
      IF(ENERGY .LE. 30.0) GO TO 5
      CALL GETCD
      IF(DIREC .LT. 0) RETURN 
C--------MAKE SURE STARSHIP HAS SUFFICIENT ENERGY FOR TRIP
      POWER=20.0+100.0*DIST 
      IF(POWER .LT. ENERGY) GO TO 20
 5    CALL SKIP(1)
      CALL PROUT( 
     +   51HFIRST OFFICER SPOCK:  "CAPTAIN, THE IMPULSE ENGINES,51)
      CALL PROUT( 
     +   51HREQUIRE 20.0 UNITS TO ENGAGE, PLUS 100.0 UNITS PER  ,51) 
      IF(ENERGY .GT. 30.0) GO TO 10 
      CALL PROUT(41HQUADRANT.  THEY ARE, THEREFORE, USELESS.",41)
      RETURN
 10   CALL CRAM(46HQUADRANT.  WE CAN GO, THEREFORE, A MAXIMUM OF )
      CALL CRAMF(0.01*(ENERGY-20.0)-0.05,0,1) 
      CALL CREND
      CALL PROUT(11HQUADRANTS.",11)
      RETURN
C--------MAKE SURE ENOUGH TIME IS LEFT FOR THE TRIP 
 20   TIME=DIST/0.095 
      IF(TIME .LT. REMTIME) GO TO 30
      CALL PROUT( 
     +   55HFIRST OFFICER SPOCK:  "CAPTAIN, OUR SPEED UNDER IMPULSE,55)
      CALL PROUT( 
     +   54HPOWER IS ONLY 0.95 SECTORS PER STARDATE.  ARE YOU SURE,54) 
      CALL PROMPT(27HWE DARE SPEND THE TIME?"   ,27) 
      IF(JA(DUMMY) .EQ. 0) RETURN
C--------ACTIVATE IMPULSE ENGINES AND PAY THE COST
 30   CALL MOVE 
      IDIDIT=1
      IF(ALLDONE.NE.0) RETURN 
      POWER=20.0+100.0*DIST 
      ENERGY=ENERGY-POWER 
      TIME=DIST/0.095 
      IF(ENERGY .LE. 0) CALL FINISH(4)
      RETURN
 40   CALL SKIP(1)
      CALL PROUT(24HIMPULSE ENGINES DAMAGED.,24) 
      RETURN
      END 
