Wireball

Type
Game
Category
Maze action game
Author
Jean Goulet
Published in
Antic, January 1986 (Vol. 4, No. 9), Game of the Month
Year
1986
Language
Atari BASIC (with machine-language string routines)
Requirements
Any Atari 8-bit computer, any memory size, Atari BASIC, joystick in port 1; disk or cassette
Wireball playfield in multicolour ANTIC mode 4 text: a border and grid of small spheres, an open area at the top, Wireball in the middle and the two enemies, with a status bar at the top

About the program

Wireball was Antic's Game of the Month for January 1986 and the first program in the magazine by Jean Goulet of Quebec. You steer a creature the article describes as a "surrealistic ladybug". It has to eat every green sphere on the screen while avoiding two enemies. One, "a squashed dollar sign", bounces around at random and is only dangerous if you crash into it. The other, "R2-D2 disguised as a fireplug", homes in on you relentlessly and gets faster on each of the six screens.

Your escape is the wire. Push the joystick and the program looks along that line. If there's an object anywhere in that direction, a wire whips out and pulls you straight to it, earning points for the distance. If there's nothing to grab, you just crawl one square after a pause. Now and then a sphere starts to pulse. Eat it before it stops, and the screen turns red while you can destroy the enemies, using the wire to reach them quickly.

Typing it in

Lines 2270 and 2360 are machine-language routines written as strings, packed with inverse and control characters. Goulet admitted they "could be a real headache to type". {inv} … {/inv} means press the Atari (inverse) key before and after. {CTRL-E} means hold CTRL and press E. {CTRL-,} and {CTRL-.} are CTRL with the comma and full stop. {DOWN} is ESC then CTRL-=. In the magazine he also printed a short helper (Listing 2), which printed both lines on screen ready for you to press RETURN over them. It isn't on the Antic disk, so take great care with these two lines and SAVE before you RUN. {CLEAR} in line 2390 is ESC then SHIFT-CLEAR. Antic printed TYPO II checksums beside each line of the magazine listing. They are not part of the program.

How to play

Move with the joystick. Clearing a screen scores 500 points and gives you an extra life. Your remaining lives are shown at the top left. The score is only updated when you finish a level or die. Glowing spheres are more likely to appear when plenty of spheres are left, so don't count on one at the end of a level.

How it works

  • Line 2220 turns the GRAPHICS 0 display list into ANTIC mode 4, four-colour character graphics, and line 2240 adds a status line read from page 6.
  • MOVX$ (line 2270) copies the ROM character set into RAM. Line 2280 then redefines six characters: Wireball, the spheres, the two enemies and the wire.
  • The wire search (lines 1270–1360) steps along the row or column with LOCATE until it finds something other than a space, draws the wire with DRAWTO and then pulls Wireball along it.
  • FINDCHAR$ (line 2360) scans screen memory for any sphere left, so BASIC doesn't have to check 960 squares itself.

Making your own screens

Each layout is a block of PLOT/DRAWTO statements ending in RETURN. Add a block at the end, add its line number to the ON SCREEN GOSUB in line 2490, and change the 6 in line 2480 (as its REM says). Keep X between 1 and 38 and Y between 1 and 22.

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 commands called DIR, MOVE, so it rejected the published lines that use those words 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
DIRX DRNX 1070, 1180, 1220, 1280, 1290, 1310, 1390, 2350, 2370
DIRY DRNY 1070, 1180, 1220, 1270, 1330, 1340, 1360, 1390, 2350, 2380
MOVE$ MOVX$ 2270
MOVE MOVX 2270

Listing

