Classic Computer Magazine Archive Article from Compute! magazine

Space Caverns
For Atari, Commodore 64, VIC-20, Apple, & IBM

Vince Valenti

Hostile aliens track you down with the tenacity of bloodhounds in "Space Caverns," an action game for multiple computers. Originally written for the Atari (16K RAM for tape or 24K RAM for disk), adaptations have been added for the Commodore 64, VIC-20 (with 8K expander), Apple II series, and IBM PC/PCjr (color or monochrome). The Atari, 64, VIC, and Apple versions also require a joystick.


The object of "Space Caverns" is to elude four maniacal aliens who relentlessly home in on your diamond-shaped ship. You can move the ship up, down, left, and right, but there is no escape from the dangerous caverns-you can only advance further into the depths, shooting the aliens before they clobber you.
    The aliens aren't dummies, either. They are fairly intelligent and will seek you out faster than you can run away. If you manage to defeat them in several successive rooms, you get a bonus round in which you stalk sedentary aliens that randomly appear around the screen. A countdown clock limits the amount of time you have to capture these aliens. When it runs out, you advance to a harder level within the caverns.
    After each game, the three highest scores flash on the screen, challenging you to do better next time.

Atari Version
Plug a joystick into port 1. You can choose which level you'd like to start at by pressing the SELECT key. But be forewarned-the higher levels can be very frustrating if you're a beginner. The caverns keep shrinking, leaving less room to maneuver.
    Pressing the joystick fire button or START key begins the game. To go back to the title screen at any time during the game, press either START, SELECT, or OPTION. The number of rooms increases on each level, and the number of points you get for capturing sedentary aliens

Atari version
Unfriendly aliens search out the diamond-shaped ship in
"Space Caverns," Atari version.

during the bonus rounds is equal to the current value of the countdown clock. The fire button shoots the laser gun in the last direction the joystick was pointed.
    If you don't want to type in the program, send a blank cassette, a self-addressed, stamped mailer, and a check or money order for $3 to:

Vince Valenti
3687 Hacienda
Las Vegas, NV 89120
(Atari version only.)

Commodore 64 And VIC-20 Versions
Before loading the VIC version of Space Caverns, be sure your 8K (or greater) memory expander is plugged in, and then enter the following line:

POKE 44,28:POKE 43,1:POKE 28*256,0:NEW

Then press RETURN, and load and run the program as usual.
    Plug the joystick into port 2 on the Commodore 64. Press the joystick button to start the game.
    Both Commodore versions are similar in play-the number of rooms on a particular level is always twice the level number, and the points you gain for capturing stationary aliens during the bonus rounds correspond to the countdown clock. Also, each room has a small cave at the center of the screen. In the VIC version, your ship always appears within this cave. There's no exit, but you can shoot holes in the walls with your laser gun. The walls are no barriers to the aliens, however.
    In the 64 version, your ship appears randomly when you begin each room-sometimes within the central cave, and sometimes not. If you appear inside the cave, you must escape quickly, because your laser won't work until you get out.
    To fire, move the joystick to aim and press the fire button.

Apple Version
Plug in a joystick to control your ship and use the first fire button to activate the laser.
    On higher levels, obstacles and a central cave appear on the screen, but you can shoot through them to defend yourself against the aliens.
    During the bonus rounds, stationary aliens are worth 100 points each.

IBM Version
Space Caverns runs on any PCjr or PC with either the color/graphics or monochrome adapter. Since the program is formatted for 40 columns, however, the game occupies only half the screen on a monochrome PC.
    Control your ship by pressing the I key to move up, K to move down, J to move left, and L to move right. (Press Caps Lock if the keyboard doesn't respond.) This upside-down "T" pattern might seem odd, but it's actually much handier than the usual diamond pattern found on cursor keypads. Simply rest the first three fingers of your right hand on J-K-L, just as you would when touch-typing. Then move your middle finger up and down to press I and K.
    Pressing the space bar fires your laser gun in the last direction you moved. But a special twist has been added-you must load the laser each time before firing. To do this, press the R key. If you're playing on a PCjr or a PC with the color/graphics adapter, you'll notice that your ship is yellow when the gun is empty and white when it's loaded.
    If you find the game too hard to play at first in this single-shot mode, modify it for continuous firing by changing line 360:

360 A$=INKEY$:POKE 1050,PEEK(1052):IF A$=""
    THEN 470

Program 1: Space Caverns For Atari
Please refer to "COMPUTE!'s Guide To Typing In
Programs" before entering this listing.

PM 10 GOTO 30
OD 20 POKE 756,PEEK(106)+2:RETURN
FL 30 POKE 106,PEEK(106)-4:GRAPHICS
      17:GOSUB 20:POSITION 5,9:? #6;
      "PLEASE WAIT"
GG 40 C=(PEEK(106)+2)*256
DL 50 FOR I=0 TO 511:POKE C+I,PEEK(5
      7344+I):NEXT I
FM 60 FOR I=C+8*3 TO C+8*9+7:READ A:
      POKE I,A:NEXT I
PM 70 DATA 0,8,20,34,73,34,20,8,0,0,
      8,20,42,20,8,0,24,60,106,126,1
      02,60,24,60
LL 80 DATA 24,60,86,126,102,60,24,10
      2,255,219,165,219,219,165,219,
      255
NH 90 DATA 136,33,0,148,1,72,2,16,8,
      8,8,8,8,8,8,8
EI 100 L=I:P=6
JG 110 ? #6;"{CLEAR}":POSITION 7,17:
       ? #6;"level:";L:POKE 708,170
FM 120 POSITION 0,0:? #6;" ";:FOR I=
       1 TO 8:? #6;CHR$(39);C:HR$(167
       );:NEXT I:? #6;CHR$(39):POSIT
       ION 0,4:? #6;" ";
HK 130 FOR I=1 TO 8:? #6;CHR$(39);CH
       R$(167);:NEXT I:? #6;CHR$(39)
       :POSITION 0,23:? #6;" ";:FOR
       I=1 TO 8
LE 140 ? #6;CHR$(167);CHR$(39);:NEXT
        I:? #6;CHR$(167):FOR G=0 TO
       23 STEP 2:POSITION 1,G:? #6;C
       HR$(39)
AC 150 POSITION 18,G:? #6;CHR$(167):
       POSITION 1,G+1:? #6;CHR$(167)
       :POSITION 18,6+1:? #6;CHR$(39
       ):NEXT G
IE 160 POSITION 4,1:? #6;"space":POS
       ITION 9,3:? #6;"caverns"
OI 170 FOR G=1 TO 50:POKE 710,0:POKE
        708,170:GOSUB 230:POKE 710,1
       30:POKE 708,0:GOSUB 230:NEXT
       G
KM 180 GOSUB 300
BL 190 POSITION 3,2:? #6;" high scor
       es:":POSITION 5,7:? #6;H1:POS
       ITION 5,10:? #6;H2:POSITION 5
       ,13:? #6;H3
OC 200 FOR G=1 TO 50:POKE 710,0:POKE
        708,170:GOSUB 230:POKE 710,1
       30:POKE 708,0:GOSUB 230:NEXT
       G
KG 210 GOSUB 300
GE 229 GOTO 160
HM 230 IF PEEK(53279)=6 THEN 330
G8 240 IF STRIG(0)=0 THEN 330
GE 250 IF PEEK(53279)<>5 THEN RETURN
DK 260 L=L+1:IF L>5 THEN L=1
FP 270 POSITION 13,17:? #6;L
CD 280 IF PEEK(53279)<>7 THEN 280
HL 290 RETURN
GK 300 FOR G=1 TO 3:POSITION 2,G:? #
       6;"(16 SPACES}":NEXT G
KA 310 FOR 8=5 TO 13:POSITION 2,G:?
       #6;"(16 SPACES)":NEXT G
HF 320 RETURN
GL 330 GRAPHICS 17:GOSUB 20
NL 340 S=0:D=3:N=0:E=0:GOSUB 830
CI 350 T=STICK (0 )
GL 360 IF PEEK(53279)<>7 THEN S=0:D=
       0:GOTO 1130
PP 370 SOUND 0,100,10,6
IN 380 IF T=14 AND Y>L THEN Y=Y-1:PO
       SITION X,Y+1:? #6;" ":POSITIO
       N X,Y:? #6;"$"
BJ 390 IF T=13 AND Y<20-L THEN Y=Y+1
       :POSITION X,Y-1:? #6;" ":POSI
       TION X,Y:? #6;"$"
IN 400 POKE 77,0
AN 410 IF T=7 AND X<18-L THEN X=X+1:
       POSITION X-1,Y:? #6;" $"
LA 420 IF S>9999 AND E=0 THEN E=1:D=
       D+1:POSITION 3,21:? #6;"e{RVR}x{OFF}t{REV}r{OFF}a
        {RVR}s{OFF}h{RVR}i{OFF}p{RVR}1{OFF}":FOR G=0 TO 120:GOTO 7
       40
KF 430 IF T=11 AND X>1+L THEN X=X-1:
       POSITION X,Y:? #6;"$ "
CL 440 IF TI>0 THEN 1540
JG 450 IF STRIG(0)=0 THEN 1160
AK 460 POSITION X1,Yl:? #6;CHR#(166):
       POSITION X2,Y2:? #6;"&":POSITI
       ON X3,Y3:? #6;CHR$(166):POSITI
       ON X4,Y4:? #6;"&"
PE 470 IF L>l AND X=7 AND Y=6 THEN 99
       0
