BankShot

Type
Game
Category
One-ball pool for 1–9 players
Author
Stan Ockers
Published in
ACE Newsletter (Atari Computer Enthusiasts, Eugene, Oregon), June 1982; collected in "Best of ACE 1982"
Year
1982
Language
Atari BASIC (with machine-language DATA)
Requirements
Any 8-bit Atari with 16K+ and Atari BASIC; one joystick shared by all players
A green-railed pool table with black corner and side pockets, a ball, an aiming cross on the top rail and a Ball/Player scorecard below

About the program

BankShot is one-ball pool for up to nine players taking turns on one joystick. A ball appears at a random spot on a GRAPHICS 3 table with six pockets. You don't aim at the ball's target directly. Instead you slide a cursor around the rail and fire, and the ball heads for that point on the cushion. A ball that drops into a pocket without touching a rail first gets a "MUST BANK SHOT!!" and doesn't count. Pocket a ball properly and you score and shoot again. After fifteen balls, the final scores are shown. The scorecard along the bottom records which player sank each ball.

The REMs say the game was written by Stan Ockers in March 1982 and "reprinted from ACE NEWSLETTER JUN 1982" (Atari Computer Enthusiasts, Eugene, Oregon), with the heading "BEST OF ACE 1982 1/2", one of the club's compilation disks.

Typing it in

  • Inverse-video text is written {inverse}…{/inverse}. Press the inverse (Atari logo) key before and after. It's used in the REM banner, in the title B{inverse}An{/inverse}kSh{inverse}oT{/inverse}, in the "Ball Player" labels and in B$, the row of 15 inverse Os that form the scorecard (line 710).
  • The 107 DATA values in lines 270–302 are a vertical-blank routine, and line 370 is the 10-byte installer that is POKEd into page 6. As always with machine code in DATA, SAVE before you RUN.

How to play

  1. Type the number of players (1–9). Answer Y if you want the instructions.
  2. The current ball and player numbers appear below the table. Move the cursor with the joystick. It runs along the top and bottom rails with left/right, and up and down the side rails with up/down.
  3. Press fire. The ball travels in a straight line towards the cursor point, bouncing off the cushions for up to 150 steps.
  4. Sink it after at least one bounce for a point and another turn.

How it works

  • Table: GRAPHICS 3 blocks form the cushions, and colour-2 blocks at the corners and middles are the six pockets (DATA line 420). Lines 430–450 find the text window in the display list (the first 66, a mode-2 line with a memory-scan address) and turn it into large-text rows for the ball and player numbers and the scorecard.
  • Collision: the ball is a player. PEEK(53252)=2 (P0PF, the player 0 to playfield collision register; bit value 2 is the playfield colour that COLOR 2 draws) means it has gone into a pocket. Bounces are a simple reversal of DELX or DELY at the table limits.
  • Movement: BASIC only POKEs positions into a small table in page 6 (1556–1567). The VBI routine in VB$ redraws the ball and cursor images from those values every frame, so the sprites never flicker.

Changes from the published listing

One change, so the program also runs under Altirra BASIC, the free replacement BASIC built into many emulators. Altirra BASIC adds a command called MOVE, so it rejected the published lines that use that word as the start of a variable name. The variable is renamed everywhere in the program. The new name is the same length, so the memory layout is unchanged and the program behaves exactly as published on genuine Atari BASIC. If you type it in from the magazine, the original names work fine on a real Atari.

Published Now Lines
MOVE MOVX 880, 930

Listing

