Stunt Clown
- Type
- Game
- Category
- Bat-and-ball balloon-popping game
- Author
- John Magdziarz
- Published in
- Antic, July 1983 (Vol. 2, No. 4), In the Public Domain
- Year
- 1983
- Language
- Atari BASIC (with a short machine-language routine)
- Requirements
- 16K RAM, Atari BASIC, joystick in port 1
- Tags
- antic, in-the-public-domain, circus, breakout, joystick, redefined-characters, antic-mode-4, display-list, john-magdziarz, 1983
- Related
- Speed Demon, Altirra BASIC, Altirra, Track Star, Worm Squirm, 3-D Maze Escape
About the program
Stunt Clown is by John Magdziarz, who had written the racing game Speed Demon! for Antic the year before. "Welcome to the 17th annual Stunt Clown competition," the article begins. You have to help Fearless Freddy pop the balloons floating above the circus floor by moving a trampoline under him. Meanwhile the demented Dr. Norton, who holds the current record, has arranged an unlimited supply of balloons and now and then shrinks your trampoline by magic.
Typing it in
The listing is almost all plain text. The balloons, clown and trampoline are ordinary characters (#, $, %, &, ', () that the program redefines, so type them exactly as shown. Line 500 has an inverse PRESS START ({inv}…{/inv}: press the Atari key before and after). The inverse REM in line 990 is a note from the author: on a machine with less than 16K, change DL+29 to DL+28.
How to play
Press the trigger to launch a clown. Move the trampoline left and right with the joystick. When Freddy lands, the way the trampoline was moving decides which way he bounces, so you can aim him. Every balloon he hits scores points. You start with three clowns and get an extra one every 500 points. If a clown hits the floor, the ambulance siren sounds.
When all but seven balloons are popped, a new lot appears. The trampoline shrinks from six segments to four and then two, and balloons are worth 10, then 30, then 50 points. The game ends when you run out of clowns. Press START or the trigger to play again.
The article listed the values to change: the number of clowns is CL in line 1070, the balloons left before a new round is BAL in line 340, and the extra-clown score is the 490 in line 360.
How it works
- A mixed display list. Line 990 makes the top line ANTIC mode 6 (big GRAPHICS 1 text, for the title) and every row below it ANTIC mode 4, the four-colour character mode. Lines 1010–1040 then move the screen pointer in locations 88–89 forward by 20 bytes, the width of the title row, so that ordinary
PRINTandPOSITIONstatements land on the mode-4 rows correctly. - Characters in RAM. A 60-byte machine-language routine at page 6 (lines 780–830) copies the ROM font into RAM much faster than a BASIC loop. Lines 850–950 then redraw nine characters: balloon shapes, the clown, the trampoline, the big top and the ladders.
- Collisions are done with
LOCATE. The program looks at the character where the clown is about to move: a space means move on, the walls and roof reverse a direction, and anything else is a balloon to pop. - Lines 1180–1220 clear bit 7 of the POKEY interrupt mask (locations 16 and 53774), which disables the BREAK key.
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 CP, 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 |
|---|---|---|
CPX |
KPX |
210, 220, 270, 300, 400, 410 |
CPY |
KPY |
210, 220, 380, 410 |
Listing
70 REM ........STUNT CLOWN............
80 REM ........by John Magdziarz......
90 REM ........(c) COPYRIGHT 1983.....
100 GOSUB 620
110 GOSUB 1180:IF STRIG(0)<>0 THEN 110
120 CX=INT(RND(0)*32)+5:POSITION CX,15:? "$":CYI=-1:CXI=1:CY=15
130 REM *** JOYSTICK READ ROUTINE ***
140 S=STICK(0):IF S<>11 AND S<>7 OR S=15 THEN 200
150 IF S=7 THEN NP=PP+2:CH=1:PAD$=PADR$:IF NP>ED THEN NP=ED
160 IF S=11 THEN NP=PP-2:CH=-1:PAD$=PADL$:IF NP<2 THEN NP=2
170 IF S<>LS THEN POSITION PP,21:? PAD$:LS=S:GOTO 190
180 LS=S:POSITION NP,21:? PAD$:PP=NP
190 IF RND(0)>0.85 THEN CH=0
200 IF SET THEN SET= NOT SET:CYI=-1
210 KPY=CY+CYI:KPX=CX+CXI
220 LOCATE KPX,KPY,Z:POSITION KPX,KPY:PUT #6,Z
230 IF CY>21 THEN 440
240 IF Z=32 THEN 410
250 IF Z<>37 AND Z<>38 AND Z<>32 AND Z<>169 THEN 320
260 FOR I=15 TO 0 STEP -5:SOUND 0,0,2,I:NEXT I
270 IF CX=36 AND CY>3 THEN CXI=-1:KPX=KPX-INC:GOTO 380
280 IF CX=2 AND CY<21 THEN CXI=1:GOTO 380
290 IF CY=3 THEN CYI=1:GOTO 380
300 IF CY=20 THEN CYI=-1:CXI=CH:INC=1:KPX=KPX+INC:POSITION CX,CY:? " ":CX=CX+INC:GOTO 380
310 REM *** BALLOON POP ROUTINE ***
320 SET=1:CXI=CXI*-1:SC=SC+IN:POSITION 10,0:? SC:BAL=BAL-1:FOR I=16 TO 0 STEP -4:SOUND 1,50,0,I:NEXT I
330 SC2=SC2+IN
340 IF BAL=7 THEN 530
350 REM *** EXTRA CLOWN ROUTINE ***
360 IF SC2>490 THEN SC2=0:CL=CL+1:FOR I2=1 TO 5:SOUND 0,10,10,8:FOR I=1 TO 5:NEXT I:SOUND 0,0,0,0:NEXT I2
370 POSITION 38,0:? CL:GOTO 410
380 IF KPY>20 OR KPY<3 THEN KPY=CY
400 IF KPX>36 OR KPX<2 THEN KPX=CX
410 POSITION CX,CY:? " ":POSITION KPX,KPY:? "$":CX=KPX:CY=KPY
420 GOTO 140
430 REM *** FALLEN CLOWN ROUTINE ***
440 CL=CL-1:POSITION 38,0:? CL:POSITION CX,CY:? "(":FOR T2=1 TO 3:GOSUB 1140:NEXT T2:SOUND 0,0,0,0:FOR A=0 TO 36
450 POSITION A,22:? " QB":FOR T2=1 TO 17:NEXT T2:NEXT A:POSITION 36,22:? " ":IF CL<>0 THEN 110
460 REM *** GAME OVER ROUTINE ***
470 GOSUB 580:POSITION 0,1:FOR X=8 TO 3 STEP -2:FOR I=3 TO 36:SOUND 0,I,10,8:POSITION I,X:? " ":NEXT I:NEXT X
480 SOUND 0,0,0,0:POKE 53279,0
490 FOR I=15 TO 36:POSITION I,0:? " ":NEXT I
500 IF PEEK(53279)<>6 AND STRIG(0)<>0 THEN POSITION 16,0:? "GAME OVER! {inv}PRESS START{/inv}":GOSUB 590:GOTO 500
510 SOUND 0,0,0,0:SOUND 1,0,0,0:GOSUB 1070:GOTO 110
520 REM *** PADDLE SIZE ROUTINE ***
530 TIM=TIM+1:FOR IZ=3 TO 36:POSITION IZ,21:? " ":NEXT IZ
540 IF TIM=1 THEN PADR$=" %%%%":ED=31:PADL$="%%%% ":IN=30:GOTO 560
550 IF TIM=2 THEN PADR$=" %%":ED=33:PADL$="%% ":IN=50
560 POSITION CX,CY:? " "
570 POSITION PP,21:? CL2$:GOSUB 1100:GOTO 110
580 FOR IZ=3 TO 36:POSITION IZ,21:? " ":NEXT IZ:RETURN
590 SOUND 0,200,10,8:SOUND 1,199,10,8
600 RETURN
610 REM *** TITLE PAGE ROUTINE ***
620 GRAPHICS 1+16
630 POSITION 4,8:? #6;"* STUNT *"
640 POSITION 5,10:? #6;"* CLOWN *"
650 POSITION 8,17:? #6;"BY"
660 POSITION 2,18:? #6;"john magdziarz"
670 REM *** VARIABLE INITIALIZATIONS ***
680 DIM ROW1$(34),ROW2$(34),ROW3$(34),TP$(39),SD$(60),PAD$(8),CL$(8),CL2$(6):POKE 82,0
690 DIM PADR$(8),PADL$(8):FOR I=1 TO 32 STEP 2:ROW1$(I,I+1)="# ":NEXT I
700 FOR I=1 TO 34 STEP 2:ROW2$(I)=CHR$(39):ROW2$(I+1)=CHR$(32):NEXT I
710 FOR I=1 TO 34 STEP 2:ROW3$(I)=CHR$(167):ROW3$(I+1)=CHR$(32):NEXT I
720 FOR I=1 TO 37:TP$(I,I)="&":NEXT I
730 FOR I=1 TO 57 STEP 3:SD$(I)=CHR$(29):SD$(I+1)=CHR$(30):SD$(I+2)=CHR$(169):NEXT I
740 PADR$=" %%%%%%":PADL$="%%%%%% ":PAD$=PADR$
750 FOR I=1 TO 8:CL$(I,I)=" ":NEXT I
760 CL=3:SC=0
770 REM *** MACHINE LANGUAGE CHARACTER SET MOVE ROUTINE ***
780 FOR M=0 TO 59:READ Q:POKE 1536+M,Q:NEXT M
790 DATA 169,0,133,205,133,203,133,207,169,224,133,206,104,104,104,133,204,24,165,207,105,1,133,207,201,5
800 DATA 240,26,160,0,177,205,145,203,200,208,249,24,165,204,105,1,133,204,24,165,206,105,1,133,206,76
810 DATA 17,06,165,208,141,244,2,96
820 POKE 559,0:POKE 106,PEEK(106)-5:STCHR=(PEEK(106)+1)*256
830 C=STCHR/256:D=USR(1536,C)
840 REM *** REDEFINE CHARACTERS ***
850 FOR COUNT=1 TO 9:READ OLD:NC=OLD*8
860 FOR CHANGE=0 TO 7:READ NUM:POKE STCHR+CHANGE+NC,NUM:NEXT CHANGE:NEXT COUNT
870 DATA 3,20,85,81,85,85,20,8,2
880 DATA 4,32,32,184,48,16,16,136,136
890 DATA 5,0,0,255,85,255,85,0,0
900 DATA 6,250,250,250,250,175,175,175,175
910 DATA 7,60,255,251,255,255,60,8,2
920 DATA 8,136,136,16,16,48,184,32,32
930 DATA 9,65,65,65,85,85,65,65,65
940 DATA 49,170,174,191,174,170,170,48,48
950 DATA 34,168,168,130,130,170,170,14,12
960 ? :POKE 756,STCHR/256:POKE 559,0
970 REM *** SCREEN DATA AND DISPLAY DATA ***
980 DL=PEEK(560)+PEEK(561)*256
990 POKE DL+3,70:POKE 87,1:FOR I=DL+7 TO DL+29:POKE I,4:NEXT I:REM {inv}if less than 16K change DL+29 to DL+28 {/inv}
1000 POSITION 4,0:? #6;"STUNT CLOWN"
1010 SS=PEEK(88)+PEEK(89)*256
1020 SCR=SS+20
1030 HI=INT(SCR/256):LO=SCR-HI*256
1040 POKE 88,LO:POKE 89,HI:POKE 87,0
1050 FOR I=708 TO 712:READ COL:POKE I,COL:NEXT I:POKE 752,1
1060 DATA 26,10,68,134,0
1070 CL=3:POSITION 3,0:? "SCORE: HI-SCORE: CLOWNS: ":IF SC>HS THEN HS=SC
1080 TIM=0:IN=10:SC2=0:ED=29:SC=0:POSITION 1,2:? TP$:POSITION 2,2:? SD$:POSITION 38,2:? SD$
1090 PADR$=" %%%%%%":PADL$="%%%%%% ":PAD$=PADR$
1100 POKE 559,34:POSITION 3,4:? ROW2$:POSITION 4,6:? ROW1$:POSITION 3,8:? ROW3$
1110 PP=18:POSITION PP,21:? PADR$
1120 BAL=50:POSITION 10,0:? SC:POSITION 25,0:? HS:POSITION 38,0:? CL
1130 RETURN
1140 FOR I4=110 TO 30 STEP -5
1150 SOUND 0,I4,10,8:FOR T=1 TO 2:NEXT T:NEXT I4
1160 FOR I4=30 TO 110 STEP 5:SOUND 0,I4,10,8:FOR T=1 TO 2:NEXT T:NEXT I4:RETURN
1180 XX=PEEK(16):IF XX<128 THEN 1220
1200 POKE 16,XX-128:POKE 53774,XX-128
1220 RETURN
Download
The original program from the Antic disk, to LOAD or ENTER instead of typing it: CLOWN.BAS.
Credits
- Program listing: Stunt Clown — program listing (Antic, July 1983 (Vol. 2, No. 4), In the Public Domain) — John Magdziarz
- Picture: The big top before the first clown is launched. — John Magdziarz (program); screenshot by the site
- Antic, July 1983 (Vol. 2 No. 4): In the Public Domain - Stunt Clown, by John Magdziarz (atarimagazines.com) — John Magdziarz, 1983
- Antic, July 1983 - Vol. 2 No. 4: scan of the printed magazine, Stunt Clown article — Internet Archive, 1983
- Antic disk, July 1983 - Vol. 2 No. 4: CLOWN.BAS (detokenized listing) — AtariMagazines.com (Kevin Savetz), 1983