BP 480 IF LM THEN POSITION 7,6:? #6;
       CHR$(166)
AF 490 SOUND 0,220,10,6
E1 500 IF L>2 AND X=10 AND Y=14 THEN
       990
ON 510 IF L>2 THEN POSITION 10,14:? #
       6;"%"
BB 520 IF X>Xl AND X1<18-L AND A1=0 T
       HEN Xl=Xl+1:POSITION XS-1,Y1:?
       #6;" ";CHR$(165)
BF 530 IF X>X2 AND X2<18-L AND A2=0 T
       HEN X2=X2+1:POSITION X2-1,Y2:?
        #6;" %"
CB 540 IF X>X3 AND X3<18-L AND A3=0 T
       HEN X3=X3+1:POSITION X3-1,Y3:?
        #6;" ";CHR$(165)
CF 550 IF X>X4 AND X4<18-L AND A4=0 T
       HEN X4=X4+1:POSITIDN X4-1,Y4:?
        #6;" %"
HP 560 IF X<Xl AND X1>1+L AND A1=0 TH
       EN X1=Xl-1:POSITION X1,Y1:? #6
       ;CHR$(165);" "
BC 570 POSITION X,Y:? #6;"#"
IE 580 IF X<X2 AND X2>1+L AND A2=0 TH
       EN X2=X2-1:POSITION X2,Y2:7 #6
       ;"% "
JA 590 IF X<X3 AND X3>1+L AND A3=0 TH
       EN X3=X3-1:POSITION X3,Y3:? #6
       ;CHR$(165);" "
GD 600 SOUND 0,0,0,0
IN 610 IF X<X4 AND X4>1+L AND A4=0 TH
       EN X4=X4-1:POSITION X4,Y4:? #6
       ;"% "
EB 620 IF Y<Yl AND Y1>L AND A1=0 THEN
        Y1=Yl-1:PDSITION Xl,Y1+l:? #6
       ;" ":POSITION XI,Yl:? #6;'CHR$(
       165)
M0 630 IF Y<Y2 AND Y2>L AND A2=0 THEN
        Y2=Y2-1:POSITION X2,Y2+1:? #6
       ;" ":POSITION X2,Y2:? #6;"%"
FF 640 IF Y<Y3 AND Y3>L AND A3=0 THEN
        Y3=Y3-1:POSITION X3,Y3+1:? #6
       ;" ":POSITION X3,Y3:? #6;CHR$(
       165)
NK 650 IF Y<Y4 AND Y4>L AND A4=0 THEN
        Y4=Y4-1:POSITION X4,Y4+1:? #6
       ;" ":POSITION X4,Y4:? #6;"%"
NE 660 IF Y>Yl AND Y1<20-L AND A1=0 T
       HEN Y1=Y1+1:POSITION X1,Y1-l:?
        #6;" ":POSITION X1,Yl: #6;CH
       R$(165)
BA 670 IF Y>Y2 AND Y2<18-L AND A2=0 T
       HEN Y2=Y2+1:POSITION X2,Y2-1:?
        #6;" ":POSITION X2,Y2:? #6;"%
       "
OP 680 IF Y>Y3 AND Y3<18-L AND A3=0 T
       HEN Y3=Y3+1:POSITION X3,Y3-1:?
        #6;" ":POSITION X3,Y3:? #6;CH
       R$(165)
HE 690 IF Y>Y4 AND Y4<18-L AND A4=0
       THEN Y4=Y4+1:POSITION X4,Y4-1
       :? #6;" ":POSITION X4,Y4:? #6
       ;"%"
OF 700 SOUND 1,0,0,0
HB 710 IF A1=1 AND A2=1 AND A3=1 AND
       A4=1 THEN GOSUB 750
CM 720 IF X=Xl AND Y=Yl OR X=X2 AND
       Y=Y2 OR X=X3 AND Y=Y3 OR X=X4
        AND Y=Y4 THEN 990
PK 730 FOR I=0 TO 3:SOUND I,0,0,0:NE
       XT I:GOTO 350
NO 740 SOUND 0,200,10,4:SOUND 0,8,10
      
,4:NEXT G:POSITION 3,21:? #6;
       "{ll SPACES}":GOTO 430
CD 750 POKE 710,130
PI 760 POSITION 6,Y-1:? #6;"{RVS}next{OFF} roo
       m"
NK 770 FOR G=0 TO X:POSITION 8,Y;? #
       6;"{RVS}({OFF}":FOR H=1 TO 6:SOUND 0,RN
       D(0)*50,10,5:NEXT H:NEXT S
E0 780 FOR G=X-1 TO 0 STEP -1:POSITI
       ON G,Y:? #6;"# ":FOR H=l TO 6
       :SOUND 0,RND(0)*50,l0,5:NEXT
       H:NEXT G
BH 790 SOUND 0,0,0,0:FOR G=0 TO 99:N
       EXT G
FE 800 FOR G=0 TO 23:POSITION 0,G:?
       #6;"{19 SPACES}":SOUND 0,G*8,1
       0,5:NEXT G
OL 810 P=P+16:IF P>217 THEN P=6
PP 820 S=S+(L*500+N*50):POSITION 5,1
       2:? #6;"{RVS}bonus{OFF} : ";L*500+N*50
LE 830 IF L=5 THEN 850
ON 840 IF N=L*2 THEN L=L+1:N=0:GOTO
       1500
MC 850 IF N=200 OR N=400 OR N=800 TH
       EN 1500
NO 860 N=N+1
DK 870 POSITION 5,8:? #6;"level : ";
       L:POSITION 2,10:? #6;"
       {4 SPACES}room : ";N:L1=0
PH S80 POKE 708,P:POKE 710,P+32
IF 890 FOR G=6 TO 0 STEP -0.5:FOR H=
       200 TO 100 STEP -8:SOUND 0,H,
       10,G
OA 900 NEXT H:NEXT G
NF 910 X=INT(RND(0)*7)+6:Y=INT(RND(0
       )*6)+7
ND 920 X1=L+1:Y1=L:X2=L+1:Y2=20-L:Y3
       =20-L:X3=18-L:X4=18-L:Y4=L
MM 930 Al=0: A2=0: A3=0: A4=0
FB 940 POSITION 5,8:? #6;"
       {12 SPACES}":? #6:POSITION 2,1
       0:? #6;"{14 SPACES}":POSITION
       5,12:? #6;"{14 SPACES}"
CC 950 POSITION 2,22:? #6;"score:";S
       ;" MEN:";D
GO 960 FOR G=0 TO L-1:FOR H=1+G TO 1
       8-G:POSITION H,G:? #6;CHR$(16
       7):POSITION H,20-G:? #6;CHR$(
       167):NEXT H
KJ 970 FOR H=G TO 20-G:POSITION G+1,
       H:? #6;CHR$(39):POSITION 18-G
       ,H:? #6;CHR$(39):NEXT H:NEXT
       G
IB 980 RETURN
MF 990 D=D-1
HA 1000 XX=X:YY=Y:XL=X:YL=Y
DA 1010 FOR G=200 TO 90 STEP -4:POKE
         708,64-((G-80)/10):SOUND 0,
        G,8,9:NEXT G
IM 1020 FOR G=1 TO 12.-SOUND 0,20*G,8
        ,G+3
PA 1030 XX=XX-1:IF XX<:0 THEN XX=0
DD 1040 XL=XL+1:IF XL>18 THEN XL=18
PK 1050 YY=YY-1: IF YY<0 THEN YY=0
DB 1060 YL=YL+1:IF YL>23 THEN YL=23
DG 1070 POSITION X,Y:? #6;"(":POSITI
        ON XX,YY:? #6;"(":POSITION X
        L,YL:? #6;"("
DD 1080 POSITION XL,YY:? #6;"(":POSI
        TION XX,YL:? #6;"(":POSITION
         XL, Y: ? #6;"("
