Dale's Home Page

Dale’s Atari 800 Games › Stan Ockers

Bats

By Stan Ockers, in the ACE newsletter of May 1982.

Play Bats

Stan’s write-up

In the March ‘82 issue of ‘Softside’ you'll find an excellent program called ‘Outer Space Attack’ by Sheldon Leemon. This program uses a number of specialized techniques including an interesting way of handling Player Missile Graphics. The method used is to locate the player missile area where a set of strings are stored in memory. Using string operations one can then insert players, move them vertically, or erase them quite easily. About the only disadvantage of this method is it’s not hooked into the vertical blank interrupt so movement is not as ‘flicker free’ as it might be.

I’ve used this method in a program I call ‘Bats’. Line 140 sets up the PM area; the string F$ is used to make sure the player missile area falls on a 1K boundary (double line resolution). Notice how easy it is to clear an area of memory as in line 170. The missiles are used as insects and a very simple vertical blank routine is used to update their horizontal positions every 1/60th of a second (lines 179-190). The cavern is made by redefining a few characters in the character set and using these to print in GR. 2 mode.

This program handles a problem which has bothered me for some time. If you once initialize PM graphics and then do a Graphics command (GR. 2), you end up with the player missiles being vertical stripes which run the full length of the screen. Reversing the PM initialization doesn’t seem to help. The problem is the chip which feeds the screen. It has some registers which are normally being filled by ANTIC during PM graphics. This chip can be disconnected from ANTIC (0 in 53277) but the registers still have information in them which results in the vertical lines. These registers (53261-53264) have to be cleared with pokes as in line 1000. PM graphics is then reinitialized after the graphics mode change (line 2000).

You may have noticed a lack of attention to color in some of my programs. There are two reasons for this: (1) Colors vary from set to set and the ones I choose might not look quite right on your set; and, (2) I normally use a black and white set and am more interested that things show up well in black and white. I have just used the default colors in ‘Bats’ and there is plenty of room for improvement.

That’s it!

—Stan Ockers

Stan Ockers' Bats article in the May 1982 ACE newsletter
As printed: page 6 of the May 1982 issue.

The program

The listing, “BATS by Stan Ockers”, is on pages 6, 7 of the issue. The game page runs it line by line in an emulated Atari 800, just as typed in.

Where this copy came from: Transcribed by hand from the May 1982 scan (there is no typed-in copy of this version); the printer's typeface defeats OCR, so every line was read from enlarged crops of the page. Spaces inside the short score-clearing strings (lines 870-880) couldn't be counted exactly from the print and are a best reading. The header's MAR 1961 is as printed.

Reprinted in Antic, December 1982 (In the Public Domain).

