      SUBROUTINE SHIELDS
	CALL SHLDNT(1)
	RETURN
	END
	SUBROUTINE SHLDSUP
	CALL SHLDNT(2)
	RETURN
	END
	SUBROUTINE SHLDNT(IZ)
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 
	LOGICAL*1 IHS,IHR,IHC,IHK,IHE,IHF,IHBLANK,IHDOT,IHP,IHB
	1 ,IHSTAR,IHT,IHQUEST,IHNUM,ITEM
      COMMON/HOLLER/IHEOL,IHREAL,IHALPHA,IHS,IHR,IHC,IHK,IHGREEN,IHRED, 
     +IHYELLO,IHDOCKD,IHE,IHF,IHBLANK,IHDOT,IHQUEST,IHP,IHSTAR,IHB
     +,IHT,IHNUM  
	REAL*8 AITEM
	COMMON/SCANBF/KEY,AITEM
	EQUIVALENCE (FNUM,AITEM),(ITEM,AITEM)
	GOTO (1,2),IZ
1      IDIDIT=0
      CALL SCAN   
      IF(KEY .NE. IHEOL) GO TO 30 
 15   CALL PROMPT(40HDO YOU WISH TO CHANGE SHIELD ENERGY?    ,40) 
      IF(JA(DUMMY)) GO TO 8010
      IF(DAMAGE(8).NE.0.0) GO TO 60   
      IF(SHLDUP.NE.0) GO TO 20
C* 
C      ENTRY SHLDSUP 
C* 
2      CALL PROMPT(40HSHIELDS ARE DOWN.  DO YOU WANT THEM UP? ,40) 
      IF(JA(DUMMY)) GO TO 40 
	GO TO 90
 20   CALL PROMPT(40HSHIELDS ARE UP.  DO YOU WANT THEM DOWN? ,40) 
      IF(JA(DUMMY)) GO TO 50 
	GO TO 90
 30   IF(ITEM.EQ.84) GO TO 80
      IF(DAMAGE(8).NE.0.0) GO TO 60   
      IF(ITEM.EQ. 85) GO TO 40
      IF(ITEM.EQ. 68) GO TO 50 
	GO TO 15
C--------RAISE SHIELDS
 40   IF(SHLDUP.NE.0) GO TO 45
      SHLDUP=1
      SHLDCHG=1 
      IF(CONDIT .NE. IHDOCKD ) ENERGY=ENERGY-50.0 
      CALL PROUT(15HSHIELDS RAISED.,15)
      IF(ENERGY .LE. 0) GO TO 70
      IDIDIT=1
      RETURN
 45   CALL PROUT(21HSHIELDS ALREADY UP.   ,21)   
      RETURN
C--------LOWER SHIELDS
 50   IF(SHLDUP .EQ. 0) GO TO 55
      SHLDUP=0
      SHLDCHG=1 
      CALL PROUT(16HSHIELDS LOWERED.,16) 
      IDIDIT=1
      RETURN
 55   CALL PROUT(21HSHIELDS ALREADY DOWN.,21)
      RETURN
C--------SHIELD DAMAGE
 60   CALL PROUT(25HSHIELDS DAMAGED AND DOWN.,25)
      RETURN
C--------ENERGY TOTALLY DEPLETED
 70   CALL SKIP(1)
      CALL PROUT(31HSHIELDS USE UP LAST OF ENERGY. ,31)    
	CALL FINISH(4)
	RETURN
C--------CHANGE SHIELD ENERGY.
 80   CALL SCAN 
	ETRANS=FNUM
      IF(KEY .EQ. IHREAL) GO TO 81
 8010 CALL PROMPT(38HENERGY TO TRANSFER TO SHIELDS?        ,38) 
      GO TO 80
 81   IF(ETRANS .EQ. 0.) GO TO 90 
      IF(ETRANS .LT. ENERGY) GO TO 82 
      CALL PROUT(25HINSUFFICIENT SHIP ENERGY.,25) 
	GO TO 90
 82   IDIDIT=1
      IF(SHLD+ETRANS .LE. INSHLD) GO TO 83
      CALL PROUT(24HSHIELD ENERGY MAXIMIZED.,24) 
      CALL PROUT(48HEXCESS ENERGY REQUESTED RETURNED TO SHIP ENERGY.,48) 
      ENERGY=ENERGY+SHLD-INSHLD 
	SHLD=INSHLD
	GO TO 90
C--------PREVENT SHIELD-DRAIN LOOPHOLE. 
 83   IF(ETRANS .GT. 0.) GO TO 8310 
      IF(ENERGY-ETRANS .LE. INENRG) GO TO 8310
      IF(ENERGY + SHLD .LE. INENRG) GO TO 8310
      CALL SKIP(1)
      CALL PROUT(24H"ENGINEERING TO BRIDGE--,24) 
      CALL PROUT(46H  SCOTT HERE.  POWER CIRCUIT PROBLEM, CAPTAIN.,46) 
      CALL PROUT(31H  I CAN'T DRAIN THE SHIELDS."  ,31)    
	IDIDIT=0
	GO TO 90
 8310 IF(SHLD+ETRANS .GE. 0.) GO TO 84
      CALL PROUT(38HALL SHIELD ENERGY TRANSFERRED TO SHIP.,38) 
	ENERGY=ENERGY+SHLD
	SHLD=0
	GO TO 90
 84   CALL CRAM(10HSCOTTY:  ")
      IF(ETRANS .GT. 0.) CALL CRAM(12HTRANSFERRING) 
      IF(ETRANS .LT. 0.) CALL CRAM(8HDRAINING)
      CALL CRAM(8H ENERGY ) 
      IF(ETRANS .GT. 0.) CALL CRAM(2HTO)
      IF(ETRANS .LT. 0.) CALL CRAM(4HFROM)
      CALL CRAMDMP(10H SHIELDS.") 
	SHLD=SHLD+ETRANS
	ENERGY=ENERGY-ETRANS
 90   IF(SHLD .LE. 0.0) SHLDUP=0
      RETURN      
      END 