JM 1090 POSITION XX,Y:? #6;"(":POSIT
        ION X,YL:? #6;"(":POSITION X
        ,YY:" #6;"("
JK 1100 POKE 708,64-G
FA 1110 NEXT G:SOUND 0,0,0,0
FE 1120 FOR G=1 TO 100:NEXT G
ML 1130 FOR G=0 TO 23:POSITION 0,G:?
         #6;"{l9 SPACES}":NEXT G.
PP 1140 IF D=0 THEN 1450
PB 1150 GOSUB 870:GOTO 350
HC 1160 IF T=14 THEN A=-l.W=L
NE 1170 IF T=13 THEN A=1:W=20-L
MN 1180 IF T=11 THEN A=-1:W=1+L
LA 1190 IF T=7 THEN A=1:W=18-L
ND 1200 IF T=13 OR T=14 THEN 1230
KG 1210 IF T=7 OR T=11 THEN 1340
CF 1220 FOR I=0 TO 3:SOUND I,0,0,0:N
        EXT I:GOTO 350
EN 1230 SOUND 0,7,4,6:FOR G=Y TO W S
        TEP A:POSITION X,G:? #6;"p":
        NEXT G
IN 1240 FOR G=Y TO W STEP A:POSITION
        X,G:? #6;" ":NEXT G
PF 1250 IF A=-1 AND Y>=Y1 AND X=X1 T
        HEN S=S+50:SOUND 1,50,8,5:X1
        =4:Y1=23:Al=1
FE 1260 IF A=-1 AND Y>=Y2 AND X=X2 T
        HEN S=S+100:SOUND 1,100,8,5:
        X2=5:Y2=23:A2=1
GF 1270 IF A=-1 AND Y>=Y3 AND X=X3 T
        HEN S=S+150:SOUND 1,150,8,5:
        X3=6:Y3=23:A3=1
GE 1280 IF A=-1 AND Y>=Y4 AND X=X4 T
        HEN S=S+200:SOUND 1,200,8,5:
        X4=7:Y4=23:A4=1
MF 1290 IF A=l AND Y<=Yl AND Yl<20 A
        ND X=X1 THEN S=S+50:SOUND 1,
        50,8,5:X1=4:Y1=23:Al=1
BM 1300 IF A=1 AND Y<:=Y2 AND Y2<20 A
        ND X=X2 THEN S=S+100:SOUND 1
        ,100,8,5:X2=5:Y2=23:A2=1
C0 1310 IF A=1 AND Y<:=Y3 AND Y3<:20 A
        ND X=X3 THEN S=S+150:SOUND 1
        ,150,8,5:X3=6:Y3=23:A3=1
CN 1320 IF A=1 AND Y<=Y4 AND Y4<20 A
        ND X=X4 THEN S=S+200:SOUND 1
        ,200,8,5:X4=6:Y4=23:A4=1
FI 1330 POSITION 2,22:? #6;"score:";
        S;" MEN:";D:GOTO 460
IF 1340 SOUND 0,7,4,6:FOR G=X TO W S
        TEP A:POSITION G,Y:? #6;"{RVR}_{OFF}":
        NEXT G
IP 1350 FOR G=X TO W STEP A:POSITION
        G,Y:? #6;" ":NEXT G
PH 1360 IF A=-1 AND Y=Y1 AND X>=X1 T
        HEN S=S+50:SOUND 1,50,8,5:X1
        =4:Y1=23:Al=1
FG 1370 IF A=-l AND Y=Y2 AND X>=X2 T
        HEN S=S+100:SOUND 1,100,8,5:
        X2=5:Y2=23:A2=1
GH 1380 IF A=-1 AND Y=Y3 AND X>=X3 T
        HEN S=S+150:SOUND 1,150,8,5:
        X3=6:Y3=23:A3=1
GG 1390 IF A=-1 AND Y=Y4 AND X>=X4 T
        HEN S=S+200:SOUND 1,200,8,5:
        X4=7:Y4=23:A4=1
MD 1400 IF A=1 AND Y=Y1 AND X<=X1 TH
        EN S=S+50:SOUND 1,50,8,5:X1=
        4:Y1=23:Al=1
CC 1410 IF A=1 AND Y=Y2 AND X<=X2 TH
        EN S=S+100:SOUND 1,100,8,5:X
        2=5:Y2=23:A2=1
DD 1420 IF A=1 AND Y=Y3 AND X<=X3 TH
        EN S=S+150:SOUND 1,150,8,5:X
        3=6:Y3=23:A3=1
DC 1430 IF A=1 AND Y=Y4 AND X<=X4 TH
        EN S=S+200:SOUND 1,200,8,5:X
        4=7:Y4=23:A4=1
JN 1440 GOTO 460
LB 1450 IF S>Hl THEN H3=H2:H2=H1:Hl=
        S:GOTO 1480
EK 1460 IF S>H2 THEN H3=H2:H2=S:GOTO
         1480
KB 1470 IF S>H3 THEN H3=S
K0 1480 POSITION 5,13:? #6;"GAME OVE
        R"
GC 1490 FOR G=1 TO 100:NEXT G:GOTO 1
        00
MI 1500 TI=200+L*60:SOUND 0,0,0,0:P0
        SITION 3,23:? #6;"bonus {RVS}roun
        d{OFF}":FOR G=0 TO 99:NEXT G:L1=L
        :L=I:X=10:Y=X:XI=X:Yl=15
DK 1510 POKE 708,170:POSITION 1,0:FO
        R I=1 TO 9:? #6;CHR$(167);CH
        R$(39);:NEXT I:? #6:FOR I=1
        TO 10
PM 1520 ? #6;" '{16 SPACES}{RVR}'{OFF}:? #6;"
        {RVR}'{OFF}{16 SPACES}'":NEXT I:POSITIO
        N 1,20
DB 1530 FOR I=1 TO 9:? #6;CHR$(167);
        CHR$ 039);:NEXT I
M0 1540 TI=TI-1:POSITION 12,21:? #6;
        TI;" ":? #6;"score :";S:IF T
        I=0 THEN L=L1:L1-1:GOTO 790
KL I550 IF X=X1 AND Y=Y1 THEN SOUND
        0,12,4,8:S=S+TI:X1=INT(RND(0
        )16)+2:Y1=INT(RND(0)*18)+l
JD 1560 POSITION X,Y:? #6;"#":POSITIO
        N X1,Y1:? #6;CHR$(166):SOUND
        0,TI/2,10,6:GOTO 350


Program 2: Space Caverns For
Commodore 64
Version by Kevin Martin, Editorial Programmer
Please refer to "COMPUTE!'s Guide To Typing In
Programs" before entering this listing.

10 GOSUB 1300                    :rem 165
20 V=54272:POKEV+24,15:POKEV+5,0:POKEV+6,
   240:POKEV,100                 :rem 180
30 POKE53281,0:POKE53280,0       :rem 184
40 PRINT"{CLR}{8 DOWN}{13 RIGHT}[<1>]SPACE
   {SPACE}CAVERNS"               :rem 200
50 PRINT"{3 DOWN}{14 RIGHT}[<7>]HIGH SCORES
   "                             :rem 136
60 PRINTTAB(17)"{DOWN}{RED}"H1   :rem 109
70 PRINTTAB(17)"{DOWN}{PUR}"H2   :rem 239
80 PRINTTAB(17)"{DOWN}{GRN}"H3   :rem 115
90 PRINT"{YEL}{2 DOWN}{5 RIGHT}PRESS THE
   {SPACE}FIRE BUTTON TO PLAY"   :rem 212
100 IFPEEK(56320)AND16THEN100    :rem 144
110 L=1:S=0:R=0:SH=3:Q=0:W=33    :rem 176
120 IFR=L*2THENL=L+1:R=0:GOSUB1040:rem 49
130 PRINT"{CLR}{11 DOWN}"TAB(16)"{RED}LEV
    EL:{WHT}"L                   :rem 165
140 PRINT"{7 DOWN}"TAB(16)"{GRN}ROOM:
    {WHT)";R+1                    :rem 51
150 FORI=1TO1000:NEXT             :rem 17
160 POKE53281,11:PRINT"{CLR)":POKE53281,0
                                 :rem 189
170 IFS>10000ANDQ=0THEN PRINT"{HOME}
    {15 RIGHT}{WHT}EXTRA SHIP":SH=SH+1:Q=
    1                            :rem 191
180 Yl=L+1:X1=L:Y2=L+1:X2=39-L:X3=39-L:Y3
    =22-L:Y4=22-L:X4=L           :rem 219
190 A1=1:A2=1:A3=1:A4=1          :rem 206
200 FORI=0T039:POKEI+1064,37:POKEI+1904,3
    7:NEXT                        :rem 54
210 FORI=5TO34:POKEI+1224,37:POKEI+1744,3
    7:NEXT                        :rem 55
220 FORI=12TO27:POKEI+1384,37:POKEI+1584,
    37:NEXT                      :rem 113
230 POKE1244,32:POKE1404,32:POKE1764,32:P
    OKE1604,32                   :rem 116
240 FORI=1TO22:POKEI*40+1024,37:POKEI*40+
    1063,37:NEXT                  :rem 71
250 FORI=5TO18:POKEI*40+1029,37:POKEI*40+
    1058,37:NEXT                  :rem 90
260 FORI=9TO14:POKEI*40+1036,37:POKEI*40+
    1051,37:NEXT                  :rem 82
270 POKE1509,32:POKE1516,32:POKE1538,32:P
    OKE1531,32                   :rem 126
280 X=INT(RND(1)*10)+15:Y=INT(RND(0)*6)+8
                                  :rem 33
290 PRINT"{HOME}{40 SPACES}"     :rem 127
300 POKE1024+X+40*Y,W:POKE55296+X+40*Y,1
                                   :rem 7
310 IFX=X1ANDY=Y1THEN910         :rem 253
320 IFX=X2ANDY=Y2THEN910           :rem 0
330 IFX=X3ANDY=Y3THEN910           :rem 3
340 IFX=X4ANDY=Y4THEN910           :rem 6
350 W=W+1:IFW=35THENW=33         :rem 205
360 POKE1024+X1+40*Yl,W+2:POKE55296+X1+40
    *Y1,5                         :rem 50
370 POKE1024+X2+40*Y2,W+2:POKE55296+X2+40
    *Y2,5                         :rem 55
380 POKE1024+X3+40*Y3,W+2:POKE55296+X3+40
    *Y3,5                         :rem 60
390 POKE1024+X4+40*Y4,W+2:POKE55296+X4+40
    *Y4,5                         :rem 65
400 PRINT"{HOME)";:POKE211,5:PRINT"SCORE:
    ";S;:POKE211,30:PRINT"SHIPS:";SH
                                 :rem 201
410 IF(A1+A2+A3+A4)=0THEN850     :rem 253
420 J=PEEK(56320):D=JAND15:B=JAND16
                                  :rem 14
430 IFD=15THEN680                :rem 218
440 IFX>12ANDX<27ANDY>9ANDY<14THEN460
                                  :rem 41