1 REM ********************************* {inverse}BEST OF ACE 1982 1/2{/inverse}
2 REM
3 REM **** Reprinted from ****
4 REM **** {inverse}ACE{/inverse} {inverse}NEWSLETTER{/inverse} ****
5 REM **** JUN 1982 ****
6 REM **** 3662 VINE MAPLE DR ****
7 REM **** EUGENE, OR 97405 ****
8 REM **** {inverse}$10{/inverse} {inverse}YEAR{/inverse} ****
9 REM *********************************
10 REM *****************
20 REM ** BANKSHOT **
30 REM **STAN OCKERS **
35 REM ** 3/82 **
40 REM *****************
90 OPEN #1,4,0,"K:":GRAPHICS 18:POSITION 6,3:? #6;"B{inverse}An{/inverse}kSh{inverse}oT{/inverse}"
100 POSITION 4,6:? #6;"# PLAYERS?":DIM B$(16)
110 GET #1,NP:NP=NP-48:IF NP<1 OR NP>9 THEN 110
120 DIM SCORE(NP):POSITION 15,6:? #6;NP:POSITION 4,9:? #6;"instructions?":GET #1,A:IF A=89 THEN GOSUB 2000
250 REM * VBI ROUTINE UPDATED BY POKES *
260 DIM VB$(107):FOR I=1 TO 107:READ A:VB$(I,I)=CHR$(A):NEXT I
270 DATA 24,173,15,6,105,4,133,204,162,0,134,207,160,0,132,203,189,20,6,157,0,208,189,28,6,221,24,6
280 DATA 240,63,189,28,6,157,24,6,165,203,221,28,6,240,10,169,0,145,203,230,203,240,42
290 DATA 208,239,189,16,6,170,189,32,6,133,205,189,33,6,133,206,177,205,240,14,145,203,230,205,208,2
300 DATA 230,206,230,203,240,10,208,238,169,0,145,203,230,203,208,250,230,204,166,207,232,134,207,224,4,208,168
302 DATA 76,98,228
350 REM * PAGE 6 - INSERT VBI ROUTINE *
360 FOR I=1536 TO 1545:READ A:POKE I,A:NEXT I
370 DATA 104,160,0,162,0,169,7,76,92,228
380 A=ADR(VB$):B=INT(A/256):C=A-256*B:POKE 1538,C:POKE 1540,B
400 GRAPHICS 3:COLOR 1:PLOT 3,0:DRAWTO 36,0:DRAWTO 36,19:DRAWTO 3,19:DRAWTO 3,0
410 POKE 708,204:POKE 709,0:POKE 712,233:COLOR 2:FOR I=1 TO 14:READ X,Y:PLOT X,Y:NEXT I
420 DATA 3,0,3,1,4,0,19,0,36,0,36,1,35,0,35,19,36,19,36,18,19,19,3,19,3,18,4,19
430 A=PEEK(560)+256*PEEK(561)
440 IF PEEK(A)<>66 THEN A=A+1:GOTO 440
450 POKE A,71:POKE A+3,6:POKE A+4,6:POKE A+5,65:POKE A+6,PEEK(A+7):POKE A+7,PEEK(A+8)
480 POKE 656,0:POKE 657,24:? "{inverse}Ball{/inverse} {inverse}Player{/inverse}":GOSUB 1500
600 REM * PLAYER MISSILE SETUP *
610 A=PEEK(106)-16:POKE 54279,A:POKE 1551,A
620 REM ** IMAGE 4 **
624 DIM CUR$(6):FOR I=1 TO 6:READ A:CUR$(I,I)=CHR$(A):NEXT I:CUR=ADR(CUR$):POKE 1573,INT(CUR/256)
625 POKE 1572,CUR-256*PEEK(1573)
626 DATA 16,16,56,16,16,0
628 REM ** IMAGE 2 **
630 DIM BALL$(9):FOR I=1 TO 9:READ A:BALL$(I,I)=CHR$(A):NEXT I:BAL=ADR(BALL$):POKE 1571,INT(BAL/256)
632 POKE 1570,BAL-256*PEEK(1571)
640 DATA 16,56,108,116,124,124,56,16,0
642 REM ** IMAGE 0 **
645 DIM Z$(1):Z$=CHR$(0):ZERO=ADR(Z$):POKE 1569,INT(ZERO/256):POKE 1568,ZERO-256*PEEK(1569)
650 FOR I=1556 TO 1567:READ A:POKE I,A:NEXT I
660 DATA 120,100,86,86,100,30,53,53,120,40,63,63
670 POKE 559,62:POKE 53277,3
690 POKE 1552,2:POKE 1553,4:POKE 1554,0:POKE 1555,0
695 POKE 704,36:POKE 705,0
700 A=USR(1536)
710 YMIN=38:YMAX=177:XMIN=62:XMAX=186:BALL=0:PLYR=0:B$="{inverse}OOOOOOOOOOOOOOO{/inverse} ":GOSUB 1500
720 FOR I=1 TO NP:SCORE(I)=0:NEXT I
730 POKE 77,0:BALL=BALL+1:IF BALL>15 THEN GOTO 3000
735 POKE 656,0:POKE 657,5:? BALL
740 X=INT(RND(0)*100+70):Y=INT(RND(0)*100+70):POKE 1556,X:POKE 1564,Y
743 IF FL=1 THEN FL=0:GOTO 750
745 PLYR=PLYR+1:IF PLYR>NP THEN PLYR=1
747 POKE 656,0:POKE 657,14:? PLYR
749 REM ** MOVE CURSOR ALONG RAIL **
750 S=STICK(0):XP=PEEK(1557):YP=PEEK(1565):X=PEEK(1556):Y=PEEK(1560)
760 IF XP>XMIN AND XP<XMAX THEN 780
765 IF (S=10 OR S=14 OR S=6) AND YP>YMIN+2 THEN YP=YP-1
770 IF (S=9 OR S=13 OR S=5) AND YP<YMAX THEN YP=YP+1
780 IF YP>YMIN+2 AND YP<YMAX THEN 795
785 IF (S=5 OR S=6 OR S=7) AND XP<XMAX THEN XP=XP+1
790 IF (S=9 OR S=10 OR S=11) AND XP>XMIN THEN XP=XP-1
795 POKE 1557,XP:POKE 1565,YP
800 IF STRIG(0)=1 THEN 750
805 R=SQR((XP-X)*(XP-X)+(YP-Y)*(YP-Y))
810 DELY=2*(YP-Y)/R:DELX=2*(XP-X)/R
880 BOUNCE=0:MOVX=0
885 REM ** LOOP TO MOVE BALL **
890 X=X+DELX:Y=Y+DELY
892 IF PEEK(53252)=2 THEN GOSUB 1000:GOTO 940
900 IF X>=XMAX OR X<=XMIN+1 THEN DELX=-DELX:GOSUB 1800
910 IF Y>=YMAX OR Y<=YMIN+1 THEN DELY=-DELY:GOSUB 1800
920 POKE 1556,X:POKE 1564,Y
930 POKE 53278,0:MOVX=MOVX+1:IF MOVX<150 THEN 890
940 POKE 53278,0
970 REM ** FL=1 IF SOMEBODY SCORED **
980 IF FL=1 THEN 730
982 REM ** FL=2 IF SHOT INTO POCKET **
985 IF FL=2 THEN FL=0:GOTO 740
990 GOTO 745
1000 POKE 1556,0:IF BOUNCE=0 THEN POKE 656,1:POKE 657,3:? "MUST BANK SHOT!! ":FL=2:GOTO 1020
1010 SCORE(PLYR)=SCORE(PLYR)+1:FL=1:B$(BALL,BALL)=CHR$(48+PLYR):GOSUB 1500
1020 FOR I=1 TO 30:SOUND 0,150+I,12,10:NEXT I:FOR I=120 TO 180:SOUND 0,I,10,10:SOUND 0,0,0,0:NEXT I
1030 FOR I=50 TO 30 STEP -5:GOSUB 1600:NEXT I:GOSUB 1500:RETURN
1500 POKE 656,1:POKE 657,3:? B$:RETURN
1600 SOUND 0,I,10,10:FOR J=1 TO 5:NEXT J:SOUND 0,0,0,0:RETURN
1800 BOUNCE=1:SOUND 0,50,10,10:FOR I=1 TO 5:NEXT I:SOUND 0,0,0,0:RETURN
2000 ? CHR$(125):POKE 752,1:POSITION 8,3:? "INSTRUCTIONS":?:? "This is a game of one ball pool for"
2010 ? "up to 9 players. All players use":? "joystick 1. Balls are made one at"
2020 ? "a time and must hit at least one":? "rail before going in a pocket to"
2030 ? "count. If a player makes a ball,":? "he gets another turn."
2040 ?:? "Position the cursor on the rail ":? "where you want the ball to first"
2050 ? "hit. The scorecard at the bottom":? "keeps track of which player hit the"
2060 ? "balls"
2070 ?:?:? "Press any key to begin the game."
2080 GET #1,A:RETURN
3000 GRAPHICS 18:POSITION 5,0:? #6;"Final Score":FOR I=1 TO NP:POSITION 3,I:? #6;"Plyr #";I;" - ";SCORE(I)
3005 NEXT I
3010 GOTO 3010

Credits