Crystal Caves
- Type
- Game
- Category
- Vertical-scrolling cave game
- Author
- Thomas Edwards
- Published in
- The Best of Antic, Volume 1 (Antic Publishing), one of the book's new games
- Language
- Atari BASIC
- Requirements
- 16K RAM, joystick in port 1, Atari BASIC
- Tags
- antic, best-of-antic, scrolling, character-set, redefined-characters, joystick, arcade, atari-basic
- Related
- Air Raid 2000, Drop, Fallout, Skull Chase, Altirra BASIC, Altirra
About the program
Crystal Caves was one of the six new arcade-style games that Antic added to The Best of Antic, Volume 1, its book of the best material from the magazine's first year. (In January 1984 the magazine's letters page was already calling it "a new book".) The REMs date this revision to 10 June 1983.
You have been cursed to fly through the crystal caves for the rest of your life. Your ship sits near the top of the screen while the cave rushes upward past it. You steer left and right to avoid the crystal walls and fly into the diamond-shaped energy pellets. Collect enough pellets and you are pulled out into a fresh cave, but each new cave needs one more pellet than the last. You get one life. Your score is the number of caves you finished plus any spare pellets.
What you need
A joystick in port 1 and 16K. Plain Atari BASIC. It runs under Altirra BASIC as well.
Typing it in
The title (lines 630–700) is drawn with the keyboard graphics characters, written here as {CTRL-F}, {CTRL-G}, {CTRL-B} and so on. Hold CTRL and press the letter. {CLEAR} in line 40 is ESC followed by SHIFT-CLEAR, and {inv}…{/inv} means type the text in inverse video with the Atari key. Line 320 really does say PR=O (letter O). The variable O is never set, so it is zero and the line still works.
How to play
Press START to begin and OPTION for the instructions. Push the joystick left or right to steer. The fire button "hyperwarps" you to a random spot at the top of the screen. You get only two in the first cave and one extra for each cave after that, so save them for emergencies. The article suggests heading for the widest corridor and making small jerks of the stick in tight spots. CTRL-1 pauses the game.
How it works
- The whole game is GRAPHICS 0 text. Every pass through the main loop PRINTs one new row,
D$, at the bottom of the screen, and the normal screen scroll pushes the cave upward. No fine scrolling or player/missile graphics are needed. - Lines 380–600 copy the ROM font to RAM just below the top of memory. They then redefine three characters: the two crystal wall halves (striped bytes 170 and 85) and the ship.
- The ship is POKEd straight into screen memory at
P. Before it is drawn,PEEK(P)reads what is already there: a blank is safe, the pellet (internal code 96) scores, and anything else is a crash. PEEK(53770), the hardware random-number register, decides where new walls and pellets appear.
Listing
5 REM ******** CRYSTAL CAVES ********
10 REM BY THOMAS EDWARDS
20 REM REVISION JUNE 10 1983
40 PRINT "{CLEAR}":PR=0:ESCAPE=5:C1=0
50 GOSUB 380:DIM C$(4),D$(37):GOTO 320
60 C$(1,1)=CHR$(33):C$(2,2)=CHR$(34):C$(3,3)=" "
70 SC=PEEK(88)+256*PEEK(89)
80 RA=53770
90 PROB1=150:PROB2=150
100 REM
110 REM MAIN GAME BLOCK
120 ? :? :? :? :PRINT " {inv}CAVE{/inv} ";C1+1
130 HW=0
140 P=SC+20:D$=""
150 D$(1,1)=C$(1,1):FOR I=2 TO 36:D$(I,I)=" ":NEXT I:D$(37,37)=C$(2,2)
160 FOR I=1 TO 30:PRINT D$:NEXT I
170 PRINT D$:IF PEEK(P)=0 THEN GOTO 220
180 IF PEEK(P)=96 THEN PR=PR+1:SOUND 0,30,12,14:GOTO 200
190 POKE P,3:GOTO 280
200 SOUND 0,0,0,0:IF PR<ESCAPE THEN GOTO 170
210 POKE P,3:FOR I=255 TO 0 STEP -1:SOUND 1,I,10,10:NEXT I:SOUND 1,0,0,0:ESCAPE=ESCAPE+1:C1=C1+1:PR=0:GOTO 60
220 POKE P,3:S=PEEK(632):P=P+(S=7)-(S=11):SOUND 1,(P-SC)*4.35+78,2,2:IF PEEK(644)=0 THEN GOTO 750
230 IF PEEK(RA)>PROB1 THEN GOTO 260
240 IF PEEK(RA)<PROB2 THEN 170
250 T=PEEK(RA)/7.5+2:W=INT(PEEK(RA)/86)+1:D$(T,T)=C$(W,W):GOTO 170
260 POKE SC+860+PEEK(RA)/6,96:GOTO 240
270 REM GAME OVER
280 FOR I=1 TO 12:FOR J=CA TO CA+7:POKE J,PEEK(RA):POKE 710,PEEK(RA):SOUND 1,PEEK(RA),8,10:NEXT J:NEXT I
290 POKE 710,0:SOUND 1,0,0,0
300 SOUND 0,0,0,0:RESTORE :CA=CA-24:FOR I=1 TO 10:? :NEXT I:GOSUB 520
310 PRINT "CAVES FINISHED:";C1:? "EXTRA ENERGY PELLETS:";PR
320 ? :? :? " {inv}PRESS START TO BEGIN{/inv} ":PR=O:ESCAPE=5:C1=0
330 ? " {inv}PRESS OPTION FOR INSTRUCTIONS{/inv} "
340 IF PEEK(53279)=3 THEN GOSUB 780:GOTO 320
350 IF PEEK(53279)<>6 THEN 340
360 FOR I9=70 TO 0 STEP -3:SOUND 0,15,12,I9/5:NEXT I9:GOTO 60
370 REM REDEFINE CHARACTERS
380 X1=PEEK(106)
390 X2=X1-4
400 POKE 106,X2
410 POKE 709,13
420 GRAPHICS 0
430 POKE 710,0:POKE 752,1
440 CR=PEEK(756)*256
450 POKE 756,X2
460 CA=X2*256
470 GOSUB 620
480 FOR N=W TO 1023+W STEP 8
490 POKE CA+N,PEEK(CR+N)
500 NEXT N
510 W=W+1:IF W<8 THEN 480
520 FOR I=1 TO 3:CA=CA+8
530 DATA 170,170,170,170,170,170,170,170
540 DATA 85,85,85,85,85,85,85,85
550 DATA 170,170,255,102,60,24,24,24
560 FOR ADDR=CA TO CA+7
570 READ DAT:POKE ADDR,DAT
580 NEXT ADDR
590 NEXT I
600 RETURN
610 REM TITLE
620 ? :? :?
630 ? " {CTRL-F} {CTRL-N}{CTRL-N} "
640 ? " {CTRL-F}{CTRL-B}{CTRL-M}{CTRL-V}{CTRL-G}{CTRL-F} {CTRL-G} {CTRL-B} {CTRL-F}{CTRL-G} {CTRL-V}"
650 ? " {CTRL-G}{CTRL-B}{CTRL-M}{CTRL-G} {CTRL-V} {CTRL-F} {CTRL-B} {CTRL-B}{CTRL-M}{CTRL-M}{CTRL-V}{CTRL-V}"
660 ? " {CTRL-M}{CTRL-M}"
670 ? :?
680 ? " {CTRL-N} {CTRL-F}"
690 ? " {CTRL-F} {CTRL-F}{CTRL-G} {CTRL-V}{CTRL-B}{CTRL-B}{CTRL-N} {CTRL-G}"
700 ? " {CTRL-G}{CTRL-B}{CTRL-M}{CTRL-M}{CTRL-V}{CTRL-G}{CTRL-F}{CTRL-B}{CTRL-N} {CTRL-F}"
710 ? :? :? :?
720 ? " By Thomas Edwards"
730 RETURN
740 REM HYPERWARP ROUTINE
750 IF HW>C1+1 THEN GOTO 230
760 HW=HW+1:POKE P,0:P=SC+3+INT(35*RND(1)):GOTO 170
770 REM INSTRUCTIONS
780 ?
790 ? " CRYSTAL CAVES "
800 ? :? " You have been cursed to fly "
810 ? "through the Crystal Caves for the "
820 ? "rest of your natural life. The "
830 ? "deeper you go in a cave, the more "
840 ? "treacherous the cave becomes. If you"
850 ? "get enough energy pellets, you can "
860 ? "start fresh on a new cave. However,"
870 ? "each succesive cave becomes harder "
880 ? "to escape from. Use the joystick to"
890 ? "move. The fire button will relocate"
900 ? "you randomly at the top of the "
910 ? "screen. Good luck."
920 ? :? :? :? :RETURN
Download
The original program from the Antic disk, to LOAD or ENTER instead of typing it: CRYSTAL.BAS.
Credits
- Program listing: Crystal Caves — program listing (The Best of Antic, Volume 1 (Antic Publishing), one of the book's new games) — Thomas Edwards
- Picture: Flying down through a cave. The striped walls and the ship are redefined characters; the diamonds are energy pellets. — Thomas Edwards (program); screenshot by the site
- Antic article text (Best of Antic Book) — Crystal Caves — Thomas Edwards
- Antic Software Archive — disk files (Best of Antic Book): CRYSTAL.BAS — AtariMagazines.com (Kevin Savetz)
- Antic article text — ioboard.php — AtariMagazines.com (Kevin Savetz)