450 IFB=0THEN540                 :rem 159
460 POKE1024+X+40*Y,32           :rem 182
470 XA=0:YA=0                    :rem 226
480 IFD=14ANDY>L+ITHENYA=-1      :rem 135
490 IFD=13ANDY<22-LTHENXA=1      :rem 141
500 IFD=11ANDX>LTHENXA=-1         :rem 31
510 IFD=7ANDX<39-LTHENXA=1        :rem 95
520 IFPEEK(1024+(X+AA)+(Y+YA)*40)=32THENX
    =X+XA:Y=Y+YA                 :rem 147
530 GOTO680                      :rem 111
540 POKEV+4,129:FORI=100TO10STEP-10:POKEV
    +1,I:NEXT:POKEV+4,128         :rem 57
550 IFD=14THENJ=X:FORI=Y-ITOISTEP-1:GOSUB
    600:IFBTHENNEXT              :rem 178
560 IFD=13THENJ=X:FORI=Y+1TO22:GOSUB600:I
    FBTHENNEXT                    :rem 73
570 IFD=11THENI-Y:FORJ=X-1TOISTEP-1:GOSUB
    600:IFBTHENNEXT              :rem 177
580 IFD=7THENI=Y:FORJ=X+1TO39:GOSUB600:IF
    BTHENNEXT                     :rem 38
590 GOTO680                      :rem 117
600 B=-1                         :rem 115
610 IFJ-XIANDI=YITHENA1=0:X1=0:Y1=0:S=S+5
    0:B=0                         :rem 30
620 IFJ=X2ANDI=Y2THENA2=0:X2=1:Y2=0:S=S+1
    00:B=0                        :rem 81
630 IFJ-X3ANDI-Y3THENA3=0:X3-2:Y3=0:S=S+1
    50:B=0                        :rem 93
640 IFJ=X4ANDI=Y4THENA4=0:X4=3:Y4=0:S-S+2
    00:B=0                        :rem 96
650 IFPEEK(1024+I*40+J)<>32THENB=0
                                 :rem 155
660 POKE55296+I*40+J,3:POKE1024+I*40+J,39
    :FORK=1TO10:NEXT:POKE1024+I*40+J,32
                                 :rem 122
670 RETURN                       :rem 125

COMMODORE 64 VERSION
On the Commodore 64, you must maneuver your ship out
of the central cave before your laser becomes operative.

680 IFA1=0THEN720                :rem 212
690 POKE1024+X1+40*Y1,32          :rem 29
700 Xl=Xl+(Xl>X)-(X1<X)           :rem 28
710 Yl=Yl+(Y1>Y)-(Y1<Y)           :rem 35
720 IFA2=0THEN760                :rem 212
730 POKE1024+X2+40*Y2,32          :rem 26
740 X2=X2+(X2>X)-(X2<X)           :rem 36
750 Y2=Y2+(Y2>Y)-(Y2<Y)           :rem 43
760 IFA3=OTHEN800                :rem 212
770 POKE1024+X3+40*Y3,32          :rem 32
780 X3=X3+(X3>X)-(X3<X)           :rem 44
790 Y3=Y3+(Y3>Y)-(Y3<Y)           :rem 51
800 IFA4=OTHEN840                :rem 212
810 POKE1024+X4+40*Y4,32          :rem 29
820 X4=X4+(X4>X)-(X4<X)           :rem 43
830 Y4=Y4+(Y4>Y)-(Y4<Y)           :rem 50
840 GOTO300                      :rem 104
850 N=N+1:PRINT"{HOME}{5 RIGHT}
    {10 SPACES}{WHT}NEXT ROOM{16 SPACES}"
                                   :rem 2
860 FORG=0TOX:POKE55296+G+40*Y,6:POKE1024
    +G+40*Y,38:NEXT               :rem 82
870 FORG=X-1TOOSTEP-1:POKE55296+G+Y*40,1:
    POKE1024+G+Y*40,33           :rem 200
880 POKE1025+G+Y*40,32:NEXT       :rem 37
890 PRINT"{CLR}{11 DOWN}{14 RIGHT}{CYN}BO
    NUS:{RED}";L*500+R*50:S=S+L*500+R*50:
    R=R+1                        :rem 250
900 FORI=1TO1500:NEXT:GOTO120     :rem 31
910 POKEV+1,50:POKEV+4,129:X1=X-1:X2=X+1:
    Yl=Y-1:Y2=Y+1                :rem 204
920 FORI=1TO20                    :rem 62
930 POKE1024+X1+40*Yl,38:POKE55296+X1+40*
    Y1,2                         :rem 233
940 POKE1024+X2+40*Yl,38:POKE55296+X2+40*
    Y1,2                         :rem 236
950 POKE1024+X1+40*Y2,38:POKE55296+X1+40*
    Y2,2                         :rem 237
960 POKE1024+X2+40*Y2,38:POKE55296+X2+40*
    Y2,2                         :rem 240
970 IFX1>0THENX1=X1-1              :rem 2
980 IFX2<39THENX2=X2+1            :rem 62
990 IFY1>0THENY1=Y1-1              :rem 7
1000 IFY2<22THENY2=Y2+1           :rem 89
1010 NEXT:POKEV+4,128            :rem 230
1020 SH=SH-1:IFSH=OTHEN1250       :rem 92
1030 GOTO120                     :rem 144
1040 T=200+L*60:X=20:Y=11         :rem 82
1050 POKE53281,11:PRINT"{CLR}":POKE53281,
     0                           :rem 236
1060 PRINT"{HOME}{14 RIGHT}{GRN}BONUS ROU
     ND"                         :rem 110
1070 FORI=1064TO1103:POKEI,37:POKEI+21*40
     ,37:NEXT                    :rem 141
1080 FORI=1064TO1064+40*21STEP40:POKEI,37
     :POKEI+39,37:NEXT           :rem 203
1090 POKEV+1,5:POKEV+4,33:FORI=10TO100STE
     P2:POKEV+1,I:NEXT:POKEV+4,32 :rem 30
1100 Xl=INT(RND(0)*40)           :rem 183
1110 Yl=INT(RND(0)*20)+1:IFPEEK(1024+X1+Y
     1*40)<>32THEN1100           :rem 224
1120 POKE55296+X1+Y1*40,6:POKE1024+Xl+Y1*
     40,36:GOTO1140               :rem 76
1130 IFPEEK(1024+X+Y*40)=36THENS=S+T:GOTO
     1100                        :rem 146
1140 POKE55296+X+Y*40,1:POKE1024+X+Y*40,W
                                  :rem 58
1150 W=W+1:IFW=35THENW=33        :rem 252
1160 PRINT"{HOME}{PUR}SCORE:{WHT}";S;:POK
     E211,30:PRINT"{YEL}TIME:{WHT}";T;"
     {LEFT} "                     :rem 26
1170 J=PEEK(56320):D=JAND15:B=JAND16
                                  :rem 65
1180 POKE1024+X+40*Y,32          :rem 230
1190 IFD=14ANDY>2THENY=Y-1        :rem 88
1200 IFD=13ANDY<21THENY=Y+1      :rem 124
1210 IFD=11ANDX>lTHENX=X-1        :rem 74
1220 IFD=7ANDX<38THENX=X+l        :rem 86
1230 T=T-1:IFT=OTHENRETURN       :rem 162
1240 GOTO1130                    :rem 197
1250 IFS>HITHENH3=H2:H2=Hl:Hl=S:GOTO1280
                                 :rem 173
1260 IFS>H2THENH3=H2:H2=S:GOTO1280:rem 70
1270 IFS>H3THENH3=S              :rem 159
1280 PRINT"{CLR}{14 DOWN}{15 RIGHT}{RED}G
     AME OVER"                    :rem 66
1290 FORI=1TO1500:NEXT:GOTO30     :rem 34
1300 PRINT"{CLR}{11 DOWN}{9 RIGHT}LOADING
      CHARACTER SET"              :rem 95
1310 POKE56334,PEEK(56334)AND254:POKEI,PE
     EK(1)AND251                 :rem 230
1320 FORI=0T0511:POKE12288+I,PEEK(53248+I
     ):NEXT
                                  :rem 20
1330 POKE1,PEEK(1)OR4:POKE56334,PEEK(5633
     4)OR1                       :rem 182
1340 I=12552                      :rem 77
1350 READA:IFA=-ITHEN1370        :rem 197
1360 POKEI,A:I=I+1:GOTO1350       :rem 80
1370 POKE53272,(PEEK(53272)AND240)OR12
                                  :rem 96
1380 RETURN                      :rem 172
1390 DATA 0,8,20,34,73,34,20,8   :rem 183
1400 DATA 0,0,8,20,42,20,8,0      :rem 61
1410 DATA 24,60,106,126,102,60,24,60
                                 :rem 213
1420 DATA 24,60,86,126,102,60,24,102
                                 :rem 218
1430 DATA 255,219,165,219,219,165,219,255
                                 :rem 246
1440 DATA 136,33,0,148,1,72,2,16  :rem 23
1450 DATA 0,0,0,24,24,0,0,0        :rem 4
1460 DATA -1                      :rem 67



Program 3: Space Caverns For VIC-20
Version by Kevin Martin, Editorial Programmer
Please refer to "COMPUTE!'s Guide To Typing In
Programs" before entering this listing.

