Bats
- Type
- Game
- Category
- Cave-flying game
- Author
- Stan Ockers
- Published in
- Antic, December 1982 (Vol. 1, No. 5), "In the Public Domain"; reprinted in The Best of Antic, Volume 1
- Year
- 1982
- Language
- Atari BASIC
- Requirements
- 16K RAM, joystick (players share joystick 1), Atari BASIC
About the program
Stan Ockers wrote Chicken, the game in Antic's first issue. In December 1982 the magazine ran another of his games, Bats, in its "In the Public Domain" section. Like Chicken, it had first appeared in the newsletter of A.C.E., the Atari club in Eugene, Oregon. It was later reprinted in The Best of Antic, Volume 1.
Your bat flies steadily from left to right through a cavern of stalactites and stalagmites. Hold the fire button to climb and let go to drop. Insects drift across the cave, and each one you eat scores 25 points. Hit the rock and the bat dies, losing all the points for that round. Some bugs are the same colour as your bat. They are poisonous: eat one and the bat dies and 100 points come off your total. A round ends when you reach 300 points or lose a bat. Then a new, narrower cavern is drawn. Every 1000 points brings a bonus bat (up to four), and the game ends when all bats are dead.
What you need
A joystick in port 1. In a two-player game the players take turns with the same stick. 16K, Atari BASIC.
Typing it in
There is one inverse-video string, the "GaME OvER" message in line 610 ({inv}…{/inv}, typed with the Atari key). Lines 40–50 and 160 are machine code in DATA, so check those numbers twice. The odd-looking strings in line 240 ("*****$%******&" and so on) are the stalactite and stalagmite pieces, made from characters redefined in lines 1290–1360.
How to play
RUN, then answer # PLAYERS with 1 or 2. Pull the joystick toward you to launch each bat. The scores along the bottom show the round score, the running total and the bats you have left (+).
How it works
- Line 80 is a clever trick:
DIM D$(1),F$(...)sizes the dummy stringF$so that the next string,PM$, starts exactly on a 1K boundary.PM$then is the player/missile memory, and the bat (player 0) moves up or down with one string assignment,P$(YPOS)=BATUP$. - The insects are the four missiles. A 31-byte vertical-blank routine (line 160) moves them a step to the left on every frame, with no help from BASIC.
- Line 30 calls a small move routine,
ZZ$, to copy the ROM font to RAM. Lines 1170–1210 point the character base at that RAM font and change the text-window lines of the GRAPHICS 2 display list to ANTIC mode 6, so the score lines appear in large letters too. - Collisions come from the hardware: 53252 (bat hits rock), 53256 (bat meets the poison bug, missile 0, which shares the bat's colour register) and 53257–53259 (insects eaten).
- Lines 820–1060 play tunes. Each tune checks
PEEK(53775)(SKSTAT) between notes, so pressing any key cuts it short.
Listing
10 REM ******* BATS **********
20 REM BY STAN OCKERS 3-82
30 DIM ZZ$(32):FOR I=1 TO 32:READ A:ZZ$(I)=CHR$(A):NEXT I:GOSUB 1240:CLR
40 DATA 104,104,133,204,104,133,203,104,133,206,104,133,205,162,4,160,0
50 DATA 177,203,145,205,136,208,249,230,204,230,206,202,208,240,96
60 TRAP 60:? "# PLAYERS ";:POKE 764,255:INPUT NP
70 REM ** PM GRAPHICS **
80 DIM D$(1),F$((INT(ADR(D$)/1024)+1)*1024-ADR(D$)-1),PM$(384),M$(128),P$(128),MM$(8)
90 RESTORE 100:FOR I=1 TO 8:READ A:MM$(I)=CHR$(A):NEXT I
100 DATA 3,3,12,12,48,48,192,192
110 PM$=CHR$(0):PM$(384)=CHR$(0):PM$(2)=PM$:M$=PM$:P$=M$
120 REM ** MISSILE COLORS **
130 POKE 704,14:POKE 705,39:POKE 706,54:POKE 707,70
140 REM ** VBI ROUT. TO MOVE MISSILES **
150 FOR I=1536 TO 1566:READ A:POKE I,A:NEXT I
160 DATA 104,160,14,162,6,169,7,76,92,228,90,120,150,180,162,3,222,10,6,189,10,6,157,4,208,202,16,244,76,98,228
170 REM ** BAT IMAGES **
180 DIM BATDN$(5):BATDN$=P$:FOR I=2 TO 4:READ A:BATDN$(I,I)=CHR$(A):NEXT I
190 DATA 24,165,66
200 DIM BATUP$(5):BATUP$=P$:FOR I=2 TO 4:READ A:BATUP$(I,I)=CHR$(A):NEXT I
210 DATA 66,165,24
220 POKE 54279,ADR(PM$)/256:POKE 559,46:POKE 53277,3:POKE 623,4:A=USR(1536)
230 REM ** STALACTITES AND STALAGMITES **
240 DIM C$(42),U$(42):C$="*****$%******&":U$=")(*****'******":FOR I=1 TO 14:C$(I+14)=CHR$(ASC(C$(I))-32)
250 U$(I+14)=CHR$(ASC(U$(I))-32):C$(I+28)=CHR$(ASC(C$(I))+128):U$(I+28)=CHR$(ASC(U$(I))+128):NEXT I
260 DIM P(NP),SCORE(NP),TOTAL(NP),BN(NP),BONUS(NP)
270 W=7:P=0:POKE 82,0
280 FOR I=1 TO NP:SCORE(I)=0:TOTAL(I)=0:BN(I)=3:BONUS(I)=1000:NEXT I:NXTCV=300*NP
290 REM ** CHANGE WIDTH OF CAVERN **
300 IF W>3 THEN W=W-1
310 GOSUB 660
320 P=P+1:IF P>NP THEN P=1
330 IF BN(P)=0 THEN 320
340 M$=PM$:FOR I=0 TO 3:M$(YST+5*W+W*(3-I))=MM$(2*I+1,2*I+2):NEXT I
350 REM ** MAIN LOOP **
360 POKE 656,1:POKE 657,22:? " Pull Joystick"
370 IF STICK(0)<>13 THEN 370
380 REM ** SCORECARD **
390 ? CHR$(125):GOSUB 1080:POKE 656,0:POKE 657,26:? "PLAYER #";P
400 POKE 656,1:POKE 657,24:? "Round Total";:GOSUB 1100
410 POKE 53248,30:YPOS=YST+20:POKE 53278,0:T=0:DIS=12
420 FOR XPOS=47 TO 200:POKE 53248,XPOS:IF STRIG(0)=0 THEN YPOS=YPOS-1:P$(YPOS)=BATUP$
430 IF STRIG(0)=1 THEN YPOS=YPOS+1:P$(YPOS)=BATDN$
440 IF PEEK(53256)>0 THEN POKE 1546,0:TOTAL(P)=TOTAL(P)-100:GOTO 570
450 IF PEEK(53257)>0 THEN POKE 1547,0:GOSUB 1130
460 IF PEEK(53258)>0 THEN POKE 1548,0:GOSUB 1130
470 IF PEEK(53259)>0 THEN POKE 1549,0:GOSUB 1130
480 IF PEEK(53252)>0 THEN 570
490 NEXT XPOS:P$=PM$
500 IF SCORE(P)<300 THEN 410
510 TOTAL(P)=TOTAL(P)+SCORE(P):SCORE(P)=0:GOSUB 1110
520 IF TOTAL(P)>BONUS(P) AND BN(P)<4 THEN BONUS(P)=BONUS(P)+1000:BN(P)=BN(P)+1:GOSUB 1080:DIS=10:T=30:GOSUB 790
530 FOR I=1 TO 30:GOSUB 1120:FOR J=1 TO 30:NEXT J:GOSUB 1100:NEXT I
540 IF P=NP THEN 300
550 GOTO 320
560 REM ** LOSE A BAT **
570 DIS=10:T=9:GOSUB 790
580 YPOS=YPOS+1:P$(YPOS)=BATDN$:POKE 53278,0:SOUND 1,YPOS,10,10:IF PEEK(53252)=0 THEN 580
590 GOSUB 800:P$=PM$:SCORE(P)=0:BN(P)=BN(P)-1:GOSUB 1080:IF BN(P)=0 THEN POKE 656,0:POKE 657,6:? " ":GOSUB 830
600 GOSUB 1090:FOR I=1 TO NP:IF BN(I)>0 THEN 530
610 NEXT I:GOSUB 1150:GRAPHICS 17:POSITION 5,2:? #6;"{inv}Ga{/inv}mE Ov{inv}eR{/inv}":FOR I=1 TO NP:POSITION 3,2+2*I:? #6;"{inv}P{/inv}layer #";I;
620 ? #6;" = ";TOTAL(I):NEXT I:POSITION 3,23:? #6;"PRESS ANY KEY";
630 FOR I=1 TO 300:NEXT I:GOSUB 820:IF FL=0 THEN 630
640 GOTO 270
650 REM ** DRAW CAVERN **
660 GOSUB 1150:GRAPHICS 2:GOSUB 1170:POKE 77,0
670 DL=INT(RND(0)*(8-W))+1:YST=8*(DL+1)
680 FOR X=0 TO 19:GOSUB 770:Y=0:FOR I=R+7-DL TO R+6:POSITION X,Y:? #6;C$(I,I):Y=Y+1:NEXT I
690 FOR I=1 TO W:POSITION X,Y:? #6;" ":Y=Y+1:NEXT I
700 IF DL+W>=10 THEN Y=Y-1:POSITION X,Y:? #6;"'":GOTO 720
710 GOSUB 770:FOR I=R TO R+9-DL-W:POSITION X,Y:? #6;U$(I,I):Y=Y+1:NEXT I
720 IF DL<=1 THEN DL=2:GOTO 750
730 IF DL>=10-W THEN DL=9-W:GOTO 750
740 DL=DL+INT(RND(0)*3)-1
750 NEXT X
760 RETURN
770 R=INT(RND(0)*6)*7+1:RETURN
780 REM ** SOUND SUBR'S **
790 FOR I=15 TO 0 STEP -1:SOUND 0,I,DIS,I:FOR J=1 TO T:NEXT J:NEXT I:RETURN
800 FOR I=10 TO 2 STEP -2:SOUND 0,RND(0)*255,8,I:SOUND 1,RND(0)*255,8,I:FOR J=1 TO 30:NEXT J:NEXT I
810 SOUND 0,0,0,0:SOUND 1,0,0,0:RETURN
820 RESTORE 1050:LS=30:LL=5:GOSUB 840:RETURN
830 RESTORE 1000:LS=20:LL=10
840 FL=0
850 READ I,J:IF I=3 THEN RETURN
860 IF I=0 THEN 890
870 IF PEEK(53775)<255 THEN FL=1:RETURN
880 SOUND 0,I,10,10:SOUND 1,I-2,10,6
890 FOR I=1 TO J:FOR K=1 TO LS:NEXT K:NEXT I:SOUND 0,0,0,0:SOUND 1,0,0,0
900 FOR I=1 TO LL:NEXT I:GOTO 850
910 RESTORE 1010:LS=12:LL=12:GOSUB 840
920 IF FL=1 THEN RETURN
930 RESTORE 1030:GOSUB 840
940 IF FL=1 THEN RETURN
950 RESTORE 1010:GOSUB 840
960 IF FL=1 THEN RETURN
970 RESTORE 1040:GOSUB 840
980 IF FL=1 THEN RETURN
990 FOR I=1 TO 300:NEXT I:GOTO 910
1000 DATA 243,4,243,4,243,1,243,4,204,4,217,1,217,4,243,1,243,4,255,1,243,6,3,3
1010 DATA 243,1,217,1,204,1,182,1,162,1,204,1,162,1,0,1,173,1,217,1,173,1,0,1,182,1,230,1,182,1,0,1
1020 DATA 243,1,217,1,204,1,182,1,162,1,204,1,162,1,121,1,3,3
1030 DATA 136,1,162,1,204,1,162,1,136,4,3,3
1040 DATA 162,1,204,1,162,1,121,1,243,4,3,3
1050 DATA 81,4,85,2,102,1,108,1,121,6,108,1,102,1,81,2,81,2,85,2,102,1,108,1,121,8
1060 DATA 108,2,91,2,102,2,108,2,121,1,128,1,121,1,108,1,102,2,121,2,81,4,102,4,121,8,3,3
1070 REM ** SUBR. TO INDICATE BATS LEFT **
1080 POKE 656,0:POKE 657,6:? " ";:POKE 657,6:FOR I=1 TO BN(P):? "+ ";:NEXT I:RETURN
1090 POKE 656,1:POKE 657,5:? SCORE(P);" ":RETURN
1100 POKE 656,1:POKE 657,12:? TOTAL(P);" ":RETURN
1110 POKE 656,1:POKE 657,5:? " ":RETURN
1120 POKE 656,1:POKE 657,12:? " ":RETURN
1130 GOSUB 790:POKE 53278,0:SCORE(P)=SCORE(P)+25:GOTO 1090
1140 REM ** SUBR. TO REMOVE PM GR. **
1150 POKE 53277,0:POKE 54272,0:FOR I=53261 TO 53264:POKE I,0:NEXT I:RETURN
1160 REM ** SUBR. TO INSERT PM GR. **
1170 POKE 53277,3:POKE 559,46:START=(PEEK(106)+1):POKE 756,START
1180 REM ** ALTER DISPLAY LIST **
1190 A=PEEK(560)+256*PEEK(561)
1200 IF PEEK(A)<>66 THEN A=A+1:GOTO 1200
1210 POKE A,70:POKE A+3,6:POKE A+4,6:POKE A+5,6
1220 RETURN
1230 REM ** CHANGE CHARACTER SET **
1240 POKE 106,PEEK(106)-5:GRAPHICS 0:START=(PEEK(106)+1)*256:POKE 756,START/256:POKE 752,1
1250 ? "INITIALIZING ......"
1260 A=USR(ADR(ZZ$),57344,START):RESTORE 1290
1270 READ X:IF X=-1 THEN RESTORE :RETURN
1280 FOR Y=0 TO 7:READ Z:POKE X+Y+START,Z:NEXT Y:GOTO 1270
1290 DATA 32,255,255,127,127,126,62,62,60
1300 DATA 40,60,28,28,24,8,8,8,8
1310 DATA 48,255,127,126,60,56,24,8,8
1320 DATA 56,8,24,28,124,124,254,254,255
1330 DATA 64,60,126,126,126,126,126,127,255
1340 DATA 72,16,16,16,16,16,24,60,60
1350 DATA 80,255,255,255,255,255,255,255,255
1360 DATA 88,0,24,24,165,165,66,66,0
1370 DATA -1
Download
The original program from the Antic disk, to LOAD or ENTER instead of typing it: BATS.BAS, BATS.BAS.
Credits
- Program listing: Bats — program listing (Antic, December 1982 (Vol. 1, No. 5), "In the Public Domain"; reprinted in The Best of Antic, Volume 1) — Stan Ockers
- Picture: Bats: a fresh cavern, waiting for the player to pull the joystick. — Stan Ockers (program); screenshot by the site
- Antic article text (Best of Antic Book) — Bats — Stan Ockers
- Antic Software Archive — disk files (Best of Antic Book): BATS.BAS — AtariMagazines.com (Kevin Savetz)
- Antic Software Archive — disk files (December 1982 - Vol. 1 No. 5): BATS.BAS — Jerry White, 1982
- Antic magazine scan (OCR text layer): Antic_Vol_1-05_1982-12_Buyers_Guide_text.pdf — Internet Archive
