Jacks

Type
Game
Category
Dexterity game (computer jacks)
Author
Coy Ison
Published in
Antic, October 1984 (Vol. 3, No. 6), Game of the Month
Year
1984
Language
Atari BASIC (with a short machine-language routine)
Requirements
Any Atari 8-bit, Atari BASIC, joystick in port 1
A black playfield framed in teal, with seven small orange jacks scattered across it, a ball at bottom left, PICK UP=1 at the top and HIT RED BUTTON TO BOUNCE BALL at the bottom

About the program

Antic called it a "short elegant program for the classic kid's game", and made Jacks the Game of the Month for October 1984. As with the real thing, you throw your seven jacks, bounce the ball, and while it's in the air you pick up jacks and get back under the ball before it lands. You start on your ones (one jack per bounce) and work up to sevens. Coy Ison admitted he'd never made it to his sevens himself.

Typing it in

The program is about 100 lines. {inv}…{/inv} means inverse video (press the Atari key before and after). The inverse ! that draws the frame and the inverse z ball are redefined characters, as is the $ jack, so type them exactly. Line 1030 is a 41-byte machine-language routine in a string, E$, using inverse and control characters ({CTRL-E} = CTRL with E, {CTRL-,}/{CTRL-.} = CTRL with comma/full stop). Take care with it. The magazine printed TYPO codes.

How to play

  1. Press the button to throw the jacks. They scatter at random.
  2. Press the button again to bounce the ball. It climbs up the left side of the screen and falls back.
  3. Move the cursor (a short line) with the joystick, in any of eight directions, over the jacks you need. "PICK UP" shows how many you must take this time and "HOLDING" how many you have.
  4. Get back under the ball before it hits the ground.

Pick up exactly the right number and catch the ball, and you move up a number. Pick up too few or too many, or let the ball drop, and you go back down one. Make it past sevens and the game is over. Press Y to play again or N to stop.

How it works

  • Machine-code font copy. Lines 1000–1130 lower RAMTOP by eight pages and call the routine in E$ to copy the ROM character set into RAM quickly. Three characters are then redefined from DATA.
  • The ball is not drawn with PRINT. Line 160 POKEs code 250 (the inverse z) straight into screen memory at SC+2+20*BM, and line 120 erases it, so the ball moves fast and the program can still check it with LOCATE.
  • Joystick to movement. Lines 310–320 turn the stick into steps of −1, 0 or +1 with logical expressions. LOCATE (line 330) then reports what's ahead: 36 is a jack, 250 the ball, 32 empty space.
  • POKE 77,0 (line 180) stops the attract mode from changing the colours mid-game.

Listing

