Helicopter Roundup

Type
Game
Category
Herding action game
Author
Walter Bulawa
Published in
Antic, June 1985 (Vol. 4, No. 2), Game of the Month
Year
1985
Language
Atari BASIC (with machine-language helpers)
Requirements
Any Atari 8-bit computer, any memory size, Atari BASIC, joystick in port 1; disk or cassette
Helicopter Roundup screen inside a fence border: SELECT NUMBER OF COWS TO HERD: 1, PRESS START

About the program

"In Australia there are more men than women and more cows than men," began Antic's June 1985 Game of the Month, and ranchers keep the cows in order with helicopters. In Walter Bulawa's Helicopter Roundup you're the pilot. The cows wander at random while you're on the ground. Once you're in the air they grow more nervous the closer you fly, and they scatter away from the helicopter. Steer the herd through the gate of the corral. When every cow is penned the gate shuts, and you must fly back to the landing pad for a full score. Run out of fuel and the helicopter crashes, killing a few innocent cows.

The magazine described Bulawa as an applications programmer in the medical field "when he's not rounding up redefined cow characters".

Typing it in

Inverse-video text appears in the title and score screens: {inv} … {/inv} means press the Atari (inverse) key before and after. {CLEAR} in line 1560 is ESC then SHIFT-CLEAR. In line 630, the letters X, Y and Z print as the left, centre and right parts of a cow, because the character set is redefined (see the REMs in lines 1740–1880). The DATA from line 1580 onwards holds three small machine-language routines, so check those numbers carefully. Antic printed TYPO II checksums beside each line of the magazine listing. They are not part of the program.

How to play

RUN it. The screen goes blank for a while during initialisation ("don't panic", said the magazine). Press SELECT to choose how many cows to herd, then START. Fly with the joystick. The fuel gauge runs down the right-hand side. To refuel, hover over the landing pad and press the fire button. The game goes on until all the cows are penned or you crash, and the final screen reports the fuel used and the cattle penned.

How it works

  • Players for the helicopter. A general-purpose machine-language routine (MOVX, from the DATA at line 1580) copies player shapes into player-missile memory at any X/Y position. The two rotor frames alternate (PMD+IC), and left- and right-facing shapes are chosen from the joystick direction (lines 170–200).
  • Cows as characters. The cows, trees, fence, pad and refuelling zone are redefined characters (lines 1740–1880). Every other frame, the cow-moving routine at line 1950 is called with USR(1536,ADR(CPOS$)). It is given the helicopter's position in locations 230–231 and the number of cows in 232, moves each cow away from the helicopter, and reports how many are in the pen through location 208.
  • POKE 16,112:POKE 53774,112 (line 80) turns off the BREAK key interrupt, so a stray BREAK can't stop the game.

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 MOVE, PMMOVE, 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
MOVE MOVX 190, 200, 370, 920, 1410
PMMOVE$ PMMOVQ$ 1380, 1410, 1590

Listing