10 GOSUB 1270                    :rem 171
20 POKE36878,15                   :rem 51
30 POKE 36879,8                    :rem 7
40 PRINT"{CLR}{6 DOWN}{4 RIGHT}{WHT}SPACE
   CAVERNS"                       :rem 37
50 PRINT"{3 DOWN}{5 RIGHT}{BLU}HIGH SCORE
   S"                              :rem 8
60 PRINTTAB(8)"{DOWN}{RED}"H1     :rem 61
70 PRINTTAB(8)"{DOWN}{PUR}"H2    :rem 191
80 PRINTTAB(8)"{DOWN}{GRN}"H3     :rem 67
90 PRINT"{YEL}{2 DOWN}{2 RIGHT}PRESS FIRE
TO PLAY"                         :rem 192
100 IFPEEK(37137)AND32THEN100    :rem 147
110 L=1:S=0:R=0:SH=3:Q=0:W=33    :rem 176
120 IFR=L*2THENL=L+1:R=0:GOSUB1000:rem 45
130 PRINT"{CLR}{11 DOWN}"TAB(7)"{RED}LEVE
    L:{WHT}"L                    :rem 117
140 PRINT"{7 DOWN}"TAB(7)"{GRN}ROOM:{WHT}
    ";R+1                          :rem 3
150 FORI=1T01000:NEXT             :rem 17
160 PRINT"{CLR}"                 :rem 251
170 IFS>10000ANDQ=0THEN PRINT"{HOME}
    {6 RIGHT}{WHT}EXTRA SHIP":SH=SH+1:Q=1
                                 :rem 186

VIC Version
Apparently trapped, this player in the VIC version of
"Space Caverns" is watching the oncoming aliens and
holding his fire until he sees the greens of their eyes.

180 Yl=L+1:X1=L:Y2=L+1:X2=21-L:X3=21-L:Y3
    =22-L:Y4=22-L:X4=L           :rem 201
190 A1=1:A2=1:A3=1:A4=1          :rem 206
200 FORI=0TO21:POKEI+4118,37:POKEI+38422,
    1:POKEI+4580,37:POKEI+3884,1:NEXT
                                 :rem 129
210 FORI=5TO16:POKEI+4206,37:POKEI+38510,
    1:POKEI+4492,37:POKEI+38796,1:NEXT
                                 :rem 195
220 FORI=1TO22:POKEI*22+4096,37:POKEI*22+
    37888,1:POKEI*22+4117,37:POKEI*22+384
    21,1:NEXT                    :rem 248
230 FORI=5TO18:POKEI*22+4101,37:POKEI*22+
    38405,1:POKEI*22+4112,37:POKEI*22+384
    16,1:NEXT                    :rem 230
240 X=INT(RND(1)*10)+5:Y=INT(RND(0)*6)+8
                                 :rem 236
250 PRINT"{HOME}(22 SPACES)";    :rem 182
260 POKE4096+X+22*Y,W:POKE37888+X+20*Y,1
                                  :rem 29
270 IFX=X1ANDY=Y1THEN860           :rem 6
280 IFX=X2ANDY=Y2THEN860           :rem 9
290 IFX=X3ANDY=Y3THEN860          :rem 12
300 IFX=X4ANDY=Y4THEN860           :rem 6
310 W=W+1:IFW=35THENW=33         :rem 201
320 POKE4096+X1+22*Y1,W+2:POKE37888+X1+22
    *Y1,5                         :rem 65
330 POKE4096+X2+22*Y2,W+2:POKE37888+X2+22
    *Y2,5                         :rem 70
340 POKE4096+X3+22*Y3,W+2:POKE37888+X3+22
    *Y3,5                         :rem 75
350 POKE4096+X4+22*Y4,W+2:POKE37888+X4+22
    *Y4,5                         :rem 80
360 PRINT"(HOME}(3 RIGHT}SCORE",S;:POKE21
    1,16:PRINT"SHIP";SH          :rem 190