Show the listing
1 REM ************************
3 REM *                  **
4 REM *  ACE NEWSLETTER    **
5 REM *    MAR 1961      **
6 REM ** 3662 VINE MAPLE DR **
7 REM ** EUGENE, OR 97405   **
8 REM **    $10 YEAR      **
9 REM ************************
20 REM *********************
30 REM **     BATS       **
40 REM **  S.O.   3-82  **
50 REM *********************
100 DIM ZZ$(32):FOR I=1 TO 32:READ A:ZZ$(I)=CHR$(A):NEXT I:GOSUB 32000:CLR
102 DATA 104,104,133,204,104,133,203,104,133,206,104,133,205,162,4,160,0
104 DATA 177,203,145,205,136,208,249,230,204,230,206,202,208,240,96
110 GOSUB 3000
130 TRAP 130:? "# PLAYERS ";:POKE 764,255:INPUT NP
138 REM ** PM GRAPHICS **
139 REM ** SEE MAR '82 SOFTSIDE P. 69 **
140 DIM D$(1),F$((INT(ADR(D$)/1024)+1)*1024-ADR(D$)-1),PM$(384),M$(128),P$(128),MM$(8)
150 RESTORE 160:FOR I=1 TO 8:READ A:MM$(I)=CHR$(A):NEXT I
160 DATA 3,3,12,12,48,48,192,192
170 PM$=CHR$(0):PM$(384)=CHR$(0):PM$(2)=PM$:M$=PM$:P$=M$
172 REM ** MISSILE COLORS **
174 POKE 704,14:POKE 705,39:POKE 706,54:POKE 707,70
179 REM ** VBI ROUT. TO MOVE MISSILES **
180 FOR I=1536 TO 1566:READ A:POKE I,A:NEXT I
190 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
199 REM ** BAT IMAGES **
200 DIM BATDN$(5):BATDN$=P$:FOR I=2 TO 4:READ A:BATDN$(I,I)=CHR$(A):NEXT I
210 DATA 24,165,66
220 DIM BATUP$(5):BATUP$=P$:FOR I=2 TO 4:READ A:BATUP$(I,I)=CHR$(A):NEXT I
230 DATA 66,165,24
250 POKE 54279,ADR(PM$)/256:POKE 559,46:POKE 53277,3:POKE 623,4:A=USR(1536)
259 REM ** STALACTITES AND STALAGMITES **
260 DIM C$(42),U$(42):C$="*****$%******&":U$=")(*****'******":FOR I=1 TO 14:C$(I+14)=CHR$(ASC(C$(I))-32)
270 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
272 DIM P(NP),SCORE(NP),TOTAL(NP),BN(NP),BONUS(NP)
275 W=7:P=0:POKE 82,0
278 FOR I=1 TO NP:SCORE(I)=0:TOTAL(I)=0:BN(I)=3:BONUS(I)=1000:NEXT I:NXTCV=300*NP
279 REM ** CHANGE WIDTH OF CAVERN **
280 IF W>3 THEN W=W-1
282 GOSUB 480
284 P=P+1:IF P>NP THEN P=1
286 IF BN(P)=0 THEN 284
287 M$=PM$:FOR I=0 TO 3:M$(YST+5*W+W*(3-I))=MM$(2*I+1,2*I+2):NEXT I
289 REM ** MAIN LOOP **
290 POKE 656,1:POKE 657,22:? " Pull Joystick"
295 IF STICK(0)<>13 THEN 295
299 REM ** SCORECARD **
300 ? CHR$(125):GOSUB 700:POKE 656,0:POKE 657,26:? "PLAYER #";P
301 POKE 656,1:POKE 657,24:? "Round   Total";:GOSUB 860
306 POKE 53248,30:YPOS=YST+20:POKE 53278,0:T=0:DIS=12
310 FOR XPOS=47 TO 200:POKE 53248,XPOS:IF STRIG(0)=0 THEN YPOS=YPOS-1:P$(YPOS)=BATUP$
320 IF STRIG(0)=1 THEN YPOS=YPOS+1:P$(YPOS)=BATDN$
330 IF PEEK(53256)>0 THEN POKE 1546,0:TOTAL(P)=TOTAL(P)-100:GOTO 420
340 IF PEEK(53257)>0 THEN POKE 1547,0:GOSUB 900
350 IF PEEK(53258)>0 THEN POKE 1548,0:GOSUB 900
360 IF PEEK(53259)>0 THEN POKE 1549,0:GOSUB 900
370 IF PEEK(53252)>0 THEN 420
390 NEXT XPOS:P$=PM$
395 IF SCORE(P)<300 THEN 306
400 TOTAL(P)=TOTAL(P)+SCORE(P):SCORE(P)=0:GOSUB 870
402 IF TOTAL(P)>BONUS(P) AND BN(P)<4 THEN BONUS(P)=BONUS(P)+1000:BN(P)=BN(P)+1:GOSUB 700:DIS=10:T=30:GOSUB 630
403 FOR I=1 TO 30:GOSUB 880:FOR J=1 TO 30:NEXT J:GOSUB 860:NEXT I
404 IF P=NP THEN 280
410 GOTO 284
419 REM ** LOSE A BAT **
420 DIS=10:T=9:GOSUB 630
430 YPOS=YPOS+1:P$(YPOS)=BATDN$:POKE 53278,0:SOUND 1,YPOS,10,10:IF PEEK(53252)=0 THEN 430
445 GOSUB 640:P$=PM$:SCORE(P)=0:BN(P)=BN(P)-1:GOSUB 700:IF BN(P)=0 THEN POKE 656,0:POKE 657,6:? "  ":GOSUB 660
460 GOSUB 850:FOR I=1 TO NP:IF BN(I)>0 THEN 403
470 NEXT I:GOSUB 1000:GRAPHICS 17:POSITION 5,2:? #6;"GamE OveR":FOR I=1 TO NP:POSITION 3,2+2*I:? #6;"Player #";I;
472 ? #6;" = ";TOTAL(I):NEXT I:POSITION 3,23:? #6;"PRESS ANY KEY";
475 FOR I=1 TO 300:NEXT I:GOSUB 655:IF FL=0 THEN 475
476 GOTO 275
479 REM ** DRAW CAVERN **
480 GOSUB 1000:GRAPHICS 2:GOSUB 2000:POKE 77,0
490 DL=INT(RND(0)*(8-W))+1:YST=8*(DL+1)
500 FOR X=0 TO 19:GOSUB 590:Y=0:FOR I=R+7-DL TO R+6:POSITION X,Y:? #6;C$(I,I):Y=Y+1:NEXT I
510 FOR I=1 TO W:POSITION X,Y:? #6;" ":Y=Y+1:NEXT I
520 IF DL+W>=10 THEN Y=Y-1:POSITION X,Y:? #6;"'":GOTO 540
530 GOSUB 590:FOR I=R TO R+9-DL-W:POSITION X,Y:? #6;U$(I,I):Y=Y+1:NEXT I
540 IF DL<=1 THEN DL=2:GOTO 570
550 IF DL>=10-W THEN DL=9-W:GOTO 570
560 DL=DL+INT(RND(0)*3)-1
570 NEXT X
580 RETURN 
590 R=INT(RND(0)*6)*7+1:RETURN 
629 REM ** SOUND SUBR'S **
630 FOR I=15 TO 0 STEP -1:SOUND 0,I,DIS,I:FOR J=1 TO T:NEXT J:NEXT I:RETURN 
640 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
650 SOUND 0,0,0,0:SOUND 1,0,0,0:RETURN 
655 RESTORE 697:LS=30:LL=5:GOSUB 664:RETURN 
660 RESTORE 690:LS=20:LL=10
664 FL=0
665 READ I,J:IF I=3 THEN RETURN 
666 IF I=0 THEN 670
667 IF PEEK(53775)<255 THEN FL=1:RETURN 
669 SOUND 0,I,10,10:SOUND 1,I-2,10,6
670 FOR I=1 TO J:FOR K=1 TO LS:NEXT K:NEXT I:SOUND 0,0,0,0:SOUND 1,0,0,0
675 FOR I=1 TO LL:NEXT I:GOTO 665
680 RESTORE 692:LS=12:LL=12:GOSUB 664
681 IF FL=1 THEN RETURN 
682 RESTORE 694:GOSUB 664
683 IF FL=1 THEN RETURN 
684 RESTORE 692:GOSUB 664
685 IF FL=1 THEN RETURN 
686 RESTORE 696:GOSUB 664
687 IF FL=1 THEN RETURN 
688 FOR I=1 TO 300:NEXT I:GOTO 680
690 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
692 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
693 DATA 243,1,217,1,204,1,182,1,162,1,204,1,162,1,121,1,3,3
694 DATA 136,1,162,1,204,1,162,1,136,4,3,3
696 DATA 162,1,204,1,162,1,121,1,243,4,3,3
697 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
698 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
699 REM ** SUBR. TO INDICATE BATS LEFT **
700 POKE 656,0:POKE 657,6:? "      ";:POKE 657,6:FOR I=1 TO BN(P):? "+ ";:NEXT I:RETURN 
850 POKE 656,1:POKE 657,5:? SCORE(P);"  ":RETURN 
860 POKE 656,1:POKE 657,12:? TOTAL(P);"  ":RETURN 
870 POKE 656,1:POKE 657,5:? "    ":RETURN 
880 POKE 656,1:POKE 657,12:? "    ":RETURN 
900 GOSUB 630:POKE 53278,0:SCORE(P)=SCORE(P)+25:GOTO 850
999 REM ** SUBR. TO REMOVE PM GR. **
1000 POKE 53277,0:POKE 54272,0:FOR I=53261 TO 53264:POKE I,0:NEXT I:RETURN 
1999 REM ** SUBR. TO INSERT PM GR. **
2000 POKE 53277,3:POKE 559,46:START=(PEEK(106)+1):POKE 756,START
2009 REM ** ALTER DISPLAY LIST **
2010 A=PEEK(560)+256*PEEK(561)
2020 IF PEEK(A)<>66 THEN A=A+1:GOTO 2020
2030 POKE A,70:POKE A+3,6:POKE A+4,6:POKE A+5,6
2040 RETURN 
3000 ? :? :? CHR$(125):? "+ + + + + + + BATS + + + + + + + +":?
3010 ? "   The object is to fly your bat":? "through a cavern eating flying"
3020 ? "insects along the way.  The only":? "control you have is the FIRE":? "button.  Push it to go up."
3030 ? "Release it and your bat starts":? "to fall.":? :? "  A round lasts 300 points or"
3035 ? "until you lose a bat.  Each time":? "you hit a stilactite or a"
3040 ? "stilagmite you lose one bat":? "and points earned for that round."
3050 ? "Each insect you eat scores points":? "but do not eat the bright insect the"
3060 ? "color of your bat.. it is poison!":? "Eat him and you lose round points":? "plus 100 more and a bat!!":?
3065 ? "PRESS ANY KEY":GOSUB 680:? CHR$(125):? :?
3070 ? "   After a time the cavern will":? "become narrower and scores for the"
3080 ? "last round will be added to totals.":? "Every 1000 points you are given"
3090 ? "another bat, 4 maximum.  Lose":? "all your bats and you are out."
4000 ? "The game is over when everyone is":? "out of bats.  Everyone uses the":? "leftmost joystick":? :RETURN 
31999 REM ** CHANGE CHARACTER SET **
32000 POKE 106,PEEK(106)-5:GRAPHICS 0:START=(PEEK(106)+1)*256:POKE 756,START/256:POKE 752,1
32010 ? "INITIALIZING ......"
32020 A=USR(ADR(ZZ$),57344,START):RESTORE 32100
32030 READ X:IF X=-1 THEN RESTORE :RETURN 
32040 FOR Y=0 TO 7:READ Z:POKE X+Y+START,Z:NEXT Y:GOTO 32030
32100 DATA 32,255,255,127,127,126,62,62,60
32101 DATA 40,60,28,28,24,8,8,8,8
32102 DATA 48,255,127,126,60,56,24,8,8
32103 DATA 56,8,24,28,124,124,254,254,255
32104 DATA 64,60,126,126,126,126,126,127,255
32105 DATA 72,16,16,16,16,16,24,60,60
32106 DATA 80,255,255,255,255,255,255,255,255
32107 DATA 88,0,24,24,165,165,66,66,0
32108 DATA -1

Play Bats