10 REM WIREBALL
20 REM BY JEAN GOULET
30 REM (c) 1985, ANTIC PUBLISHING INC.
1020 GOSUB 2200
1030 GOSUB 2450
1070 S=STICK(0):IF DRNX(S)=0 AND DRNY(S)=0 THEN 1090
1080 GOSUB 1180
1090 GOSUB 1590
1100 FTIME=FTIME+1:IF FTIME>4-SCREEN THEN GOSUB 1750:FTIME=0
1110 IF POWER=0 THEN GOSUB 1470
1120 IF POWER=1 THEN PTIME=PTIME+1:SOUND 3,31-PTIME,10,10
1122 IF POWER=1 THEN IF PTIME>30 THEN POWER=0:PTIME=0:SETCOLOR 4,0,0:PULSON=0
1130 POKE 711,C711:C711=C711+16-256*(C711>240):FIND=USR(ADR(FINDCHAR$),SCSTART):IF FIND<>0 THEN 1070
1140 SCORE=SCORE+500:GOSUB 2450:GOTO 1070
1180 LOCATE PX+DRNX(S),PY+DRNY(S),C
1200 IF C=32 THEN 1270
1220 COLOR 32:PLOT PX,PY:PX=PX+DRNX(S):PY=PY+DRNY(S):COLOR ASC("{inv}{CTRL-.}{/inv}"):PLOT PX,PY:GOSUB 2030:IF DEATH=0 THEN 1240
1230 GOTO 1930
1240 SOUND 1,200,10,15:SCORE=SCORE+INC:SOUND 1,0,0,0
1250 RETURN
1270 IF DRNY(S) THEN 1330
1280 FOR X=PX+DRNX(S) TO (S=7)*39+(S=11) STEP DRNX(S):LOCATE X,PY,C:IF C=32 THEN NEXT X:GOTO 1390
1290 POP :COLOR ASC("{CTRL-R}"):PLOT PX,PY:DRAWTO X,PY:FOR XLOOP=PX TO X-DRNX(S) STEP DRNX(S):COLOR 32:PLOT XLOOP,PY
1300 SOUND 0,XLOOP,10,8:SCORE=SCORE+5
1310 COLOR ASC("{inv}{CTRL-.}{/inv}"):PLOT XLOOP+DRNX(S),PY:NEXT XLOOP:SOUND 0,0,0,0:PX=X:GOSUB 2030:IF DEATH=0 THEN RETURN
1320 GOTO 1930
1330 FOR Y=PY+DRNY(S) TO (S=13)*22+(S=14) STEP DRNY(S):LOCATE PX,Y,C:IF C=32 THEN NEXT Y:GOTO 1390
1340 POP :COLOR ASC("|"):PLOT PX,PY:DRAWTO PX,Y:FOR YLOOP=PY TO Y-DRNY(S) STEP DRNY(S):COLOR 32:PLOT PX,YLOOP
1350 SOUND 0,YLOOP,10,8:SCORE=SCORE+5
1360 COLOR ASC("{inv}{CTRL-.}{/inv}"):PLOT PX,YLOOP+DRNY(S):NEXT YLOOP:SOUND 0,0,0,0:PY=Y:GOSUB 2030:IF DEATH=0 THEN RETURN
1370 GOTO 1930
1390 COLOR 32:PLOT PX,PY:PX=PX+DRNX(S):PY=PY+DRNY(S)
1400 PX=PX*(PX>0 AND PX<39)+(PX<1)+38*(PX>38)
1410 PY=PY*(PY>0 AND PY<23)+(PY<1)+22*(PY>22)
1420 COLOR ASC("{inv}{CTRL-.}{/inv}"):PLOT PX,PY
1430 RETURN
1470 IF PULSON=1 AND PX=XR AND PY=YR THEN POWER=1:SETCOLOR 4,4,0:RETURN
1480 IF TIME<19 THEN TIME=TIME+1:RETURN
1490 PULSON= NOT (PULSON):POKE 77,0
1500 IF PULSON=0 THEN LOCATE XR,YR,C:IF C=ASC("{inv}{CTRL-T}{/inv}") THEN COLOR ASC("{CTRL-T}"):PLOT XR,YR:GOTO 1540
1510 IF PULSON=0 THEN 1540
1520 XR=INT(RND(0)*37)+1:YR=INT(RND(0)*21)+1:LOCATE XR,YR,C:IF C<>ASC("{CTRL-T}") THEN PULSON=0:GOTO 1540
1530 COLOR ASC("{inv}{CTRL-T}{/inv}"):PLOT XR,YR
1540 TIME=0
1550 RETURN
1590 DX=DX*SGN(0.1-(EX+DX>38 OR EX+DX<1)):DY=DY*SGN(0.1-(EY+DY>22 OR EY+DY<1))
1600 LOCATE EX+DX,EY+DY,C:IF C=32 THEN COLOR 32:PLOT EX,EY:COLOR ASC("{CTRL-Y}"):EX=EX+DX:EY=EY+DY:PLOT EX,EY:RETURN
1610 LOCATE EX+DX,EY,CX:LOCATE EX,EY+DY,CY
1620 IF CX<>32 THEN DX=-DX:GOTO 1660
1630 IF CY<>32 THEN DY=-DY:GOTO 1680
1640 IF RND(0)>0.5 THEN DY=-DY:GOTO 1700
1650 DX=-DX:GOTO 1700
1660 IF CY<>32 THEN DY=-DY:GOTO 1700
1670 COLOR 32:PLOT EX,EY:EY=EY+DY:COLOR ASC("{CTRL-Y}"):PLOT EX,EY:GOTO 1700
1680 IF CX<>32 THEN DX=-DX:GOTO 1700
1690 COLOR 32:PLOT EX,EY:EX=EX+DX:COLOR ASC("{CTRL-Y}"):PLOT EX,EY
1700 RETURN
1750 XD=SGN(PX-FX):YD=SGN(PY-FY):DELTAX=ABS(PX-FX):DELTAY=ABS(PY-FY)
1760 IF DELTAX>DELTAY THEN DELTAY=DELTAY/DELTAX:DELTAX=1:GOTO 1780
1770 DELTAX=DELTAX/DELTAY:DELTAY=1
1780 XV=DELTAX*XD:YV=DELTAY*YD:COLOR 32:PLOT FX,FY:FX=FX+XV:FY=FY+YV:LOCATE FX,FY,C
1790 COLOR ASC("{CTRL-F}"):PLOT FX,FY
1810 IF INT(FX+0.5)=INT(PX) AND INT(FY+0.5)=INT(PY) THEN FTOUCH=1:GOTO 1830
1820 GOTO 1870
1830 IF POWER=0 THEN 1930
1840 IF FTOUCH THEN COLOR ASC("{inv}{CTRL-.}{/inv}"):PLOT PX,PY:FX=2:FY=2:POWER=0:SCORE=SCORE+100:PULSON=0
1850 FOR X=-50 TO 50 STEP 5:SOUND 0,ABS(X/(4*(X>0)+0.5*(X<=0))),8,15:GOSUB 1880:NEXT X:POKE 712,0:VP=0
1860 PTIME=0:SOUND 3,0,0,0:SOUND 0,0,0,0
1870 RETURN
1880 POKE 88,0:POKE 89,6:POSITION 15,0:? "SCORE:";SCORE:POKE 54277,7-VP:VP=VP+(VP<7):POKE 88,P88:POKE 89,P89
1890 RETURN
1930 GOSUB 2070
1940 FOR X=0 TO 240 STEP 20:SOUND 0,X,4,15:SOUND 1,240-X/4,10,6:GOSUB 1880:NEXT X:SOUND 0,0,0,0:SOUND 1,0,0,0
1950 VP=0:FTOUCH=0:GUY=GUY-1:IF GUY<=0 THEN 2110
1960 POKE 1536+GUY-1,0
1970 FOR X=GUY-1 TO PX:COLOR ASC("{inv}{CTRL-.}{/inv}"):PLOT X,0:COLOR 32:PLOT X,0:NEXT X
1972 FOR Y=0 TO PY:LOCATE PX,Y,C:COLOR ASC("{inv}{CTRL-.}{/inv}")
1980 PLOT PX,Y:COLOR C:PLOT PX,Y:NEXT Y:COLOR ASC("{inv}{CTRL-.}{/inv}"):PLOT PX,PY
1990 POP :GOTO 1070
2030 DEATH=(C<>ASC("{CTRL-T}") AND C<>ASC("{inv}{CTRL-T}{/inv}")):IF C=ASC("{inv}{CTRL-T}{/inv}") THEN POWER=1:SETCOLOR 4,4,0
2040 IF DEATH=1 AND POWER=1 THEN GOSUB 2070:COLOR ASC("{inv}{CTRL-.}{/inv}"):PLOT PX,PY:DEATH=0:POWER=0:SCORE=SCORE+100:GOSUB 1850
2050 RETURN
2070 COLOR 32:PLOT EX,EY:PLOT FX,FY:FX=2:FY=2:EX=3:EY=4:RETURN
2110 POKE 88,0:POKE 89,6
2120 FOR Y=0 TO 7:FOR T=0 TO 9:NEXT T:POKE 54277,Y:NEXT Y
2130 POSITION 15,0:? "GAME OVER  ";
2140 FOR Y=-7 TO 7:FOR T=0 TO 9:NEXT T:POKE 54277,ABS(Y):NEXT Y
2150 POSITION 15,0:? "score:";SCORE;"  ";
2160 FOR Y=-7 TO 7:FOR T=0 TO 9:NEXT T:POKE 54277,ABS(Y):NEXT Y:GOTO 2130
2200 POKE 106,PEEK(106)-5:GRAPHICS 0:POKE 559,0:CHSET=(PEEK(106)+1)*256:SCSTART=PEEK(88)+256*PEEK(89):POKE 710,0
2210 C711=10:GUY=2:FOR L=0 TO 39:POKE 1536+L,0:NEXT L
2220 DL=PEEK(560)+256*PEEK(561):POKE DL+3,68:FOR X=6 TO 28:POKE DL+X,4:NEXT X:POKE 82,0:POKE 752,1
2230 POKE DL+12,2:POKE DL+10,6:POSITION 6,5:? "WIREBALL":POSITION 33,6:? "By Jean Goulet":RESTORE 2200
2240 NDL=DL-3:NDLH=INT(NDL/256):NDLL=NDL-256*NDLH:POKE 560,NDLL:POKE 561,NDLH
2250 FOR L=NDL TO NDL+5:READ D:POKE L,D:NEXT L:DATA 112,96,98,0,6,0
2260 POKE NDL+33,NDLL:POKE NDL+34,NDLH:POKE 559,34
2270 DIM MOVX$(32):MOVX$="hh{inv}{CTRL-E}W{/inv}h{inv}{CTRL-E}V{/inv}h{inv}{CTRL-E}U{/inv}h{inv}{CTRL-E}T"{/inv}{CTRL-D}{inv} {/inv}{CTRL-,}{inv}1T{CTRL-Q}VHPyfUfWJPp{/inv}{CTRL-.}":MOVX=USR(ADR(MOVX$),CHSET,57344)
2280 FOR C=1 TO 6:READ CH:FOR X=0 TO 7:READ D:POKE CHSET+CH*8+X,D:NEXT X:NEXT C
2290 DATA 70,20,105,125,105,85,105,190,130
2300 DATA 82,0,0,0,17,68,17,0,0
2310 DATA 84,0,60,255,215,223,255,255,60
2320 DATA 89,0,40,146,40,81,40,146,40
2330 DATA 96,0,65,60,105,125,105,60,65
2340 DATA 124,4,16,4,16,4,16,4,16
2350 DIM DRNX(15),DRNY(15),FINDCHAR$(80):PX=20:PY=12:INC=2:EX=3:EY=5:DX=1:DY=1:FX=2:FY=2
2360 FINDCHAR$="hh{inv}{CTRL-E}L{/inv}h{inv}{CTRL-E}KX%K{/inv}{CTRL-X}i({inv}{CTRL-E}K%L{/inv}i{CTRL-,}{inv}{CTRL-E}L"{/inv}{CTRL-,}{inv}h {/inv}{CTRL-,}{inv}H1KI{/inv}T{inv}p{/inv}{DOWN}{inv}@{/inv}&{inv}PuX%K{/inv}{CTRL-X}i({inv}{CTRL-E}K%L{/inv}i{CTRL-,}{inv}{CTRL-E}L{CTRL-.}{/inv}{CTRL-V}{inv}P{CTRL-.}){/inv}{CTRL-,}{inv}{CTRL-E}T{CTRL-E}U{/inv}{CTRL-.}{inv}){/inv}T{inv}{CTRL-E}T{CTRL-E}U{/inv}{CTRL-.}"
2370 FOR X=1 TO 15:READ D:DRNX(X)=D:NEXT X:DATA 0,0,0,0,0,0,1,0,0,0,-1,0,0,0,0
2380 FOR X=1 TO 15:READ D:DRNY(X)=D:NEXT X:DATA 0,0,0,0,0,0,0,0,0,0,0,0,1,-1,0
2390 ? "{CLEAR}":POKE 756,CHSET/256:POKE DL+10,4:POKE DL+12,4
2400 P88=PEEK(88):P89=PEEK(89):POKE 88,0:POKE 89,6:POSITION 0,0:? "{inv}{CTRL-.}{/inv}":POKE 88,P88:POKE 89,P89
2410 FOR C=708 TO 712:READ COL:POKE C,COL:NEXT C:RETURN :DATA 102,172,230,74,0
2450 FOR I=1 TO 8:FOR J=-15 TO 15 STEP 9-I:F=15-ABS(J):SOUND 2,202,10,F:SOUND 1,152,10,F:SOUND 3,241+J,10,9
2460 SETCOLOR 4,0,F:NEXT J:GOSUB 1880:NEXT I:VP=0
2470 GOSUB 2070:GUY=GUY+1:POKE 1536+GUY-2,ASC("{inv}{CTRL-.}{/inv}"):COLOR 32:PLOT PX,PY:PX=20:PY=12
2480 COLOR 20:SCREEN=SCREEN+1:IF SCREEN>6 THEN SCREEN=6:REM IF YOU MAKE EXTRA SCREENS, CHANGE THE 6 TO NEW NO.
2490 ON SCREEN GOSUB 2520,2550,2590,2630,2680,2710
2500 COLOR ASC("{inv}{CTRL-.}{/inv}"):PLOT PX,PY:RETURN
2510 REM SCREEN 1
2520 FOR Y=1 TO 22:PLOT 1,Y:DRAWTO 38,Y:NEXT Y:COLOR 32:FOR Y=2 TO 9:PLOT 2,Y:DRAWTO 37,Y:NEXT Y
2530 FOR X=2 TO 36 STEP 2:PLOT X,15:DRAWTO X,21:NEXT X:RETURN
2540 REM SCREEN 2
2550 PLOT 1,1:DRAWTO 38,1:DRAWTO 38,22:DRAWTO 1,22:DRAWTO 1,1
2560 FOR X=5 TO 30 STEP 5:PLOT X,12:DRAWTO X+4,3:DRAWTO X+4,21:DRAWTO X,12:NEXT X
2570 RETURN
2580 REM SCREEN 3
2590 FOR X=19 TO 20:PLOT X,3:DRAWTO X,20:NEXT X:FOR X=16 TO 17:PLOT X,3:DRAWTO X,12:DRAWTO X-8,20
2600 PLOT 39-X,3:DRAWTO 39-X,12:DRAWTO 39-(X-8),20:NEXT X:PLOT 1,1:DRAWTO 38,1:DRAWTO 38,22:DRAWTO 1,22
2610 DRAWTO 1,1:RETURN
2620 REM SCREEN 4
2630 PLOT 6,11:DRAWTO 7,10:DRAWTO 4,7:DRAWTO 7,7:DRAWTO 10,8:DRAWTO 15,10:DRAWTO 30,10:DRAWTO 36,11
2640 PLOT 6,12:DRAWTO 7,13:DRAWTO 4,16:DRAWTO 7,16:DRAWTO 10,15:DRAWTO 15,13:DRAWTO 30,13:DRAWTO 36,12
2650 PLOT 1,1:DRAWTO 38,1:DRAWTO 38,22:DRAWTO 1,22:DRAWTO 1,1:PLOT 14,4:DRAWTO 29,19:PLOT 14,19:DRAWTO 29,4
2660 RETURN
2670 REM SCREEN 5
2680 FOR Y=1 TO 11 STEP 2:PLOT Y,Y:DRAWTO 39-Y,Y:DRAWTO 39-Y,23-Y:DRAWTO Y,23-Y:DRAWTO Y,Y
2690 NEXT Y:RETURN
2700 REM SCREEN 6
2710 PLOT 1,1:DRAWTO 38,1:DRAWTO 38,22:DRAWTO 1,22:DRAWTO 1,1
2720 PLOT 19,11:DRAWTO 25,11:DRAWTO 27,9:DRAWTO 19,9:DRAWTO 19,13:DRAWTO 27,13:DRAWTO 25,11
2730 PLOT 19,8:DRAWTO 19,3:DRAWTO 12,6:DRAWTO 8,11:DRAWTO 12,15:DRAWTO 19,19:DRAWTO 19,15
2740 DRAWTO 14,11:DRAWTO 19,7:PLOT 28,3:DRAWTO 9,20:PLOT 28,20:DRAWTO 9,3:RETURN

Download

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

Credits