370 IF(A1+A2+A3+A4)=OTHEN790       :rem 5
380 POKE37154,127:S3=-((PEEK(37152)AND128
    =0):POKE37154,255:P=PEEK(37137)
                                  :rem 42
390 Sl=-((PAND8)=0):S2=((PAND16)=0):SO=((
    PAND4)=0)                    :rem 233
400 XA=S2+S3:YA=SO+S1            :rem 227
410 IFXA=OANDYA=OTHEN620         :rem 203
420 IF(PAND32)=0THEN480           :rem 54
430 POKE4096+X+22*Y,32           :rem 191
440 IFY+YA<1ORY+YA>21THENYA=0     :rem 72
450 IFX+XA<1ORX+XA>21THENXA=0     :rem 68
460 IFPEEK(4096+(X+XA)+(Y+YA)*22)=32THENX
    =X+XA:Y=Y+YA                 :rem 162
470 GOTO620                      :rem 108
480 FORWE=255TO128STEP-5:POKE36877,WE:NEX
    T:POKE36877,0                 :rem 97
490 IFSOTHENJ=X:FORI=Y-1TO2STEP-1:GOSUB54
    0:IFBTHENNEXT                 :rem 86
500 IFSITHENJ=X:FORI=Y+1TO21:GOSUB540:IFB
    THENNEXT                     :rem 228
510 IFS2THENI=Y:FORJ=X-1TOISTEP-1:GOSUB54
    0:IFBTHENNEXT                 :rem 80
520 IFS3THENI=Y:FORJ=X+1TO20:GOSUB540:IFB
    THENNEXT                     :rem 231
530 GOTO620                      :rem 105
540 B=-1                         :rem 118
550 IFJ=XIANDI=YITHENA1=0:X1=0:Y1=0:S=S+5
    0:B=0                         :rem 33
560 IFJ=X2ANDI=Y2THENA2=0:X2=1:Y2=0:S=S+1
    00:B=0                        :rem 84
570 IFJ=X3ANDI=Y3THENA3=0:X3=2:Y3=0:S=S+1
    50:B=0                        :rem 96
580 IFJ=X4ANDI=Y4THENA4=0:X4=3:Y4=0:S=S+2
    00:B=0                        :rem 99
590 IFPEEK(4096+I*22+J)<>32THENB=0
                                 :rem 170
600 POKE37888+I*22+J,3:POKE4096+I*22+J,39
    :FORK=1TO10:NEXT:POKE4096+I*22+J,32
                                 :rem 147
610 RETURN                       :rem 119
620 IFA1=0THEN660                :rem 209
630 POKE4096+X1+22*Y1,32          :rem 35
640 Xl=Xl+(X1>X)-(X1<X)           :rem 31
650 Yl=Yl+(Y1>Y)-(Y1<Y)           :rem 38
660 IFA2=0THEN700                :rem 209
670 POKE4096+X2+22*Y2,32          :rem 41
680 X2=X2+(X2>X)-(X2<X)           :rem 39
690 Y2=Y2+(Y2>Y)-(Y2<Y)           :rem 46
700 IFA3=OTHEN740                :rem 209
710 POKE4096+X3+22*Y3,32          :rem 38
720 X3=X3+(X3>X)-(X3<X)           :rem 38
730 Y3=Y3+(Y3>Y)-(Y3<Y)           :rem 45
740 IFA4=0THEN780                :rem 218
750 POKE4096+X4+22*Y4,32          :rem 44
760 X4=X4+(X4>X)-(X4<X)           :rem 46
770 Y4=Y4+(Y4>Y)-(Y4<Y)           :rem 53
780 GOTO260                      :rem 112
790 N=N+1:PRINT"(HOME}(6 SPACES}{WHT}NEXT
    ROOM{7 SPACES)";             :rem 175
800 FORG=0TOX:POKE37888+G+22*Y,6:POKE4096
    +G+22*Y,38:NEXT               :rem 95
810 FORG=X-1TO0STEP-1:POKE37888+G+Y*22,1:
    POKE4096+G+Y*22,33           :rem 213
820 POKE4097+G+Y*22,32:NEXT       :rem 43
830 FORI=128TO255STEP5:POKE36875,I:NEXT:P
    OKE36875,0                   :rem 137
840 PRINT"{CLR}{11 DOWN}{4 RIGHT}{CYN}BON
    US:{RED}";L*500+R*50:S=S+L*500+R*50:R
    =R+1                         :rem 211
850 FORI=1TO1500:NEXT:GOTO120     :rem 35
860 Xl=X-1:X2=X+1:Y1=Y-1:Y2=Y+1   :rem 62
870 FORI=1TO13                    :rem 68
880 POKE4096+X1+22*Y1,38:POKE37888+X1+22*
    Y1,2                           :rem 0
890 POKE36877,128+I*8            :rem 124
900 POKE4096+X2+22*Y1,38:POKE37888+X2+22*
    Y1,2                         :rem 251
910 POKE4096+X1+22*Y2,38:POKE37888+X1+22*
    Y2,2                         :rem 252
920 POKE4096+X2+22*Y2,38:POKE37888+X2+22*
    Y2,2                         :rem 255
930 IFX1>0THENX1=X1-1            :rem 254
940 IFX2<22THENX2=X2+1            :rem 50
950 IFY1>0THENY1=Y1-1              :rem 3
960 IFY2<22THENY2=Y2+1            :rem 55
970 NEXT:POKE36877,0             :rem 179
980 SH=SH-1:IFSH=0THEN1220        :rem 55
990 GOTO120                      :rem 110
1000 T=200+L*60:X=20:Y=11         :rem 78
1010 PRINT"{CLR}{5 RIGHT}{GRN}BONUS ROUND
     "                           :rem 228
1020 FORI=4118TO4139:POKEI,37:POKEI+21*22
     ,37:NEXT                    :rem 151
1030 FORI=4118TO4118+22*21STEP22:POKEI,37
     :POKEI+21,37:NEXT           :rem 195
1040 PRINT"{HOME}{21 SPACES}";   :rem 228
1050 FORI=150TO250STEP2:POKE36875,I:NEXT:
     POKE36875,0                 :rem 167
1060 X1=INT(RND(0)*22)           :rem 188
1070 Yl=INT(RND(0)*20)+1:IFPEEK(4096+X1+Y
     1*22)<>32THEN1060           :rem 246
1080 POKE37888+X1+Y1*22,6:POKE4096+X1+Y1*
     22,36:GOTO1100               :rem 96
1090 IFPEEK(4096+X+Y*22)=36THENS=S+T:GOTO
     1060                        :rem 168
1100 POKE37888+X+Y*22,1:POKE4096+X+Y*22,W
                                  :rem 73
1110 W=W+1:IFW=35THENW=33        :rem 248
1120 PRINT"{HOME}(PUR}SCORE(WHT}";S;:POKE
     211,13:PRINT"(YEL}TIME(WHT}";T;"
     (LEFT) "                    :rem 163
1130 POKE37154,127:53=-((PEEK(37152)AND12
     8)=0):POKE37154,255:P=PEEK(37137)
                                  :rem 84
1140 Sl=-((PAND8)=0):52=((PAND16)=0):SO=(
     (PAND4)=0)                   :rem 19
1150 POKE4096+X+22*Y,32          :rem 239
1160 IFS0=-1ANDY>2THENY=Y-1      :rem 141
1170 IFS1=lANDY<21THENY=Y+1      :rem 143
1180 IFS2=-lANDX>lTHENX=X-1      :rem 141
1190 IFS3=lANDX<20THENX=X+1      :rem 143
1200 T=T-1:IFT=OTHENRETURN       :rem 159
1210 GOTO1090                    :rem 199
1220 IFS>HITHENH3=H2:H2=Hl:Hl=S:GOTO1250
                                 :rem 167
1230 IFS>H2THENH3=H2:H2=S:GOTO1250:rem 64
1240 IFS>H3THENH3=S              :rem 156
1250 PRINT"{CLR}{13 DOWN}{6 RIGHT}{RED}GA
     ME OVER"                     :rem 41
1260 FORI=1TO1500:NEXT:GOTO30     :rem 31
1270 PRINT°(CLRJ{8 DOWN}(BLK}LOADING CHAR
     ACTER SET"                  :rem 189
1280 POKE36879,25                :rem 158
1290 FORI=0T0511:POKE5120+I,PEEK(32768+I)
     :NEXT                       :rem 225
1300 I=5384                       :rem 30
1310 READA:IFA=-1THEN1330        :rem 189
1320 POKEI,A:I=I+1:GOTO1310       :rem 72
1330 POKE36869,205               :rem 201
1340 RETURN                      :rem 168
1350 DATA 0,8,20,34,73,34,20,8   :rem 179
1360 DATA 0,0,8,20,42,20,8,0      :rem 66
1370 DATA 24,60,106,126,102,60,24,60
                                 :rem 218
1380 DATA 24,60,86,126,102,60,24,102
                                 :rem 223
1390 DATA 255,219,165,219,219,165,219,255
                                 :rem 251
1400 DATA 136,33,0,148,1,72,2,16  :rem 19
1410 DATA 0,0,0,24,24,0,0,0        :rem 0
1420 DATA -1                      :rem 63



Program 4: Space Caverns For Apple
Version by Rob Terrell, Editorial Programmer

10  DIM AH(3),AV(3),XH(3),XV(3): POKE 2
     30,64: HCOLOR= 3: HPLOT 0,0: CALL
      - 3082: POKE 230,32
20  GOSUB 1150: GOTO 1610
30 RD = 1:NS = 3:BL = i:BR = 40:BZ = 1:
     BB = 20
40  CALL 62450: HGR : HOME : GOTO 260
50  VTAB Y + 1:P = PEEK (( PEEK (40) +
      PEEK (41) # 256) + X) - 128: RETURN
60 ST = O:JX = INT ( PDL (0) / 85): ON
     JX GOTO 90,80,80
70 DX = - 1:DY = 0: RETURN
80 DX = 1:DY = 0: RETURN
90 JY = INT ( PDL (1) / 85): ON JY GOTO
     120,110,110
100 DY = - 1:DX = 0: RETURN
110 DY = 1:DX = 0: RETURN
120 DX = 0:DY = 0:ST = 1: RETURN
130  ON BF GOTO 150
140  VTAB 22: PRINT "ALIENS: ";AC; TAB(
     28);"SCORE: ";SC: PRINT TAB( 16)"
     SHIPS: ";NS: RETURN
150  VTAB 22: PRINT "SCORE: ";SC; TAB(
     29);"TIME: ";CT;" ": PRINT TAB(
     17);"SHIPS: "NS: RETURN
160 EX(0) = DH:EX(1) = DH:EX(2) = DV:EX
     (3) = DV: POKE - 16302,0: POKE -
     16299,0: FOR W = 1 TO 30: NEXT W: POKE
      - 16300,0: FOR I = 1 TO 9
170 EX(0) = EX(0) - 1: IF EX(0) < 1 THEN
     EX(O) = 1
180 EX(1) = EX(1) + 1: IF EX(1) > BR THEN
     EX(1) = BR
190 EX(2) = EX(2) - 1: IF EX(2) < BZ THEN
     EX(2) = BZ
200 EX(3) = EX(3) + 1: IF EX(3) > BB THEN
     EX(3) = BB
210  HTAB EX(0): VTAB EX(2): PRINT
      HTAB EX(0): VTAB EX(3): PRINT
220  HTAB EX(1): VTAB EX(2): PRINT
      HTAB EX(1): VTAB EX(3): PRINT
230  IF I / 2 = INT (I / 2) THEN POKE
      - 16299,0: FOR W = 1 TO 10: NEXT
     W: POKE - 16300,0
240  POKE 865,90 - 10 * I: POKE 864,1: CALL
     866: POKE - 16336,0: POKE - 1633
     6,0: NEXT I:LE = LE - 1
250 NS = NS - 1: IF NS = 0 THEN 1580
260 LE = LE + 1: IF RD + 2 = (LE) THEN
     CT = 200 - (RD + 2) * 10:BF = 1: GOTO
     1040
270  HOME : TEXT : VTAB 10: PRINT TAB(
     16);"LEVEL "RD: VTAB 14: PRINT TAB(
     16);"ROUND "LE: FOR W = 1 TO 500: NEXT
     W:LB = LE
280  POKE 230,32: CALL 62450: GOSUB 910
290 DX = 0:DY = 0
300 BL = LB + 1: BR = 40 - LB: BZ =    1 + L
     B:BB = 20 - LB
310  IF RD < = 5 THEN AH(0) = BL + 3:A
     V(0) = BZ + 3:AH(1) = BL + 30:AV(1
     ) = BZ + 3:AH(2) = BL + 30:AV(2) _
     BB - 2:AH(3) = BL + 5;AV(3) = BB -
     4
320 NA = 3:AC = 0:DH = 20:DV = 10:LV =
     3:LH = 20

Apple Version
Obstacles begin appearing on higher-level rooms in the
Apple version of "Space Caverns."

330  IF BF THEN RETURN
340  GOSUB 130
350  GOSUB 60
360 PC = 75 - PC
370 ST = 0
380  IF DX = 0 AND DY = 0 THEN ST = 1
390 DH = DH + (DX = 1) - (DX = - 1) +
     (DH = BL AND DX = - 1) * 1 - (DH =
     BR AND DX = 1) * 1
400 DV = DV + (DY = 1) - (DY = - 1) +
     (DV = BZ AND DY = - 1) * 1 - (DV =
     BB AND DY = 1) * 1
410 X = DH - 1:Y = DV - 1: GOSUB 50: IF
     P = 36 THEN H = 1
420  IF P = 35 THEN ST = 1:DH = DH - DX
     :DV = DV - DY
430  HTAB DH: VTAB DV: PRINT CHR# (PC)
440  ON ST GOTO 460
450  HTAB LH: VTAB LV: PRINT CHR# (32)
460 LV = DV:LH = DH
470  ON BF GOTO 1060
480  IF H = 1 THEN H = 0: GOTO 160
490  ON ST GOTO 530
500  ON ( PEEK ( - 16287) > 127 AND NOT
     BF) GOTO 520
510  GOTO 530
520 MH = DH:MV = DV:MH(1) = MH:MV(1) =
     MV: GOSUB 660
530  ON (AC = 4) GOTO 550
540  GOTO 560
550  GOSUB 750: GOTO 260
560  FOR RA = 0 TO NA
570  ON (AH(RA) = EE) GOTO 640
580 XH(RA) = AH(RA):XV(RA) = AV(RA)
590 AH(RA) = AH(RA) + (DH > AH(RA)) - (
     DH < AH(RA))
600 AV(RA) = AV(RA) + (DV > AV(RA)) - {
     DV < AV(RA))
610  IF AH(RA) = DH AND AV(RA) = DV THEN
     160
620  HTAB AH(RA): VTAB AV(RA): PRINT "$
     "
630  HTAB XH(RA): VTAB XV(RA): PRINT CHR$
     (32)
640  NEXT RA
650  GOTO 350
660 MH = MH + DX : MV = MV + DY
670  IF MH + 2 = BL OR MH - 2 = BR OR M
     V + 2 = BZ OR MV - 2 = BB THEN RETURN
680  FOR TA = 0 TO NA
690  IF MH = AH(TA) AND MV = AV(TA) THEN
     SC = SC + 50 * (TA + 1): GOSUB 840
     :AC = AC + 1: GOSUB 130:AH(TA) = 0
700  NEXT TA
710  HTAB MH: VTAB MV: PRINT CHR$ (34)
720  HTAB MH - DX: VTAB MV - DY: PRINT
     " "
730  HTAB DH: VTAB DV: PRINT
740  GOTO 660
750  VTAB DV: HTAB DH: PRINT "%": FOR B
     U = 1 TO DH
760  FOR W = 1 TO 10: NEXT W
770  VTAB DV: HTAB BU: PRINT
780  NEXT BU
790  VTAB DV: HTAB DH: PRINT " "
800  FOR BU = DH TO 1 STEP - 1
810  FOR W = 1 TO 10: NEXT W
820  VTAB DV: HTAB BU: PRINT " % "
830  NEXT BU: RETURN
840  FOR ES = 1 TO 5
850  POKE 865, INT ( RND (ES) * 3) + 1
860  POKE 864,1: CALL 866
870  NEXT ES
880  RETURN
890  LE = 1:LB = 1
900  IF LE > 5 THEN LB = 5
910  HGR : HOME : POKE 54,0: POKE 55,3:
      CALL 1002: POKE 6,0: POKE 7,141
920  IF LB = > 4 THEN LB = 4
930  FOR V = 1 TO LB: FOR I = 1 TO 40: PRINT
     "#";: NEXT I: NEXT V: HTAB 1
940  FOR C = LB TO 19 - LB: FOR I = 1 TO
     LB: PRINT "#";: NEXT I
950  HTAB 42 - I: FOR I = i TO LB: PRINT
     "#";: NEXT I: NEXT C
960  FOR V = 1 TO LB: FOR I = 1 TO 40: PRINT
     "#";: NEXT I: NEXT V
970  IF RD > 3 THEN FOR I = 1 TO RD: HTAB
      INT ( RND (8) * (39 - (2 * LB)) +
     1): VTAB INT ( RND (9) * (19 - (2
      * LB))) + 1: PRINT "###": NEXT I
980  IF RD > 4 THEN FOR I = 1 TO 7: VTAB
     6: HTAB I + 16: PRINT "#": NEXT I:
      FOR I = 1 TO 6: HTAB 16: PRINT "#
     "; SPC( 7);"#": NEXT I: FOR I = 1 TO
     7: VTAB 13: HTAB I + 16: PRINT "#"
     : NEXT I: IF BF THEN HTAB 20: VTAB
     13: PRINT SPC( 1)
990  IF RD > 5 THEN AH(0) = 15:AV(0) =
     5:AH(1) = 25-AV(I) = 5:AH(2) = 15:
     AV(2) = 14:AH(3) = 25:AV(3) = 14
1000  RETURN
1010  GOSUB 890
1020  GOSUB 60
1030 DH = DH + DX:DV = DV + DY
1040  TEXT : HOME : VTAB 12: PRINT TAB(
     15)"BONUS ROUND": FOR W = 1 TO 600
     : NEXT W: IF CT < 20 THEN CT = 20
1050 TB = LB:LB = 1: GOSUB 280: GOTO 10
     90
1060 CT = CT - 1: IF CT > 0 AND P < >
     33 THEN 340
1070  IF CT = 0 THEN RD = RD + 1:LE = 0
     :BF = 0: GOTO 260
1080 SC = SC + 100
1090 BX = INT ( RND (JX) * 36) + 2:BY =
      INT ( RND WY) * 16) + 2: IF BX =
     DH OR BY = DV THEN BX = BX + 3: BY =
     BY + 2
1100  IF BX = 1 OR BX = 40 THEN 1090
1110  IF BY = 1 OR BY = 20 THEN 1090
1120  POKE 865,60: POKE 864,1: CALL 866
     : POKE 865,60: POKE 864,1: CALL 86
     6: POKE 865,60: POKE 864,1: CALL 8
     66
1130  HTAB BX: VTAB BY: PRINT
1140  GOTO 350
1150  TEXT : HOME : VTAB 22: INVERSE : HTAB
     14: PRINT "PLEASE WAIT": NORMAL
1160  GOSUB 1200: REM DATA
1170  VTAB 9: PRINT TAB( 17);"SPACE": GOSUB
     1340
1180  VTAB 14: PRINT TAB( 16);"CAVERNS
     "; GOSUB 1510
1190  FOR I = 1 TO 1000: NEXT : RETURN
1200  FOR I = 768 TO 855: READ A:X = X +
     A: POKE I,A: NEXT
1210  IF X < > 8158 THEN PRINT "ERROR
      IN DATA": STOP
1220  RETURN
1230  DATA 216,120.133,69,134,70,132,7
     1
1240  DATA 166,7,10,10,176,4,16,62
1250  DATA 48,4,16,1,232,232,10,134
1260  DATA 27,24,101,6,133,26,144,2
1270  DATA 230,27,165,40,133,8,165,41
1280  DATA 41,3,5,230,133,9,162,8
1290  DATA 160,0,177,26,36,50,48,2
1300  DATA 73,127,164,36,145,8,230,26
1310  DATA 208,2,230,27,165,9,24,105
1320  DATA 4,133,9,202,208,226,165,69
1330  DATA 166,70,164,71,88,76,240,253
1340  FOR I = 36192 TO 36864: POKE 1,0:
     NEXT
1350 X = 0: FOR I = 36096 TO 36192: READ
     A:X = X + A: POKE I,A: NEXT
1360  IF X < > 4993 THEN PRINT "ERROR
      IN DATA": STOP
1370  RETURN
1380  DATA 0,0,0,0,0,0,0,0
1390  DATA 136,156,162,227,162,156,136
     ,128
1400  DATA 73,42,8,127,8,42,73,0
1410  DATA 28,34,65,65,65,65,34,28
1420  DATA 62,65,85,65,34,28,54,119
1430  DATA 8,20,34,73,34,20,8,0
1440  DATA 0,8,20,42,20,8,0,0
1450  DATA 130,160,136,130,160,136,162
     ,128
1460  DATA 128,128,128,128,128,128,128
     ,128
1470  DATA 0,0,0,0,0,0,0,0
1480  DATA 0,0,0,0,0,0,0,0
1490  DATA 0,0,0,0,0,0,0,0
1500  DATA 0
1510 X = 0: FOR ML = 864 TO 891
1520  READ A:X = X + A: POKE ML,A: NEXT
     ML
1530  IF X < > 3815 THEN PRINT "ERROR
      IN DATA": STOP
1540  RETURN
1550  DATA 0,115,172,97,3,174,97,3,232
     ,208,253,169
1560  DATA 4,32,168,252,173,48,192,136
     ,208,239,206
1570  DATA 96,3,208,231,96
1580  HOME : TEXT : VTAB 12: HTAB (15):
      PRINT "GAME OVER": FOR W = 1 TO 1
     000: NEXT : FOR I = 0 TO 2
1590  IF SC > HS(I) AND NOT FF THEN HS
     (I + 1) = HS(I):HS(I) = SC:FF = 1
1600  NEXT I
1610 FF = 0: TEXT : HOME : VTAB 4: PRINT
      TAB( 13);"SPACE CAVERNS": VTAB 8:
      PRINT TAB( 14)"HIGH SCORES"
1620  FOR I = 0 TO 2: VTAB 10 + I t 2: PRINT
      TAB( 17);HS(I): NEXT 1:

IBM Version
A yellow ship in the IBM version of "Space Caverns"
indicates this player must reload his laser gun before
shooting.

1630  VTAB 18: PRINT TAB( 5)"PRESS THE
      FIRE BUTTON TO PLAY"
1640  IF PEEK ( - 16287) < 128 AND PEEK
     ( - 16384) < 128 THEN 1640
1650  POKE - 16368,0:SC = 0:LE = 0:PC =
     37: GOTO 30



Program 5: Space Caverns For IBM  PC/PCjr
Version by Kevin Martin, Editorial Programmer
Please refer to "COMPUTEI's Guide To Typing In
Programs" before entering this listing.

J1 10 DEF SEG=0
91 20 WIDTH 40:KEY OFF
OH 30 CLS:COLOR 7:LOCATE 9,13,0:.PRINT"Spa
      ce Caverns"
C6 40 LOCATE 12,14:PRINT"High Scores"
PM 50 PRINT:PRINT SPC(17)H1
AF 60 PRINT:PRINT SPC(17)H2
CC 70 PRINT:PRINT SPC(17)H3
AA 80 LOCATE 20,10:PRINT"Press SPACE to p
      lay"
JD 90 IF INKEY$<>" " THEN 90
IA 100 L=1:S=0:R=0:SH=3:Q=0
JB 110 IF R=L*2 THEN L=L+I:R=0:GOSUB 970
NF 120 CO=14
DH 130 CLS:COLOR 7:LOCATE 9,16:PRINT"Room
       :"R+1
IB 140 LOCATE 12,16:PRINT"Level:"L
ID 150 FOR I=1 TO 1000:NEXT I
EA 160 Y1=L+1:X1=L+1:Y2=L+1:X2=40-L:X3=40
       -L:Y3=22-L:Y4=22-L:X4=L+i:AI=1:A2=
       1:A3-1:A4=1
MC 170 CLS:COLOR 4:FOR I=1 TO 23:LOCATE I
       ,1:PRINT CHR0(177):LOCATE I,40:PRI
       NT CHR$(177):NEXT I
IG 180 FOR I=5 TO 17:LOCATE I,5:PRINT CHR
       $(177):LOCATE I,35:PRINT CHR$(177)
       :NEXT I
NE 190 FOR I=9 TO 13:LOCATE I,10:PRINT CH
       R$(177):LOCATE I,30:PRINT CHR$(177
       ):NEXT I
KE 200 IF S>10000 AND Q=0 THEN LOCATE 24,
       15:PRINT"EXTRA SHIP";:SH=SH+1:Q=1
OE 210 LOCATE 1,1:PRINT STRING$(40,177):L
       OCATE 5,5:PRINT STRING$(30,177):LO
       CATE 9,10:PRINT STRING$(20,177)
GH 220 LOCATE 22,1:PRINT STRING$(40,177):
       LOCATE 17,5:PRINT STRING$(30,177):
       LOCATE 13,10:PRINT STRING$(20,177)
OH 230 X=INT(RND(1)*10)+15:Y=INT(RND(1)*6
       )+B:IF SCREEN(Y,X)<>32 THEN 230
HK 240 LOCATE 11,5:PRINT STRING$(31,32):L
       OCATE 5,20:PRINT" ":LOCATE 9,20:PR
       INT" ":LOCATE 13,20:PRINT" ":LOCAT
       E 17,20:PRINT" "
HN 250 COLOR CO:LOCATE Y,X:PRINT CHR$(1);
FA 260 IF X=X1 AND Y=Y1 THEN 830
HB 270-IF X=X2 AND Y=Y2 THEN 830
JC 280 IF X=X3 AND Y=Y3 THEN 830
LD 290 IF X=X4 AND Y=Y4 THEN 830
EC 300 COLOR 3:LOCATE Y1,XI:PRINT CHR$(23
       4);
IB 310 LOCATE Y2,X2:PRINT CHR$(234);
KA 320 LOCATE Y3,X3:PRINT CHR$(234);
MP 330 LOCATE Y4,X4:PRINT CHR$(234);
GE 340 COLOR 7,S:LOCATE 25,5:PRINT"Score:
       ";S;:LOCATE 25,30:PRINT"Ships:";SH
       ;
JG 350 IF (A1+A2+A3+A4)=0 THEN 780
DI 360 A$=INKEY$:POKE 1050,PEEK(1052):IF
       A$=" " AND CO=15 THEN 470
FC 370 IF A$="" THEN 610
MG 380 IF A$="1" THEN YA=-1:XA=0
BE 390 IF A$="k" THEN YA=1:XA=0
NJ 400 IF A$="j" THEN XA=-1:YA=0
GG 410 IF A$="1" THEN XA=1:YA=0
MA 420 IF A$="r" THEN CO=15
BJ 430 IF XA=0 AND YA=0 THEN 610
JB 440 LOCATE Y,X:PRINT" ";
CI 450 IF SCREEN(YA+Y,XA+X)=32 THEN X=X+X
       A:Y=Y+YA
FI 460 GOTO 610
OJ 470 FOR I=170 TO 200:SOUND I,.11:NEXT
FD 480 CO=14:IF YA=-1 THEN J=X:FOR I=Y-1
       TO 1 STEP -1:GOSUB 530:IF B THEN N
       EXT I
LF 490 IF YA=1 THEN J=X:FOR I=Y+1 TO 22:G
       OSUB 530:IF B THEN NEXT I
CD 500 IF XA=-1 THEN I=Y:FOR J=X-1 TO 1 S
       TEP -1:GOSUB 530:IF B THEN NEXT J
OL 510 IF XA=1 THEN I=Y:FOR J=X+1 TO 40:G
       OSUB 530:IF B THEN NEXT J
EB 520 GOTO 610
MM 530 B=-I:IF J=X1 AND I=Y1 THEN A1=0:X1
       =1:Y1=24:S=S+50:B=0
GF 540 IF J=X2 AND I=Y2 THEN A2=0:X2=2:Y2
       =24:S=S+100:B=0
QM 550 IF J=X3 AND I=Y3 THEN A3=0:X3=3:Y3
       =24:S=S+150:B=0
OC 560 IF J=X4 AND I=Y4 THEN A4=0:X4=4:Y4
       =24:S=S+200:B=0
LC 570 IF SCREEN(I,J)<>32 THEN B=0
DP 580 IF SCREEN(I,J)=177 THEN RETURN
FK 590 LOCATE I,J:PRINT CHR$(249);:FOR K=
       1 TO 10:NEXT K:LOCATE I,J:PRINT" "
       ;
MA 600 RETURN
AG 610 IF A1=0 THEN 650
PL 620 LOCATE Y1,XI:PRINT
CB 630 X1=X1+(X1>X)-(X1<X)
HE 640 Y1=Y1+(Y1>Y)-(Y1<Y)
6D 650 IF A2=0 THEN 690
BA 660 LOCATE Y2,X2:PRINT
GJ 670 X2=X2+(X2>X)-(X2<X)
LM 680 Y2=Y2+(Y2>Y)-(Y2<Y)
BE 690 IF A3=0 THEN 730
CC 700 LOCATE Y3,X3:PRINT
ID 710 X3=X3+(X3>X)-(X3<X)
NB 720 Y3=Y3+(Y3>Y)-(Y3<Y)
60 730 IF A4=0 THEN 770
EH 740 LOCATE Y4,X4:PRINT
LG 750 X4=X4+(X4>X)-(X4<X)
BJ 760 Y4=Y4+(Y4>Y)-(Y4<Y)
FB 770 GOTO 250
EI 780 N=N+1:LOCATE 24,15:PRINT"Next Room
       ";
CM 790 COLOR 1:FOR 1=1 TO X:LOCATE Y,I:PR
       INT CHR$(205);:NEXT
NF 800 COLOR 14:FOR I=X TO 1 STEP -1:LOCA
       TE Y,I:PRINT CHR$(1);" ";:NEXT
OA 810 CLS:COLOR 7-LOCATE 12,14:PRINT"Bon
       us:";L*500+R*50:S=S+L*500+R*50:R=R
       +1
FB 820 FOR I=1 TO 1000:NEXT:GOTO 110
GJ 830 FOR I=200 TO 170 STEP -1:SOUND 1,1
       :NEXT
JA 840 X1=X-1:X2=X+i:Y1=Y-1:Y2=Y+1
IM 850 FOR 1=1 TO 20
DL 860 LOCATE Y1,XI:PRINT CHR$(177);
EN 870 LOCATE Y1,X2:PRINT CHR$(177);
FM 880 LOCATE Y2,X2:PRINT CHR$(177);
EO 890 LOCATE Y2,XI:PRINT CHR$(177);
AB 900 IF X1)1 THEN X1=X1-1
HA 910 IF X2<40 THEN X2=X2+1
DE 920 IF Y1>1 THEN Y1=Y1-1
KH 930 IF Y2<22 THEN Y2=Y2+1
ON 940 NEXT
OF 950 SH=SH-1:IF SH=0 THEN 1150
CL 960 GOTO 110
MI 970 T=200+L*60:X=20:Y=11
FI 980 CLS:LOCATE 24,14:COLOR 7:PRINT"Bon
       us Round";
IC 990 COLOR 4:FOR I=1 TO 23:LOCATE I,1:P
       RINT CHR$(177):LOCATE I,40:PRINT C
       HR$(177):NEXT I
LG 1000 LOCATE 1,1:PRINT STRING$(40,177):
        LOCATE 22,1:PRINT STRING$(40,177)
EH 1010 X1=INT(RND(1)*40)+1:Y1=INT(RND(1)
        *20)+1:IF SCREEN(Y1,X1)<>32 THEN
        1010
ID 1020 LOCATE Y1,X1:COLOR 1:PRINT CHR$(2
        34);:GOTO 1040
GC 1030 IF SCREEN(Y,X)=234 THEN S=S+T:GOT
        O 1010
CP 1040 LOCATE Y,X:COLOR 14:PRINT CHR$(1)
        ;
QP 1050 LOCATE 25,1:COLOR 7:PRINT"Score:"
        ;S;:LOCATE 25,30:PRINT"Time:";T;
OI 1060 A$=INKEY$:POKE 1050,PEEK(1052):IF
         A$="" THEN 1130
OB 1070 XA=0:YA=0
MN 1080 IF A$="i" THEN YA=-1
HB 1090 IF A$="k" THEN YA=1
KP 1100 IF A$="j" THEN XA=-1
FD 1110 IF A$="1" THEN XA=1
MM 1120 IF SCREEN(Y+YA,X+XA)<>177 THEN LO
        CATE Y,X:PRINT" ";:X=X+XA:Y=Y+YA
IF 1130 T=T-1:IF T=0 THEN RETURN
KL 1140 GOTO 1030
HO 1150 IF S>H1 THEN H3=H2:H2=H1:H1=S:GOT
        O 1180
HP 1160 IF S>H2 THEN H3=H2:H2=S:GOTO 1180
LA 1170 IF S>H3 THEN H3=S
EJ 1180 CLS:COLOR 4:LOCATE 12,15:PRINT"Ga
        me Over"
MK 1190 FOR 1=1 TO 1000:NEXT I
HA 1200 GOTO 30