Bird Eggs (Be the Eggman)

Type
Game
Category
Jetpack dodging game
Author
Wade Marshall
Published in
Antic, September 1987 (Vol. 6, No. 5), Game of the Month ("Be the Eggman")
Year
1987
Language
Atari BASIC
Requirements
Any Atari 8-bit, Atari BASIC, joystick in port 1
A grey tree trunk and branches on a dark blue sky, a nest of white eggs at the top right, a column of small purple birds, and the red jetpack Eggman on a landing pad at the bottom

About the program

Antic printed this as Be the Eggman, and on the disk it's BIRDEGGS.BAS. You've discovered the rarest eggs in the world in a nest at the top of a very tall, very slippery tree. The only way up is a jetpack, and the sky is full of protective Gloot birds. Fly up to the top branch to take an egg (you change colour when you have one), then drop back to the pad at the bottom. Hit a bird and you lose one of your five lives. Bring down all three eggs and you move to a higher level with more birds. At level 10 there are 25 birds flapping across the screen.

Wade Marshall was a 17-year-old high-school student in Leduc, Alberta, who had been programming his Atari since 1983. This was his first Antic submission and it became the September 1987 Game of the Month. He said young children enjoyed it, and that patience and anticipation count for more than joystick skill.

Typing it in

Line 5027 is a machine-language block-move routine in a string, the hardest line to type. Antic's second listing wrote it to LINES.LST for you to ENTER over the main program, and the disk version printed here includes it. The big BIRD EGGS title (lines 8010–8155) is built from inverse /0 pairs: {inv}…{/inv} means press the Atari key before and after. Line 10050 needs {DEL CHAR} (ESC, then CTRL-DELETE), {INS CHAR} (ESC, then CTRL-INSERT) and {DOWN} (ESC, then CTRL-=). These cursor-control characters are what make the birds move, so they must be exact. Lines 3030 (I=5^2 … I=1^1) only waste a little time between clicks. Type them as printed.

How to play

Press START on the flapping title screen. Push the joystick in any direction to fire the jetpack and rise, and let go to fall under gravity. There's no sideways movement, so it's all about timing your climbs through the gaps between the rows of birds. Touch the top of the tree to grab an egg (25 points), then land on the pad at the bottom to bank it (100 points plus 50 per level). A time bonus is added on the score sheet after each level.

As the article noted, on your first trip of the day the screen starts out dim "until the jetpack warms up". That's the Atari's attract mode, which line 10050 switches on deliberately and line 20 switches off.

Hold SELECT while typing RUN and line 8 turns on a debug mode in which collisions don't cost lives. It's handy for looking at the later levels.

How it works

  • ANTIC mode 4 on a GRAPHICS 0 screen. Line 5000 opens an ordinary text screen and pokes 4 into its display list, so every row becomes ANTIC 4 (GRAPHICS 12 on XL/XE), a mode with four colours per character. The program can still use PRINT and the screen editor. The tree, branches, eggs and birds are all redefined characters in a RAM font at page 120.
  • Moving birds with the screen editor. This is the neat trick. PATN$ is a 617-character string of {INS CHAR} and {DEL CHAR} codes, each followed by three {DOWN}s. Line 32 prints an 18-character slice of it down column 6. Inserting a character there shoves the rest of that bird row one place right, and deleting one pulls it left, so the editor moves whole rows of birds with one PRINT. Marshall explained that changing the slice changes the movement pattern for each level.
  • Flapping. Every pass, line 40 copies one of two 16-byte shapes into the characters / and 0, so every bird on screen flaps its wings at once.
  • The Eggman is player 0. He's moved vertically by block-moving his 7-byte image within player memory, and the hardware collision register 53252 tells the program when he has touched anything.

Variations to try

  • The article suggests looking at line 6060 and changing each 84 to 244, which recolours the lower-left half of the egg. That's a quick lesson in how ANTIC 4 uses two bits per pixel.
  • Change LEVEL=1 in line 5017 to start at a harder level.

Listing

