1 REM WRITTEN JAN 1982 BY ED DAVIS
2 GOSUB 65019
5 DIM T%(1,5):DIM M(6,15): DIM CH%(66)
7 GOSUB 6000
10 GOTO 5000
50 ' BEGIN MAIN ROUTINE
100 SX=STICK (0):SY=STICK (1)
105 IF ABM% THEN GOTO 300
110 X=3*(SX):IF X>298 THEN X=298
120 PUT(LX,LY),CH%:PUT(X,SY),CH%:LX=X:LY=SY
200 IF ABM% THEN GOTO 300
210 STRIG ON
220 B%=STRIG(1):STRIG OFF :IF B%=0 GOTO 400
230 DX=LX+10:DY=LY+10:LINE (168,160)-(DX,DY),3:ABM%=1:RR=1
240 PUT(LX,LY),CH%:LX=158:LY=150:PUT (LX,LY),CH%
300 RR=1+RR:CIRCLE (DX,DY),RR,2
310 IF RR<11 THEN GOTO 400
320 ABM%=0:LINE (168,160)-(DX,DY),0:CIRCLE (DX,DY),10,0:LINE (DX-11,DY-10)-(DX+11,DY+10),0,BF
325 I=-1
330 I=I+1:IF I>15 THEN GOTO 400
335 IF M(0,I)=0 THEN GOTO 330
340 IF ABS(M(2,I)-DX)1 THEN N=N+1:GOTO 430
412 M(2,I)=M(2,I)+M(4,I):M(3,I)=M(3,I)+1:PSET (M(2,I),M(3,I)),3
415 IF M(3,I)>159 THEN GOSUB 2500
420 IF (M(3,I)>70) AND (FLAG%=0) THEN FLAG%=123:MIRV%=I:SOUND 50,2
430 NEXT I:IF MR=0 AND N>15 THEN GOTO 7000
600 IF FLAG%=123 THEN GOTO 650
610 IF RND(1)<.96 THEN GOTO 50
615 I=0
620 I=I+1:IF M(0,I)=2 THEN M(0,I)=1:GOTO 50
630 IF I=11 THEN LOCATE 1,3:PRINT "ENEMY HAS LAUNCHED ALL MISSLES":MR=0:GOTO 50
640 GOTO 620
650 FLAG=-1:N=0:PT%=M(1,MIRV%):TT%=PT%+1
660 N=N+1:TT%=TT%+1:IF TT%>5 THEN TT%=TT%-6
670 I=N+11: M(0,I)=1:M(1,I)=TT%:M(2,I)=M(2,MIRV%):M(3,I)=M(3,MIRV%):M(5,I)=M(2,I):M(6,I)=M(3,I)
680 M(4,I)=(T%(1,TT%)-M(5,I))/90
690 IF N<4  THEN FLAG%=-1:GOTO 660
699 GOTO 50
2500 '  MISSLE EXPLODE
2510 FOR R=6 TO 36:IF R<30 THEN CIRCLE (M(2,I),160),R,2
2520 CIRCLE (M(2,I),160),R-5,0:SOUND 36+3*R,1
2525 NEXT R
2530 T%(0,M(1,I))=0:LINE(M(5,I),M(6,I))-(M(2,I),M(3,I)),0
2540 M(0,I)=0
2550  FOR I=0 TO 5:IF T%(0,I)=1 THEN RETURN
2560 NEXT I:RETURN 3000
3000 REM ALL CITIES HAVE BEEN DESTROYED
3010 CLS:COLOR 4,7:LOCATE 6,9:PRINT"YOU SHOULD BE DEMOTED!"
3020 LOCATE 10,5:PRINT"ALL CITIES HAVE BEEN DESTROYED"
3030 LOCATE 15,6 :PRINT"YOUR SCORE IS ";SC;" POINTS."
3040 LOCATE 17,2:PRINT"THE HIGHEST SCORE TODAY IS ";HSC;" POINTS."
3050 LOCATE 24,5:PRINT"DO YOU WISH TO PLAY AGAIN (Y/N)?"
3055 IF SC>HSC THEN HSC=SC
3060 K$=INKEY$:IF K$="" THEN 3060
3070 IF K$="Y" OR K$="y" THEN GOTO 10
3080 IF K$="N" OR K$="n" THEN CLS:END
3090 GOTO 3060
3110 END
4000 FOR I=0 TO 11
4010 M(0,I)=2:M(5,I)=INT(RND(1)*280)+20:M(2,I)=M(5,I):M(6,I)=0:M(3,I)=0
4020 NEXT I
4030 FOR I=0 TO 11
4040 II=I:IF I>5 THEN II=I-6
4050 M(4,I)=(T%(1,II)-M(5,I))/160:M(1,I)=II
4060 NEXT I
4065 M(0,0)=1:REM THIS ENABLES ONLY ONE MISSLE ******
4070 MR=16:' SET NUMBER OF MISSLES
4080 RETURN
4999 STOP
5000 '  >>>>>>> INITIATION <<<<<<<<
5001 '    ED DAVIS  9-1-82   LEVEL 1
5050 NM%=11:FLAG%=0:MIRV%=33:SC=0
5060 RANDOMIZE VAL(RIGHT$(TIME$,2))
5100 SCREEN 1,0:COLOR 0,1:WIDTH 40:KEY OFF:CLS
5110 CIRCLE (110,110),5,3
5120 LINE (100,110)-(105,110):LINE (115,110)-(120,110)
5130 LINE (110,100)-(110,105):LINE (110,115)-(110,120)
5140 GET (100,100)-(120,120),CH%:CLS
5200 FOR I= 0 TO 5
5210 T%(0,I)=1:T%(1,I)=48*(I+1)
5220 NEXT I
5230 GOSUB 4000:REM TARGETING ROUTINE 12 MISSLES (6 TARGETS)
5300 '>> DRAW AND LABEL CITIES <<
5310 SCREEN 1,0:COLOR 1,1
5320 CT$="U2R4U18R7D8R3D3R3U9R3D7R5D4R3D5R5D2"
5325 CT2$="U5R1U3R1D3R2U3R1D3R2U3R1D3R2U3R1D3R2D3R1U1R1U10R1U1R3D1R1D6R3U10R4D14R5D3"
5327 CT3$="U20R6D18R1U5R2U8E2F2D5R1D9R2U9R1U9R4D13R3U9R6D5R2D10"
5330 PSET(0,180):DRAW "R32;XCT2$;R16;XCT$;R16;XCT3$;R5U10R6D10R5;XCT$;R16;XCT2$;R16;XCT$;R16;"
5340 PAINT (120,190),3
5380 LOCATE 25,5:PRINT"BTV";:LOCATE 25,11:PRINT "FSH";:LOCATE 25,17:PRINT"HPN";:LOCATE 25,24:PRINT"MAN";:LOCATE 25,30:PRINT "RAL";:LOCATE 25,36:PRINT"BOC";:LOCATE 1,1:PRINT"";
5700 STRIG OFF:LX=120:LY=100:PUT (120,100),CH%:BOOM%=0
5800 GOTO 50
6000 ' INSTRUCTIONS
6010 SCREEN 1,0:COLOR 1,1:WIDTH 40:KEY OFF:CLS
6020 LOCATE 2,9:PRINT "ANTI-BALLISTIC-MISSLE
6030 LOCATE 4,7:PRINT "You are the commander of a"
6040 LOCATE 5,4:PRINT"anti-ballistic missle defense system."
6050 LOCATE 6,4:PRINT "Your mission is to defend the IBM"
6070 LOCATE 7,4:PRINT "east coast sites from the enemy."
6080 LOCATE 9,7:PRINT "The enemy has 12 missles to fire"
6090 LOCATE 10,4:PRINT "at your 6 locations.  Your missles"
6100 LOCATE 11,4:PRINT "will destroy his if within range"
6110 LOCATE 12,4:PRINT "You may choose the megatonnage of"
6120 LOCATE 13,4:PRINT "your missiles, but will get a higher"
6130 LOCATE 14,4:PRINT"score with smaller boom-power.
6140 LOCATE 15,4:PRINT "The ememy does have MIRV capability."
6150 LOCATE 18,3:PRINT "WHAT SIZE (3-9) WARHEAD DO YOU WANT?:"
6160 LOCATE 20,4:PRINT "       3=SMALL (EXPERT)"
6170 LOCATE 21,4:PRINT "       5=NORMAL(GOOD)
6180 LOCATE 22,4:PRINT "       7=BIG   (BEGINNER)
6190 LOCATE 23,4:PRINT "       9=WOW!  (CHICKEN)
6200 DEF SEG=0:POKE 1050,PEEK(1052)
6210 K$=INKEY$:IF K$="" THEN 6210
6220 IF VAL(K$)>2 THEN WH%=VAL(K$) ELSE GOTO 6210
6500 RETURN
7000 ' CITIES NOT ALL DESTROYED
7003 NT%=0:FOR I=0 TO 5:NT%=NT%+T%(0,I):NEXT I
7010 CLS:COLOR 9,7
7020 PLAY"MBCDEFAB"
7030 LOCATE 4,11:PRINT " CONGRATULATIONS! "
7050 LOCATE 8,5:PRINT" YOU HAVE WON THE BATTLE.."
7060 LOCATE 10,5:PRINT NT%;" IBM LOCATIONS REMAIN"
7070 SC=SC+50:IF SC>HSC THEN HSC=SC
7080 LOCATE 12,5:PRINT "YOUR SCORE IS :";SC
7090 LOCATE 13,5:PRINT"THE HIGHEST SCORE IS:";HSC;" POINTS"
7100 LOCATE 20,5:PRINT"DO YOU WISH TO PLAY AGAIN (Y/N)"
7110 K$=INKEY$:IF K$="" THEN 7110
7120 IF K$="N" OR K$="n" THEN CLS:END
7130 IF K$="y" OR K$="Y" THEN 7200
7140 GOTO 7110
7200 LOCATE 20,5:PRINT" CHANGE YOU WARHEAD SIZE? (Y/N)     "
7210 K$=INKEY$:IF K$="n" OR K$="N" THEN GOTO 10
7220 IF K$="y" OR K$="Y" THEN GOSUB 6000:GOTO 10
7230 GOTO 7210
7500 END
10000 ' DEBUG ROUTINES
10010 CLS:FOR N=0 TO 15
10020 PRINT
10030 FOR I=0 TO 6
10040 PRINT "  ";M(I,N);
10050 NEXT I
10060 NEXT N
10070 END
65000 ' COLOR MONITOR-MONOCHROME MONITOR SWITCH    EMD 11-81
65001 CLS
65002 PRINT:PRINT"IF YOU WANT TO TOGGLE MONOCHROME/COLOR  THEN;"
65003 PRINT"   FOR COLOR PRESS - C"
65004 PRINT"   FOR MONO  PRESS - M"
65005 PRINT"   FOR NO CHANGE PRESS ANY OTHER KEY."
65006 K$=INKEY$:IF K$="" GOTO 65006
65007 IF K$="C" OR K$="c" THEN GOSUB 65019:END
65008 IF K$="M" OR K$="m" THEN GOSUB 65011:END
65009 CLS
65010 PRINT"@@@@@@@@@@@@    NO CHANGE   @@@@@@@@@@@@@@":END
65011 REM switch to monochrome adapter
65012 DEF SEG=0
65013 POKE &H410,(PEEK(&H410) OR &H30)
65014 DEF SEG
65015 LOCATE ,,1,12,13
65016 SCREEN 0
65017 WIDTH 80
65018 RETURN
65019 REM switch to color/graphics adapter
65020 DEF SEG=0
65021 POKE &H410,(PEEK(&H410) AND &HCF) OR &H20
65022 DEF SEG
65023 LOCATE ,,1,6,7
65024 SCREEN 0
65025 WIDTH 40
65026 RETURN