10 REM JACKS
20 REM BY COY ISON
30 REM ANTIC MAGAZINE
100 GOSUB 1000:GOSUB 500:GOSUB 230:GOTO 260
110 REM MOVE BALL
120 POKE SC+2+20*BM,0
130 CT=1:BM=BM+N
140 IF BM<1 THEN BM=1:N=+1
150 IF BM>22 THEN BM=22:PU=PU-1:GOTO 440
160 POKE SC+2+20*BM,250
170 SOUND 0,10+BM,14,8
180 POKE 77,0
190 RETURN
200 REM GIVE # NEEDED TO PICK UP
210 H=H+1
220 POSITION 6,4:? #6;"{inv}holding{/inv}=";H
230 POSITION 6,1:? #6;"{inv}pick up{/inv}=";PU
240 POSITION 6,2:? #6;"_____________"
250 RETURN
260 REM JOYSTICK ROUTE
270 CT=0
280 OV=3:DO=22
290 S=STICK(0):SOUND 0,0,0,0
300 IF S<>15 THEN POSITION OV,DO:? #6;" "
310 DX=(S=5 OR S=6 OR S=7)-(S=9 OR S=10 OR S=11)
320 DY=(S=5 OR S=9 OR S=13)-(S=6 OR S=10 OR S=14)
330 LOCATE OV+DX,DO+DY,A
340 IF A=250 THEN 410
350 IF A=36 THEN GOSUB 200:GOTO 370
360 IF A<>32 THEN 380
370 OV=OV+DX:DO=DO+DY
380 POSITION OV,DO:? #6;"_"
390 GOSUB 120
400 GOTO 290
410 REM BALL CAUGHT, CLEAR JACKS
420 IF PU<>H THEN PU=PU-1:GOTO 440
430 PU=PU+1
440 H=0
450 IF PU<1 THEN PU=1
460 FOR LP=6 TO 20:POSITION 4,LP:? #6;"               ":NEXT LP
465 POSITION 6,4:? #6;"          "
470 POSITION 2,BM:? #6;" "
480 POSITION OV,DO:? #6;" "
485 IF PU=8 THEN 900
490 GOSUB 230:GOSUB 650:GOTO 260
500 REM DRAW FIELD
510 H=0:PU=1:SC=PEEK(88)+256*PEEK(89)
520 FOR LP=0 TO 18:POSITION LP,23:? #6;"{inv}!{/inv}":NEXT LP
530 FOR LP=1 TO 19
540 POSITION LP,0:? #6;"{inv}!{/inv}"
550 IF LP<5 THEN 570
560 POSITION LP,5:? #6;"{inv}!{/inv}"
570 NEXT LP
580 FOR LP=1 TO 4
590 POSITION 5,LP:? #6;"{inv}!{/inv}"
600 NEXT LP
610 FOR LP=0 TO 22
620 POSITION 0,LP:? #6;"{inv}!{/inv}"
630 POSITION 19,LP:? #6;"{inv}!{/inv}"
640 NEXT LP
650 REM THROW JACKS & BOUNCE BALL
660 POSITION 4,21:? #6;"HIT {inv}red{/inv} BUTTON"
670 POSITION 4,22:? #6;"TO THROW JACKS"
680 IF STRIG(0)<>0 THEN 680
690 FOR LP=21 TO 22:POSITION 3,LP:? #6;"               ":NEXT LP:GOSUB 750
700 POSITION 4,21:? #6;"HIT {inv}red{/inv} BUTTON"
710 POSITION 4,22:? #6;"TO BOUNCE BALL"
720 IF STRIG(0)<>0 THEN 720
730 FOR LP=21 TO 22:POSITION 3,LP:? #6;"               ":NEXT LP
740 RETURN
750 REM PLACE JACKS (RANDOM)
760 BM=22:N=-1
770 POSITION 2,22:? #6;"{inv}z{/inv}"
780 FOR LP=1 TO 18:POSITION LP,23:? #6;"{inv}!{/inv}":NEXT LP
790 FOR LP=1 TO 7
800 JV=INT(14*RND(1)+5):IF JV>14 THEN 800
810 JD=INT(20*RND(1)+6):IF JD>20 THEN 810
820 LOCATE JV,JD,QQ:IF QQ<>32 THEN 800
830 POSITION JV,JD:? #6;"$"
840 NEXT LP
850 RETURN
900 REM GAME OVER
920 POSITION 6,11:? #6;"game over"
930 POSITION 4,12:? #6;"play again{inv}(y/n){/inv}"
940 IF PEEK(764)=43 THEN PU=0:GOTO 430
950 IF PEEK(764)=35 THEN END
960 GOTO 940
1000 REM FAST DUMP
1010 GRAPHICS 1+16
1020 DIM E$(50):RAMTOP=PEEK(106)-8:POKE 106,RAMTOP:CHBAS=RAMTOP:ADDR=CHBAS*256:PAGE=4
1030 E$(1,41)="hh{inv}{CTRL-E}O{/inv}h{inv}{CTRL-E}N{/inv}hh{inv}{CTRL-E}T){/inv}{CTRL-,}{inv}{CTRL-E}L){CTRL-.}{CTRL-E}M"{/inv}{CTRL-A}{inv} {/inv}{CTRL-,}{inv}1L{CTRL-Q}NHPyfMfOhdTPp{/inv}{CTRL-.}{CTRL-,}":A=USR(ADR(E$),ADDR,PAGE)
1040 FOR LP=1 TO 3
1050 READ CHAR
1060 POS=ADDR+(CHAR*8)
1070 FOR X=0 TO 7:READ A:POKE (POS+X),A:NEXT X
1080 NEXT LP
1090 DATA 1,255,255,255,255,255,255,255,255
1100 DATA 58,0,0,56,108,84,108,56,0
1110 DATA 4,0,8,8,20,107,20,8,8
1120 POKE 756,CHBAS
1130 RETURN

Download

The original program from the Antic disk, to LOAD or ENTER instead of typing it: JACKS.BAS.

Credits