2 REM BIRD EGGS
4 REM BY WADE MARSHALL
6 REM (c) 1987, ANTIC PUBLISHING
8 DEBUG=(PEEK(53279)=5)
10 GOSUB 5000:GOSUB 10000:GOSUB 11000
20 POKE 19,0:POKE 53278,1:POKE 77,0
30 CHANGE=0
31 PT=1
32 POSITION 6,6:? PATN$(PT+CHANGE,PT+CHANGE+17)
35 FLAG=-FLAG
40 A=USR(SHIFT,1750+16*(FLAG<=0),CH+120,16)
50 IF STICK(0)<>15 THEN GR=GR-1:IMAGE=1543:SOUND 0,200,8,10:GOTO 65
60 GR=GR+1:IMAGE=1536:SOUND 0,0,0,0
65 A=USR(SHIFT,ADR(BLANK$),PM1023+P0Y,7)
70 P0Y=P0Y+GR:A=USR(SHIFT,IMAGE,PM1023+P0Y,7)
80 IF PEEK(53252)<>0 THEN 200
100 IF PT<581 THEN PT=PT+20:GOTO 32
101 IF CHANGE<16 THEN CHANGE=CHANGE+4:GOTO 31
110 GOTO 30
200 A=USR(SHIFT,ADR(BLANK$),PM1023+P0Y,7):GR=0:POKE 53278,1
205 IF P0Y<41 THEN F=1:P0Y=41:IF EGG=0 THEN EGG=1:SCORE=SCORE+25:POKE SC+103+EGGS,11:POKE 704,24
210 IF P0Y>193 THEN F=1:P0Y=193:IF EGG=1 THEN EGG=0:SCORE=SCORE+100+LEVEL*50:EGGS=EGGS+1:POKE 704,54:GOTO 216
215 GOTO 220
216 IF EGGS=3 THEN EGGS=0:LEVEL=LEVEL+1:GOTO 3000
217 IF EGGS=1 THEN POSITION 18,21:? "*":GOTO 220
218 POSITION 22,21:? "*"
220 IF F=1 THEN F=0:GOTO 100
225 IF DEBUG THEN 100
230 IF EGG=1 THEN EGG=0:POKE SC+103+EGGS,10
235 LIVES=LIVES-1:FOR X=P0Y TO 220 STEP 2:A=USR(SHIFT,1536,PM1023+X,7):SOUND 0,X,10,10
240 A=USR(SHIFT,ADR(BLANK$),PM1023+X,7):NEXT X:POKE 53278,1:SOUND 0,0,0,0:POKE 704,54
250 IF LIVES<1 THEN BONUS=0:GOTO 3000
260 P0Y=193:GOTO 100
1000 FOR X=6 TO 18 STEP 3:POSITION 5,X:? "                                  ":NEXT X:BONUS=600+LEVEL*250
1005 IF LEVEL=1 THEN NO1=0:NO2=1:GOTO 1020
1007 IF LEVEL>9 THEN NO1=3:NO2=1:GOTO 1020
1010 NO1=INT((LEVEL-1)/3):NO2=LEVEL-NO1*3
1020 ON NO2 GOTO 1022,1024,1026
1022 FOR X=6 TO 18 STEP 3:POSITION 16,X:? WAVE$(1+NO1*10,10+NO1*10):NEXT X
1023 RETURN
1024 GOSUB 11700
1025 POSITION 16,18:? WAVE$(11+NO1*10,20+NO1*10):RETURN
1026 GOSUB 11800
1027 POSITION 16,15:? WAVE$(1+NO1*10,10+NO1*10):RETURN
1100 RETURN
3000 TIME=PEEK(19):POKE 53277,0
3010 GRAPHICS 1+16:POSITION 0,5:? #6;"{inv}bird eggs scoresheet{/inv}":SOUND 0,0,0,0
3011 POSITION 0,8:? #6;"lives          ";LIVES:POSITION 0,1
3020 POSITION 0,10:? #6;"level          ";LEVEL:POSITION 0,15:? #6;"{inv}TOTAL SCORE{/inv}    ";SCORE
3021 IF LIVES<1 THEN 4000
3022 POSITION 0,12:? #6;"time bonus"
3025 BONUS=BONUS-TIME*50:IF BONUS<0 THEN BONUS=0:GOTO 3045
3030 I=5^2:FOR X=BONUS TO 0 STEP -10:SOUND 0,200,8,10:I=1^2:SOUND 0,0,0,0:I=1^1
3040 POSITION 15,12:? #6;X;"  ":SCORE=SCORE+10:POSITION 15,15:? #6;SCORE:NEXT X
3045 REM
3050 FOR X=1 TO 500:NEXT X
3100 GOSUB 5000:GOSUB 1000:GOSUB 11010:GOTO 20
4000 LEVEL=1:SCORE=0:EGG=0:EGGS=0:GR=0:LIVES=5
4005 POSITION 0,20:? #6;"     GAME OVER":? #6:? #6;"    PRESS start"
4010 IF PEEK(53279)=6 THEN GOSUB 5000:GOSUB 1000:GOSUB 11010:GOTO 20
4020 GOTO 4010
5000 GRAPHICS 0:DL=PEEK(560)+256*PEEK(561)+4:FOR I=2 TO 24:POKE DL+I,4:NEXT I:POKE DL-1,68
5005 FLAG=1:SC=PEEK(88)+256*PEEK(89):EGG=0:EGGS=0
5007 POKE 708,15:POKE 709,216:POKE 710,8:POKE 712,112
5010 CHBAS=120:CH=CHBAS*256
5015 IF LEVEL<>0 THEN 5030
5017 LEVEL=1:SCORE=0:LIVES=5
5020 FOR X=24 TO 24+95:READ A:POKE CH+X,A:NEXT X
5023 FOR X=0 TO 7:POKE CH+X,0:NEXT X
5025 FOR X=0 TO 31:READ A:POKE 1750+X,A:NEXT X
5027 SHIFT=ADR("hh{inv}{CTRL-E}q{/inv}h{inv}{CTRL-E}p{/inv}h{inv}{CTRL-E}U{/inv}h{inv}{CTRL-E}T{/inv}h{inv}{CTRL-E}o{/inv}h{inv}{CTRL-E}n {/inv}{CTRL-,}{inv}1p{CTRL-Q}TfTP{/inv}{CTRL-B}{inv}fUfpP{/inv}{CTRL-B}{inv}fqFnPjFo{/inv}{CTRL-P}{inv}f{/inv}{CTRL-.}")
5028 POKE 756,CHBAS:GOSUB 8000
5030 POKE 756,CHBAS:? "{CLEAR}"
5040 ? "##&##################################"
5050 ? "###    ('                 -('   -----"
5060 ? "###                 )***,('-      ---"
5070 ? "##$                  --('           -"
5080 ? "##$"
5090 ? "##.":? "##.":? "##%":? "##%"
5095 FOR X=9 TO 20:POKE 84,X:? "##":NEXT X
5097 POSITION 3,11:? "#########--":POSITION 3,12:? "# - ('  --":POSITION 2,21
5100 POKE 752,1
5105 ? "##.":? "##.              ###":? "###             #####"
5190 RETURN
6000 DATA 255,255,255,255,255,255,255,255
6010 DATA 252,252,252,252,252,252,252,252
6020 DATA 192,192,192,192,192,192,192,192
6030 DATA 3,3,15,15,63,63,255,255
6040 DATA 131,15,60,242,0,0,8,0
6045 DATA 0,0,0,32,131,15,60,240
6050 DATA 192,192,240,48,48,60,12,15
6060 DATA 0,0,0,16,84,84,255,255
6070 DATA 0,0,0,0,0,0,255,255
6080 DATA 3,3,15,12,60,48,240,192
6100 DATA 128,128,8,8,32,32,2,2
6110 DATA 240,240,240,240,240,240,240,240
6120 DATA 0,240,12,13,0,0,0,0
6130 DATA 0,15,48,112,0,0,0,0
6140 DATA 0,0,60,193,0,0,0,0
6150 DATA 0,0,60,67,0,0,0,0
8000 ? "{CLEAR}":POKE 82,0:POKE 756,CHBAS:?
8010 ? "{inv}/0/0/0{/inv}    {inv}/0/0/0{/inv}  {inv}/0/0/0{/inv}    {inv}/0/0/0{/inv}   "
8020 ? "{inv}/0{/inv}    {inv}/0{/inv}    {inv}/0{/inv}    {inv}/0{/inv}    {inv}/0{/inv}  {inv}/0{/inv}    {inv}/0{/inv}  "
8030 ? "{inv}/0{/inv}    {inv}/0{/inv}    {inv}/0{/inv}    {inv}/0{/inv}    {inv}/0{/inv}  {inv}/0{/inv}      {inv}/0{/inv}"
8040 ? "{inv}/0/0/0{/inv}      {inv}/0{/inv}    {inv}/0/0/0{/inv}    {inv}/0{/inv}      {inv}/0{/inv}"
8050 ? "{inv}/0{/inv}    {inv}/0{/inv}    {inv}/0{/inv}    {inv}/0{/inv}  {inv}/0{/inv}    {inv}/0{/inv}      {inv}/0{/inv}"
8060 ? "{inv}/0{/inv}    {inv}/0{/inv}    {inv}/0{/inv}    {inv}/0{/inv}    {inv}/0{/inv}  {inv}/0{/inv}    {inv}/0{/inv}  "
8070 ? "{inv}/0/0/0{/inv}    {inv}/0/0/0{/inv}  {inv}/0{/inv}    {inv}/0{/inv}  {inv}/0/0/0{/inv}    "
8080 ?
8090 ? "{inv}/0/0/0/0{/inv}  {inv}/0/0/0/0{/inv}  {inv}/0/0/0/0{/inv}  {inv}/0/0/0/0{/inv}"
8100 ? "{inv}/0{/inv}        {inv}/0{/inv}    {inv}/0{/inv}  {inv}/0{/inv}    {inv}/0{/inv}  {inv}/0{/inv}    {inv}/0{/inv}"
8110 ? "{inv}/0{/inv}        {inv}/0{/inv}        {inv}/0{/inv}        {inv}/0{/inv}      "
8120 ? "{inv}/0/0/0{/inv}    {inv}/0{/inv}  {inv}/0/0{/inv}  {inv}/0{/inv}  {inv}/0/0{/inv}  {inv}/0/0/0/0{/inv}"
8130 ? "{inv}/0{/inv}        {inv}/0{/inv}    {inv}/0{/inv}  {inv}/0{/inv}    {inv}/0{/inv}        {inv}/0{/inv}"
8140 ? "{inv}/0{/inv}        {inv}/0{/inv}    {inv}/0{/inv}  {inv}/0{/inv}    {inv}/0{/inv}  {inv}/0{/inv}    {inv}/0{/inv}"
8150 ? "{inv}/0/0/0/0{/inv}  {inv}/0/0/0/0{/inv}  {inv}/0/0/0/0{/inv}  {inv}/0/0/0/0{/inv}":? :? :?
8155 ? "{inv}/0{/inv}  {inv}/0{/inv} {inv}/0/0/0{/inv} {inv}/0/0/0{/inv}":? "{inv}/0/0/0{/inv}   {inv}/0{/inv}     {inv}/0{/inv}":? "{inv}/0{/inv}  {inv}/0{/inv} {inv}/0/0/0{/inv}   {inv}/0{/inv}"
8156 POSITION 20,19:? "### ### ### ##  ###":POSITION 20,20:? "#    #  # # # #  #"
8157 POSITION 20,21:? "###  #  ### ##   #"
8158 POSITION 20,22:? "  #  #  # # # #  #":POSITION 20,23:? "###  #  # # # #  #"
8160 X=0
8161 IF PEEK(53279)=6 THEN 8190
8162 X=X+1:IF X<10 THEN 8161
8170 FLAG=-FLAG
8180 A=USR(SHIFT,1750+(FLAG<=0)*16,CH+120,16)
8189 GOTO 8160
8190 POKE 82,2
8200 RETURN
10000 DIM PATN$(621),WAVE$(40),A$(1),BLANK$(255)
10010 WAVE$="    {inv}/0{/inv}      {inv}/0/0/0{/inv}   {inv}/0{/inv}    {inv}/0{/inv} {inv}/0/0/0/0/0{/inv}"
10020 GOSUB 1000
10050 POKE 77,128:RESTORE 10600:FOR X=1 TO 617 STEP 4:READ A$:IF A$="D" THEN PATN$(X)="{DEL CHAR}{DOWN}{DOWN}{DOWN}":GOTO 10070
10060 PATN$(X)="{INS CHAR}{DOWN}{DOWN}{DOWN}"
10070 NEXT X
10500 RETURN
10600 DATA D,I,D,I,I,D,I,D,I,I,D,I,D,I,I,D,I,D,I,D,I,D,D,I,I
10610 DATA D,I,D,I,I,D,I,D,I,I,D,I,I,D,D,D,I,I,D,I,I,D,I,D,I
10620 DATA D,I,I,D,I,D,I,I,D,D,D,I,I,D,D,D,I,I,D,D,I,D,I,D,D
10630 DATA I,D,I,D,I,I,D,I,D,I,I,D,I,D,I,I,D,I,D,I,D,I,I,D,D
10640 DATA I,D,I,D,D,I,D,D,I,D,I,D,D,I,D,I,D,D,I,I,D,I,D,I,D
10650 DATA I,D,D,I,D,I,D,D,I,D,I,D,D,I,I,I,D,I,D,D,D,I,D,I,D
10660 DATA D,I,D,I,I:REM OVERFLOW
11000 RT=PEEK(106)-16:PMMEM=RT*256:POKE 704,54:POKE 53256,0:POKE 54279,RT:P0X=128:PM1023=PMMEM+1023
11010 P0Y=193:BLANK$(1)="{CTRL-,}":BLANK$(255)=BLANK$:BLANK$(2)=BLANK$
11015 RESTORE 11600:A=USR(SHIFT,ADR(BLANK$),PM1023,255)
11020 FOR X=1536 TO 1549:READ A:POKE X,A:NEXT X
11030 POKE 559,62:POKE 53277,3:POKE 53248,P0X
11500 RETURN
11600 DATA 114,63,247,50,48,80,80,114,63,114,242,48,82,85
11700 FOR X=9 TO 15 STEP 3:POSITION 16,X:? WAVE$(1+NO1*10,10+NO1*10):NEXT X
11710 POSITION 16,6:? WAVE$(11+NO1*10,20+NO1*10):RETURN
11800 FOR X=6 TO 18 STEP 6:POSITION 16,X:? WAVE$(11+NO1*10,20+NO1*10):NEXT X
11810 POSITION 16,9:? WAVE$(1+NO1*10,10+NO1*10):RETURN

Download

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

Credits