10 REM HELICOPTER ROUNDUP
20 REM BY WALTER BULAWA
30 REM (c) 1985, ANTIC PUBLISHING
40 GOSUB 1350:REM GAME INITIALIZATION
50 GOSUB 1160:REM LEVEL INITIALIZATION
60 S=STICK(0)
70 POKE PMBASE+861-FUEL,F*126:FUEL=FUEL-0.04:FUELUSED=FUELUSED+1
80 POKE 16,112:POKE 53774,112:IF FUEL<0 THEN 340
90 SOUND 0,15,8,10
100 XDIF=H(S-4):YDIF=V(S-4)
110 XPOS=XPOS+4*XDIF:YPOS=YPOS+4*YDIF
120 IF XPOS<40 THEN XPOS=40
130 IF XPOS>200 THEN XPOS=200
140 IF YPOS<8 THEN YPOS=8
150 IF YPOS>112 THEN YPOS=112
160 SOUND 0,0,0,0:SOUND 3,0,0,0
170 IF XDIF=1 THEN PMD=PMR
180 IF XDIF=-1 THEN PMD=PML
190 A=USR(MOVX,0,PMBASE,PMD+IC,XPOS,YPOS,5-IC)
200 A=USR(MOVX,3,PMBASE,PMX,XPOS,YPOS,5)
210 IC=IC+1
220 IF IC=2 THEN IC=0:POKE 232,NCOWS:POKE 230,XPOS:POKE 231,YPOS:A=USR(1536,ADR(CPOS$))
230 IF PEEK(208)=NCOWS THEN IF  NOT DONE THEN GOSUB 470:DONE=1
240 F=0
250 IF  NOT (XPOS=176) THEN 60
260 IF  NOT (YPOS=100) THEN 60
270 IF DONE THEN 520
280 SOUND 3,50,14,8
290 IF STRIG(0) THEN 60
300 POKE PMBASE+861-(FUEL+0.04),126
310 FUEL=FUEL+0.3:IF FUEL>51 THEN FUEL=51
320 F=1:POKE 77,0:GOTO 60
330 REM END OF MAIN LOOP
340 REM CRASH
350 CRASH=1
360 SOUND 0,100,4,14:SOUND 3,0,0,0
370 A=USR(MOVX,0,PMBASE,PMC,XPOS,YPOS,8)
380 FOR I=20 TO 200 STEP 4
390 IF I=100 THEN POKE 53256,3
400 SETCOLOR 4,I,8
410 FOR N=1 TO 10:NEXT N
420 NEXT I
430 SETCOLOR 4,0,0:SOUND 0,0,0,0
440 FOR I=1 TO 400:NEXT I
450 POKE 53256,1
460 GOTO 530
470 REM CLOSE CORRAL GATE
480 COLOR 131:PLOT 6,11:DRAWTO 6,13
490 SOUND 3,40,8,15:FOR I=1 TO 40:NEXT I
500 FOR I=150 TO 60 STEP -10:FOR N=I TO I-50 STEP -5:SOUND 3,N,14,12:NEXT N:NEXT I:SOUND 3,0,0,0
510 POSITION 2,21:? #6;"return to pad":RETURN
520 SOUND 0,0,0,0:FOR I=1 TO 500:NEXT I
530 SCORE=( NOT CRASH)*(NCOWS*1000-FUELUSED):IF SCORE<0 THEN SCORE=0
540 IF SCORE>HISCORE THEN HISCORE=SCORE
550 POKE 53248,0:POKE 53249,0:POKE 53250,0:POKE 53251,0
560 GRAPHICS 1+16:POKE 756,CHBASE/256
570 COLOR 131:PLOT 0,0:DRAWTO 19,0:DRAWTO 19,23:DRAWTO 0,23:DRAWTO 0,0
580 POSITION 2,5:? #6;"HIGH SCORE: ";HISCORE
590 POSITION 2,8:? #6;"game score: ";SCORE
600 POSITION 3,13:? #6;"{inv}fuel used:{/inv} ";FUELUSED
610 IF  NOT CRASH THEN POSITION 2,14:? #6;"{inv}cattle penned:{/inv} ";NCOWS
620 IF CRASH THEN POSITION 2,16:? #6;"{inv}crash - too bad{/inv}"
630 POSITION 1,20:? #6;"X PRESS Y {inv}START{/inv} Z"
640 POKE 53279,8
650 RESTORE 690
660 READ I:IF I=-1 THEN FOR J=1 TO 200:NEXT J:GOTO 650
670 IF (PEEK(53279))=6 THEN SOUND 3,0,0,0:NCOWS=NCOWS+1:GOTO 50
680 SOUND 3,I,10,8:FOR J=1 TO 12:NEXT J:GOTO 660
690 DATA 60,60,0,60,60,47,47,47,0,47,47,0,47,47,47,0,0,0,60,60,0,60,60,45,45,45,0,45,45,0
700 DATA 45,0,53,53,0,60,60,60,0
710 DATA 60,60,47,47,47,0,47,47,0,47,47,53,53,60,60,0,45,45,45,47,0,45,45,0,60,60,60,0,0,0,-1
720 REM DRAW PLAYFIELD
730 GRAPHICS 1+16:POKE 559,0:POKE 756,CHBASE/256
740 SETCOLOR 0,1,4:SETCOLOR 3,2,8
750 COLOR 131:FOR I=8 TO 17:PLOT 6,I:DRAWTO 13,I:NEXT I
760 PLOT 0,0:DRAWTO 18,0:DRAWTO 18,23:DRAWTO 0,23:DRAWTO 0,0
770 POSITION 19,20:? #6;"{inv}F{/inv}":POSITION 19,21:? #6;"{inv}U{/inv}":POSITION 19,22:? #6;"{inv}E{/inv}":POSITION 19,23:? #6;"{inv}L{/inv}";
780 POSITION 15,20:? #6;"QQQ":POSITION 15,21:? #6;"QWW":POSITION 15,22:? #6;"QQQ"
790 REM PLOT TREES
800 RESTORE 820
810 FOR I=1 TO 5:READ C:READ R:POSITION C,R:? #6;"v":POSITION C,R+1:? #6;"K":NEXT I
820 DATA 8,3,3,5,17,14,4,4,4,18
830 REM PLACE COWS
840 COLOR 89
850 FOR I=1 TO NCOWS
860 COL=INT(17*RND(0))+1:ROW=INT(17*RND(0))+1
870 LOCATE COL,ROW,XVAL:IF XVAL<>32 THEN GOTO 860
880 POKE ADR(CPOS$)+(I-1)*2,COL:POKE ADR(CPOS$)+(I-1)*2+1,ROW:PLOT COL,ROW
890 NEXT I
900 REM PLACE HELICOPTER
910 XPOS=176:YPOS=100:PMD=PML
920 A=USR(MOVX,0,PMBASE,PMD,XPOS,YPOS,5)
930 POKE 53249,200:POKE 53250,200
940 REM CLEAR CENTER OF CORRAL
950 COLOR 32:FOR I=9 TO 16:PLOT 7,I:DRAWTO 12,I:NEXT I
960 PLOT 6,11:DRAWTO 6,13
970 RETURN
980 REM TITLE PAGE DISPLAY
990 POKE 106,PEEK(740):POKE 53279,8
1000 POKE 53248,0:POKE 53249,0:POKE 53250,0:POKE 53251,0
1010 GRAPHICS 2+16:SETCOLOR 1,1,4
1020 POSITION 5,3:? #6;"HELICOPTER":POSITION 6,5:? #6;"ROUNDUP"
1030 COLOR 3:PLOT 0,0:DRAWTO 19,0:DRAWTO 19,11:DRAWTO 0,11:DRAWTO 0,0
1040 POSITION 4,9:? #6;"{inv}PRESS START{/inv}"
1050 RESTORE 690
1060 READ I:IF I=-1 THEN FOR J=1 TO 200:NEXT J:GOTO 1050
1070 IF PEEK(53279)=6 THEN SOUND 3,0,0,0:RETURN
1080 SOUND 3,I,10,8:FOR J=1 TO 12:NEXT J:GOTO 1060
1090 REM PLEAE WAIT DISPLAY
1100 GRAPHICS 2+16
1110 POSITION 7,4:? #6;"PLEASE"
1120 POSITION 8,7:? #6;"WAIT"
1130 POSITION 5,10:? #6;"30 SECONDS"
1140 FOR I=1 TO 300:NEXT I
1150 RETURN
1160 REM LEVEL INITIALIZATION
1170 POKE 53248,0:POKE 53249,0:POKE 53250,0:POKE 53251,0
1180 GRAPHICS 2+16:SETCOLOR 1,1,4
1190 IC=0:FUEL=51
1200 COLOR 3:PLOT 0,0:DRAWTO 19,0:DRAWTO 19,11:DRAWTO 0,11:DRAWTO 0,0
1210 POSITION 5,2:? #6;"HELICOPTER":POSITION 6,4:? #6;"ROUNDUP"
1220 POSITION 2,7:? #6;"{inv}SELECT number of{/inv}"
1230 POSITION 2,8:? #6;"{inv}cows to herd:{/inv} ";NCOWS
1240 POSITION 4,10:? #6;"{inv}press START{/inv}"
1250 FOR I=PMBASE+810 TO PMBASE+861:POKE I,126:NEXT I
1260 POKE 53279,8
1270 IF PEEK(53279)=5 THEN NCOWS=NCOWS+1:IF NCOWS>30 THEN NCOWS=1
1280 POSITION 16,8:? #6;NCOWS;" "
1290 FOR I=1 TO 10:NEXT I
1300 IF PEEK(53279)<>6 THEN 1260
1310 SCORE=0
1320 GOSUB 720:POKE 623,1:POKE 559,46:FUELUSED=0:CRASH=0:DONE=0
1330 POKE 53256,1:POKE 53259,1
1340 RETURN
1350 REM INITIALIZATION
1360 GOSUB 980:GOSUB 1090
1370 HISCORE=0:NCOWS=1
1380 DIM PMMOVQ$(100),PR$(5),PL$(5),PC$(8),CPOS$(60),CHNEW$(8)
1390 DIM PX$(5)
1400 DIM H(11),V(11)
1410 MOVX=ADR(PMMOVQ$):PMR=ADR(PR$):PML=ADR(PL$):PMC=ADR(PC$)
1420 PMX=ADR(PX$)
1430 RESTORE 1440:FOR I=5 TO 15:READ N:H(I-4)=N:READ N:V(I-4)=N:NEXT I
1440 DATA 1,1,1,-1,1,0,0,0,-1,1,-1,-1,-1,0,0,0,0,1,0,-1,0,0
1450 GRAPHICS 1+16:POKE 559,0
1460 PMBASE=INT((PEEK(106)-6)/4)*4
1470 CHBASE=(PMBASE-2)*256
1480 PMBASE=PMBASE*256
1490 PR$(1)=CHR$(31):PR$(2)=CHR$(132):PR$(3)=CHR$(206):PR$(4)=CHR$(127):PR$(5)=CHR$(14)
1500 PL$(1)=CHR$(248):PL$(2)=CHR$(33):PL$(3)=CHR$(115):PL$(4)=CHR$(254):PL$(5)=CHR$(112)
1510 PC$(1)=CHR$(90):PC$(2)=CHR$(82):PC$(3)=CHR$(34):PC$(4)=CHR$(116):PC$(5)=CHR$(92):PC$(6)=CHR$(94)
1520 PC$(7)=CHR$(162):PC$(8)=CHR$(16)
1530 PX$(1)=CHR$(0):PX$(2)=CHR$(0):PX$(3)=CHR$(129):PX$(4)=CHR$(0):PX$(5)=CHR$(0)
1540 REM ERASE P/M AND CHR MEMORY
1550 RH=PEEK(89):RL=PEEK(88)
1560 I=PEEK(106):POKE 106,I-6:POKE 89,PEEK(106)-8:POKE 88,0:? "{CLEAR}":POKE 89,RH:POKE 88,RL:POKE 106,I
1570 POKE 559,0
1580 REM P/M MOVE ROUTINE
1590 RESTORE 1600:FOR I=1 TO 100:READ N:PMMOVQ$(I)=CHR$(N):NEXT I
1600 DATA 216,104,104,104,133,213,104,24,105,2,133,206,104,133,205,104,133,204,104,133,203,104,104,133,208
1610 DATA 104,104,133,209,104,104,24,101,209,133,207,166,213,240,16,165,205,24,105,128,133,205,165,206,105
1620 DATA 0,133,206,202,208,240,160,0,162,0,196,209,144,19,196,207,176,15,132,212,138,168,177,203,164
1630 DATA 212,145,205,232,169,0,240,4,169,0,145,205,200,192,128,208,224,166,213,165,208,157,0,208,96
1640 REM CHAR MOVE ROUTINE
1650 RESTORE 1960:I=0
1660 READ N:IF N=-1 THEN 1680
1670 POKE 1536+I,N:I=I+1:GOTO 1660
1680 CHNEW$="KVQW#XYZ"
1690 FOR I=0 TO 511:POKE CHBASE+I,PEEK(57344+I):NEXT I
1700 RESTORE 1740
1710 FOR I=1 TO 8
1720 CHADD=CHBASE+(ASC(CHNEW$(I,I))-32)*8
1730 FOR J=0 TO 7:READ N:POKE CHADD+J,N:NEXT J:NEXT I
1740 REM TREE TRUNK -K
1750 DATA 24,24,24,24,24,24,24,24
1760 REM TREE LEAVES-V
1770 DATA 64,49,87,221,84,58,120,28
1780 REM LANDING PAD-Q
1790 DATA 255,255,255,255,255,255,255,255
1800 REM REFUEL ZONE-W
1810 DATA 231,231,231,0,0,231,231,231
1820 REM FENCE - #
1830 DATA 255,68,68,68,255,68,68,68
1840 REM LEFT COW - X
1850 DATA 64,192,255,63,63,17,17,17
1860 REM CENTER COW - Y
1870 DATA 36,24,24,60,60,60,36,36
1880 REM RIGHT COW - Z
1890 DATA 2,3,255,252,252,136,136,136
1900 POKE 54279,INT(PMBASE/256):POKE 53277,3
1910 POKE 704,8:POKE 705,14:POKE 706,186:POKE 707,252
1920 FOR I=PMBASE+640 TO PMBASE+895:POKE I,0:NEXT I
1930 FOR I=PMBASE+682 TO PMBASE+733:POKE I,129:NEXT I:POKE PMBASE+734,255:POKE PMBASE+681,255
1940 RETURN
1950 REM COW MOVE ROUTINE
1960 DATA 104,104,133,204,104,133,203,169
1970 DATA 0,133,208,165,232,208,1,96
1980 DATA 198,232,165,232,10,168,177,203
1990 DATA 133,219,200,177,203,133,220,32
2000 DATA 145,6,165,230,133,207,165,219
2010 DATA 10,10,10,24,105,48,133,206
2020 DATA 32,193,6,138,133,233,24,101
2030 DATA 219,133,221,32,145,6,165,231
2040 DATA 133,207,165,220,10,10,24,105
2050 DATA 16,133,206,32,193,6,138,24
2060 DATA 101,220,133,222,170,32,165,6
2070 DATA 164,221,177,205,201,0,240,10
2080 DATA 165,220,166,219,32,230,6,76
2090 DATA 11,6,169,57,24,101,233,145
2100 DATA 205,166,220,32,165,6,164,219
2110 DATA 169,0,145,205,165,232,10,168
2120 DATA 165,221,145,203,165,222,200,145
2130 DATA 203,166,221,32,230,6,76,11
2140 DATA 6,173,10,210,201,235,176,3
2150 DATA 162,0,96,201,245,176,3,162
2160 DATA 1,96,162,255,96,165,88,133
2170 DATA 205,165,89,133,206,138,208,1
2180 DATA 96,165,205,216,24,105,20,133
2190 DATA 205,144,2,230,206,202,208,241
2200 DATA 96,173,10,210,41,31,133,205
2210 DATA 165,207,24,197,206,176,13,165
2220 DATA 206,56,229,207,24,197,205,176
2230 DATA 2,162,1,96,229,206,24,197
2240 DATA 205,176,2,162,255,96,24,201
2250 DATA 8,176,1,96,201,17,144,1
2260 DATA 96,138,24,201,7,176,1,96
2270 DATA 201,13,144,1,96,230,208,96
2280 DATA -1

Download

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

Credits