by David H. Butler
16K cassette or 48K Disk
Joystick

A commercial quality game demonstrating MHD, the ultimate machine language player/missile handler for Atari computers

You have opened a new restaurant called Basic Burger. However, jealous competitors have contaminated your food. Your three chefs must assemble Basic Burgers while avoiding contaminated food. The contaminated food moves faster than your chef, but can be killed by falling burger parts or flying peppers (your trigger).

Your pepper shaker contains only five flying peppers. To renew them, you must catch the bouncing pepper shaker which occasionally travels through the maze.

Assembling burgers, killing contaminated food and collecting bouncing money earns points. For each 10000 points, you earn a new chef.

The contaminated food comes in from the sides. By listening to their entering sound, you can tell which side the food will enter from.

At the start of each round, a random maze is generated with up and down ladders. The speed of all players increases from rounds 1 to 7

Pressing START will restart Basic Burgers at level 1. Pressing the SPACE BAR will pause/resume the game.

Typing it in.

Listing 1 creates two files which the Basic Burger program needs. The first file MHD (motion handler) may be used in games of your own design. The second file contains the modified character set, the player control stacks for MHD and the player images.

Listing 2 is Basic Burger, a 16K cassette or 24K disk maze game with as many as nine fast-moving objects on the screen at once.

Basic Burger.

This program illustrates many of the features of MHD (i.e., cyclic action, maze logic with variable homing logic, auto action on collision, auto action on boundary violation, adjustable player speeds, Missile support, joystick and trigger support.

Cassette users must add Listing 2C to Listing 2. When Basic Burger is RUN, cassette users will be asked to mount the tape created by Listing 1 and press RETURN. After debugging Basic Burger, the program plus the two files it uses may be placed on a single tape by typing GOTO 25000.

MHD design.

This section is for programmers wishing to incorporate MHD into their own games. Maze games or simple shoot-em-up games can be handled. MHD is a 1K machine language program that runs concurrently with Atari BASIC via deferred VBI (vertical blank interrupt). Its features are:

  1. The position of player/missiles may be POKEd.
  2. The velocity of player/missiles may be POKEd.
  3. Player/missiles may be controlled via joystick/trigger.
  4. User may specify number of bullets.
  5. Complete missile logic is supported, or missiles may be automatically grouped to form fifth player.
  6. Cyclic action is supported when player is in motion.
  7. Auto action on specified collisions between player to various playfields, player to specified players, or player to specified missiles. Missile to missile collisions are not supported. Action can be stopped, reset to previous noncollision position or removed.
  8. Auto action on boundary violation. Action can be to remove player or limit player to boundary.
  9. Maze logic for joystick players and maze players with individual homing intelligence is supported. Legal directions at each grid point are specified by the grid table.

Using MHD.

Users will need familiarity with player/missile graphics (if necessary, see COMPUTE!s First Book of Atari Graphics, Chapter 5). The user needs to specify where MHD, player control stacks, PMBASE and the grid table are to be loaded (see Figure 1). There are a series of OS and MHD POKEs to specify various options (see Tables 1 and 2). Subroutine 20000 sets up all of the above for Basic Burger.

The heart of MHD is the player control stacks. Player stacks 0-7 control players 0-3 and missiles 0-3. Each stack is 32 bytes long (see Figures 2 and 4). All stacks are turned on with I=USR(ADR(VECTOR$),ON) and off with I=USR(ADR(VECTOR$),OFF).

Study Figure 4 carefully to learn how to control your player's position, speed, collision actions, images and boundary action. Individual stacks can be turned off by POKEing X to 0. To remove image from screen, POKE X to 2, a boundary violation. MHD will remove player and turn the stack off.

Negative numbers.

DX and DY may be negative. To POKE in a negative number, add 256 to it and POKE in the result. For example, -2 becomes 256-2, or 254.

Maze design.

The following equation, called the grid equation, states that there are grid points every B steps in the X direction, and every A steps in the Y direction.

          Displacement = 16 * (Y/A) + (X/B) - C
Constant C is used to place the grid's corner at a given location (i. e., C = 16 * (Y0/A) - (X0/B), where (X0, Y0) is the upper left-hand corner of the grid. YO/A and XO/B must be integers.

The grid table is a 256-byte table which defines legal directions for the players to move at each grid point. The grid equation yields a displacement from the start of the table. The value at the displacement defines legal directions for the grid point (i. e., 1 = up, 2 = dovm, 4 = left, 8 = right). For example, if down and left are the legal directions, then the value of the grid point is 2 + 4, or 6.

MHD code.

MHD options are selected by changing MHD directly (see Table 2). Listing 3 gives the source code for MHD, allowing special patches to be added. The source code is for the BASM assembler, a subset of the BASM compiler. MHD and the player control stacks must lie on a page boundary.

Programmers should keep this article to incorporate MHD into their own games.


David H. Butler is a CEO of the Hendry Corporation, which determines - without going into market - what would happen if marketing strategies were changed on new or mature products. He has twenty years of computer experience.
Table 1.
OS POKES FOR PMG
RegisterDescription Content
559Resolution46=Double, 62=Single (1)
623Priority(1 P0-P3, PF0-PF3; 2 P0, Pl, PF0, PF1, P2, P3, PF2, PF3; 4 PF0-PF3, P0-P3; 8 PF0, PF1, P0, P1, PF2, PF3, P2, P3)+16 if missiles have own color (register 711).
704-707Player colorHue * 16 + intensity
53256-53259Player width0=Normal, 1=Double, 3=Quadruple
53260Width of missilesTwo bits for each missile specify width
53277Enable player/missile3=Enable (1)
53278Hit clear0 clears collision registers
53252-53255 (player to playfields)
53260-53263 (player to player)
53256-53259 (missile to players)
53279Page of player/ missile areaPEEK(106)-8=Double resolution,
PEEK(106)-16=Single resolution (1)
(1) Most common POKE(s) to this register.

Table 2.
MHD POKES

POKE      CONTENT                       DEFAULT VALUE
ON+1011   Page address of MHD           100
ON+2      Page of player control stack  152
ON+132    Page of player/missile base   152
ON+1006   Grid table address            (0,6) page 6
ON+31     MHD exit address, user VBLANK (98, 288) XITVBV
ON+63     0=Rapid fire                  203=Life trig between shots
ON+100    26= Limit bullets             30=Don't limit bullets
ON+102    Bullet limit                  255
ON+435=4  Enable missiles as
and       5th player i.e.               8
ON+951=0  Stack player 4                252
ON+574    2=Continuous cyclic action    20=Cyclic action when
                                        moving.

RESULT         GRID EQUATION POKES 
OF POKES       POKES TO MAKE
A=8 default    POKE ON+987,10:POKE ON+988,234:POKE ON+941,7
A=16           POKE ON+987,234:POKE ON+988,234:POKE ON+941,15
A=4            POKE ON+987,10:POKE ON+988,10:POKE ON+941,3
B=16 default   POKE ON+994,74:POKE ON+934,15
B=8            POKE ON+994,234:POKE ON+934,7
C              POKE ON+1003,C

Figure 1.
MEMORY LAYOUT FOR BASIC BURGER
 Dispacement from
   PMBASE      PGS      CONTENT
    -512        -2      Modified character set
       0         0      Player control stack
     256         1      Player images
     768         3      Missiles
    1024         4      Player 0 Chef
    1280         5      Player 1 Hot Dog
    1536         6      Player 2 Pickle
    1792         7      Player 3 Chicken
    2048         8      MHD 1012 Bytes; Screen memory 960 bytes
    4096        16      Top of memory

Figure 2.
INDIVIDUAL PLAYER CONTROL STACKS
  Player  Displacement
  stack   from start         Controls
   0         0              Player 0 Chef
   1        32              Player 1 Hot Dog
   2        64              Player 2 Pickle
   3        96              Player 3 Chicken
   4       128              Missile 0 Left Pepper
   5       160              Missile 1 Right Pepper
   6       192              Missile 2 Bouncing Pepper
   7       224              Missile 3 Bouncing Money

Figure 3.
IMAGE LOCATIONS
 Displacement
 from start          Images
    0            Two hot dog images
   32            Two pickle images
   64            Two chicken images
   96            Six chef images
  192            Flying peppers
  200            Four bouncing pepper images
  232            Four bouncing bill images

Figure 4.
PLAYER CONTROL STACK
 Displacement
  from start      Content
   0       X Horizontal position
   1       Y Vertical position
   2       DX Change in X per change
   3       DY Change in Y per change
   4       IJIFFIES Jiffies per image change
   5       XJIFFIES Jiffies per X change
   6       YJIFFIES Jiffies per Y change
   7       PPFC Player to playfields collision command
   8       PPC Player to players collision command
   9       PMC Player to missiles collision command
  10       #IMAGES Number of images to cycle
  11       IMSZ Image size
  12       IMPTR Image pointer used by MHD
  13       LSBIM Image address, least significant byte
  14       MSBIM Image address, most significant byte
  15       HI+BFLG Homing intelligence + boundary flag
  16       XMIN Lower horizontal limit
  17       XMAX Upper horizontal limit
  18       YMIN Lower vertical limit
  19       YMAX Upper vertical limit
  20       ICNT MHD counter used with IJIFFIES
  21       XCNT MHD counter used with XJIFFIES
  22       YCNT MHD counter used with YJIFFIES
  23       PX Prior X without collision
  24       PY Prior Y used to reset on collision
  25       LY Last Y used to remove old image
  26       CONTROL 26-31 control special functions
  27       Dx Defines DX,DY for stick or maze players
  28       Dy For trigger add to CPLR's X,Y to form
           missile's X,Y.
  29       CPLR Player to home in on (CONTROL 16)
  30       HX or BULLET COUNT
  31       HY or Last trigger position

 Collision command (0=Stop, 64=Reset, 128=Remove on collision)
                      +WITH (bits 0-3)
           HI (2,4,6 ... 254) Random to hound dog.
     BFLG (0=Remove on violation, 1=Stop on boundary)
                 1 Jiffy= 1/60 of a second
 CONTROL (255=None, 0-3=Trigger, 4-7=4-way stick, 8-11=8-way stick,
      16=Maze player with homing logic, 20-23=Maze Stick)
      Maze player has intelligence HI and homes in on CPLR.
        If CPLR=255, then maze player homes in on HX,HY.
     Note: If player stack is not used, set X=0 and CONTROL=255.

Listing 1.

 5 REM PROGRAM CREATES TWO FILES FOR BA
 SIC BURGER
 10 REM LOAD MHD IN MEMORY
 20 PGTOP=PEEK(106):PG=PGTOP-8:LINE=100
 00:GOSUB 1000
 30 REM LOAD PLAYER STACKS IN MEMORY
 40 ? CHR$(253):PG=PGTOP-11:LINE=10700:
 GOSUB 1000
 50 REM LOAD PLAYER IMAGES IN MEMORY
 60 ? CHR$(253):PG=PGTOP-10:LINE=11000:
 GOSUB 1000
 70 REM MODIFY CHARACTER SET IN MEMORY
 80 ? CHR$(253):PG=PGTOP-13:LINE=11300:
 GOSUB 1000:? CHR$(253)
 90 B=PG*256:A=PEEK(756)*256:FOR I=128 
 TO 511:POKE B+I,PEEK(A+I):NEXT I:FOR I
 =256 TO 263:POKE B+I,255:NEXT I
 96 A=B+512:RESTORE 97:FOR I=0 TO 7:REA
 D B:POKE A-272+I,B:POKE A-257-I,B:NEXT
  I
 97 DATA 255,231,195,129,231,231,231,25
 5
 99 DIM F1$(20),F2$(20):F1$="C:":F2$=F1
 $:SP=128
 100 ? "MAKE CASETTE (0), OR DISK(1)";:
 INPUT CD:IF CD THEN F1$="D:MHD.ML":F2$
 ="D:BURGER.BIN":SP=0
 105 IF CD=0 THEN ? "INSERT CASSETTE, P
 USH PLAY AND":? "RECORD AND PRESS RETU
 RN"
 110 IO=2:PG=PGTOP-8:OPEN #IO,8,SP,F1$:
 NUM=1012
 120 GOSUB 20110
 130 REM WRITE CHSET STACK AND IMAGES
 140 PG=PGTOP-13:NUM=1023:POKE 764,12:O
 PEN #IO,8,SP,F2$
 150 GOSUB 20110:POKE (PGTOP-8)*256,0:E
 ND 
 1000 REM SUBR LOAD DATA IN MEMORY
 1010 RESTORE LINE:B=PG*256:SUM=0:TRAP 
 1030
 1020 FOR J=0 TO 15:READ A:POKE B,A:SUM
 =SUM+A:B=B+1:NEXT J
 1030 IF LINE<>PEEK(183)+256*PEEK(184) 
 THEN ? LINE;" MISSING":END 
 1040 READ A:IF SUM<>ABS(A) THEN ? "CHE
 CKSUM ERROR LINE ";LINE:END 
 1050 ? LINE:LINE=LINE+10:IF A>0 THEN 1
 020
 1060 TRAP 40000:RETURN 
 9999 REM MHD.ML
 10000 DATA 216,169,152,133,204,169,255
 ,133,0,133,209,230,0,165,0,201,2369
 10010 DATA 8,208,14,165,209,208,3,141,
 30,208,160,8,162,0,76,98,4067
 10020 DATA 228,10,10,10,10,10,133,203,
 160,0,177,203,208,85,160,26,5700
 10030 DATA 177,203,201,4,176,213,170,1
 60,31,189,132,2,209,203,240,203,8213
 10040 DATA 145,203,168,208,198,165,204
 ,133,206,160,29,177,203,10,10,10,10442
 10050 DATA 10,10,133,205,160,0,177,205
 ,240,177,160,30,177,203,24,105,12458
 10060 DATA 1,145,203,160,30,201,255,20
 8,4,169,255,145,203,160,27,177,14801
 10070 DATA 203,160,0,24,113,205,145,20
 3,160,28,177,203,160,1,24,113,16720
 10080 DATA 205,145,203,169,152,133,208
 ,165,0,201,4,144,2,169,255,24,18899
 10090 DATA 105,4,74,170,169,0,106,133,
 207,138,101,208,133,208,165,0,20820
 10100 DATA 73,4,170,160,7,177,203,61,0
 ,208,208,56,200,177,203,61,22788
 10110 DATA 8,208,208,48,169,1,133,205,
 165,0,201,4,176,81,170,200,24765
 10120 DATA 177,203,240,75,133,206,202,
 48,4,6,205,144,249,160,0,70,26887
 10130 DATA 206,144,7,185,8,208,37,205,
 208,8,200,192,4,208,240,24,28971
 10140 DATA 144,45,160,9,177,203,10,144
 ,14,169,0,133,209,160,0,145,30693
 10150 DATA 203,32,187,103,76,11,100,10
 ,144,18,160,23,177,203,160,0,32300
 10160 DATA 132,209,145,203,160,24,177,
 203,160,1,145,203,76,174,101,160,34573
 10170 DATA 21,177,203,24,105,1,145,203
 ,160,5,209,203,144,43,160,21,36397
 10180 DATA 169,0,145,203,168,177,203,1
 60,23,145,203,24,160,2,113,203,38495
 10190 DATA 160,16,209,203,176,10,160,1
 5,177,203,41,1,240,171,208,9,40494
 10200 DATA 200,209,203,176,241,160,0,1
 45,203,160,22,177,203,24,105,1,42723
 10210 DATA 145,203,160,6,209,203,144,4
 4,160,22,169,0,145,203,160,1,44697
 10220 DATA 177,203,160,24,145,203,24,1
 60,3,113,203,160,18,209,203,176,46878
 10230 DATA 10,160,15,177,203,41,1,208,
 11,240,193,200,209,203,176,241,49166
 10240 DATA 160,1,145,203,160,20,177,20
 3,24,105,1,145,203,160,4,209,51086
 10250 DATA 203,144,27,160,20,169,0,145
 ,203,160,12,177,203,24,105,1,52839
 10260 DATA 145,203,160,10,209,203,144,
 6,160,12,169,0,145,203,166,0,54774
 10270 DATA 160,0,224,8,208,17,202,138,
 73,3,10,234,234,113,203,157,56758
 10280 DATA 4,208,202,16,242,48,5,177,2
 03,157,0,208,160,12,177,203,58780
 10290 DATA 170,136,169,0,24,202,48,4,1
 13,203,208,249,160,13,24,113,60616
 10300 DATA 203,133,205,200,169,0,113,2
 03,133,206,160,1,177,203,72,160,62954
 10310 DATA 25,209,203,240,3,32,187,103
 ,104,160,25,145,203,24,101,207,64925
 10320 DATA 133,207,160,11,177,203,168,
 136,166,0,189,179,103,170,138,49,67114
 10330 DATA 207,17,205,145,207,136,16,2
 46,160,26,177,203,48,108,201,4,69220
 10340 DATA 144,104,201,12,176,103,133,
 205,41,3,170,169,0,160,2,145,70988
 10350 DATA 203,200,145,203,189,120,2,7
 3,15,133,206,208,8,160,20,169,73042
 10360 DATA 0,145,203,240,69,70,206,144
 ,10,160,28,169,0,241,203,160,75090
 10370 DATA 3,145,203,70,206,144,8,160,
 28,177,203,160,3,145,203,70,77018
 10380 DATA 206,144,10,160,27,169,0,241
 ,203,160,2,145,203,70,206,144,79108
 10390 DATA 8,160,27,177,203,160,2,145,
 203,165,205,201,8,176,11,160,81119
 10400 DATA 2,177,203,240,5,200,169,0,1
 45,203,76,11,100,201,16,240,83107
 10410 DATA 112,41,3,170,32,161,103,240
 ,13,169,12,192,0,240,2,169,84766
 10420 DATA 3,133,206,24,144,50,32,215,
 103,160,2,177,203,48,10,165,86441
 10430 DATA 206,41,8,208,12,145,203,240
 ,8,165,206,41,4,208,2,145,88283
 10440 DATA 203,200,177,203,48,10,165,2
 06,41,2,208,12,145,203,240,8,90354
 10450 DATA 165,206,41,1,208,2,145,203,
 189,120,2,73,15,37,206,133,92100
 10460 DATA 206,208,12,160,2,177,203,20
 0,17,203,208,12,76,61,102,169,94116
 10470 DATA 0,160,2,145,203,200,145,203
 ,169,4,133,205,76,69,102,208,96140
 10480 DATA 137,160,21,177,203,208,248,
 32,161,103,208,243,32,215,103,240,98631
 10490 DATA 222,160,2,177,203,240,14,48
 ,6,165,206,41,11,208,25,165,100524
 10500 DATA 206,41,7,208,19,200,177,203
 ,48,8,240,14,165,206,41,14,102321
 10510 DATA 208,6,165,206,41,13,240,183
 ,133,206,160,15,173,10,210,209,104499
 10520 DATA 203,144,17,173,10,210,41,3,
 170,189,175,103,37,206,240,243,106663
 10530 DATA 133,206,208,155,160,29,177,
 203,48,27,10,10,10,10,10,133,108192
 10540 DATA 207,165,204,133,208,160,0,1
 77,207,160,30,145,203,160,1,177,110529
 10550 DATA 207,160,31,145,203,160,30,1
 77,203,160,0,209,203,240,12,48,112717
 10560 DATA 4,169,8,208,2,169,4,37,206,
 208,197,160,31,177,203,160,114660
 10570 DATA 1,209,203,48,4,169,2,208,2,
 169,1,37,206,208,177,240,116544
 10580 DATA 162,160,0,177,203,41,15,208
 ,5,200,177,203,41,7,96,1,118240
 10590 DATA 2,4,8,0,0,0,0,252,243,207,6
 3,166,0,189,179,103,119656
 10600 DATA 133,1,160,11,177,203,170,16
 0,25,177,203,168,177,207,37,1,121666
 10610 DATA 145,207,200,202,208,246,96,
 160,1,177,203,10,234,133,206,136,124230
 10620 DATA 177,203,74,74,74,74,24,101,
 206,56,233,0,168,185,0,6,125885
 10630 DATA 133,206,96,100,0,0,0,0,0,0,
 0,0,0,0,0,0,-126420
 10690 REM PLAYER CONTROL STACKS ***
 10695 REM CHEF
 10700 DATA 0,0,0,0,10,4,5,0,143,0,2,16
 ,0,160,145,1,486
 10710 DATA 60,196,40,137,0,0,0,0,0,0,2
 0,1,1,0,0,0,941
 10715 REM HOT DOG
 10720 DATA 0,0,0,0,10,3,4,139,0,131,2,
 16,0,0,145,150,1541
 10730 DATA 10,250,16,250,0,0,0,0,0,0,1
 6,1,1,0,0,0,2085
 10735 REM PICKEL
 10740 DATA 0,0,0,0,10,3,4,139,0,131,2,
 16,0,32,145,150,2717
 10750 DATA 10,250,16,250,0,0,0,0,0,0,1
 6,1,1,0,0,0,3261
 10755 REM CHICKEN
 10760 DATA 0,0,0,0,20,3,4,139,0,131,2,
 16,0,64,145,150,3935
 10770 DATA 10,250,16,250,0,0,0,0,0,0,1
 6,1,1,0,0,0,4479
 10775 REM RIGHT FLYING PEPPER
 10780 DATA 0,0,1,1,0,1,1,139,142,0,1,5
 ,0,192,145,0,5107
 10790 DATA 32,216,16,200,0,0,0,0,0,0,0
 ,4,255,0,0,0,5830
 10795 REM LEFT FLYING PEPPER
 10800 DATA 0,0,255,1,0,1,1,139,142,0,1
 ,5,0,192,145,0,6712
 10810 DATA 32,216,16,200,0,0,0,0,0,0,0
 ,2,255,0,0,0,7433
 10815 REM BOUNCING P
 10820 DATA 0,0,0,0,4,5,6,0,1,0,4,8,0,2
 00,145,1,7807
 10830 DATA 32,240,40,137,0,0,0,0,0,0,1
 6,1,1,1,0,0,8275
 10835 REM BOUNCING MONEY
 10840 DATA 0,0,0,0,4,5,6,0,129,0,4,8,0
 ,232,145,0,8808
 10850 DATA 32,240,40,137,0,0,0,0,0,0,1
 6,1,1,1,0,0,-9276
 10990 REM IMAGES FOR PLAYERS ****
 10995 REM TWO HOT DOG IMAGES
 11000 DATA 48,120,180,252,252,126,126,
 62,62,126,126,252,252,252,120,48,2404
 11010 DATA 12,30,45,62,62,126,126,252,
 252,126,126,62,62,62,30,12,3851
 11015 REM TWO PICKEL IMAGES
 11020 DATA 0,24,0,126,0,90,0,255,0,231
 ,0,90,0,126,0,24,4817
 11030 DATA 0,0,0,0,0,0,126,255,126,0,0
 ,0,0,0,0,0,5324
 11035 REM TWO CHICKEN IMAGES
 11040 DATA 0,0,24,60,60,126,126,126,12
 6,60,60,60,24,24,24,60,6284
 11050 DATA 0,0,60,24,24,24,60,60,60,12
 6,126,126,126,60,60,24,7244
 11055 REM 2 MV LEFT,2 MV RT,2 CLIMBING
  CHEF IMAGES
 11060 DATA 0,0,0,0,62,127,62,28,28,12,
 63,127,92,28,54,54,7981
 11070 DATA 0,0,0,0,62,127,62,28,28,12,
 127,127,29,28,54,99,8764
 11080 DATA 0,0,0,0,62,127,62,28,28,24,
 63,127,92,28,54,54,9513
 11090 DATA 0,0,0,0,62,127,62,28,28,24,
 127,127,29,28,54,99,10308
 11100 DATA 0,0,0,0,0,124,254,124,56,56
 ,126,254,254,252,108,12,11928
 11110 DATA 0,0,0,0,0,124,254,124,56,56
 ,252,254,254,126,108,96,13632
 11115 REM FLYING PEPPER, 4 BOUNCING P
 11120 DATA 15,0,15,0,15,0,0,0,48,48,48
 ,32,32,32,0,0,13917
 11130 DATA 0,48,48,48,32,32,32,0,0,0,4
 8,48,48,32,32,32,14397
 11135 REM , 4 MONEY IMAGES
 11140 DATA 0,48,48,48,32,32,32,0,0,0,0
 ,0,192,192,192,192,15405
 11150 DATA 0,0,0,192,192,192,192,0,0,0
 ,192,192,192,192,0,0,16941
 11160 DATA 0,0,0,192,192,192,192,0,0,0
 ,0,0,0,0,0,0,-17709
 11290 REM 16 REDEFINED CHARACTERS ***
 11300 DATA 0,0,0,0,0,0,0,0,255,255,0,2
 55,0,255,0,255,1275
 11310 DATA 3,7,15,31,63,127,255,255,25
 5,255,191,255,255,255,223,255,3975
 11320 DATA 192,240,248,252,254,255,191
 ,255,0,255,0,255,0,255,0,255,6882
 11330 DATA 19,63,127,255,255,127,63,6,
 96,252,254,255,255,254,252,200,9615
 11340 DATA 255,191,255,127,63,31,15,3,
 255,191,255,254,252,248,240,192,12442
 11350 DATA 0,0,0,0,0,0,0,255,31,63,127
 ,191,255,127,63,31,13585
 11360 DATA 248,252,254,255,191,254,252
 ,248,28,191,255,255,255,255,253,56,17087
 11370 DATA 0,0,0,0,0,0,24,60,24,24,60,
 36,36,44,110,126,-17631
 20110 REM IO=(1=READ,2=WRITE)
 20120 REM PG=PAGE , NUM =# OF BYTES
 20130 IOCB=832+IO*16:POKE IOCB+2,3+4*I
 O:POKE IOCB+4,0:POKE IOCB+5,PG
 20140 I=INT(NUM/256):POKE IOCB+8,NUM-I
 *256:POKE IOCB+9,I
 20150 I=USR(ADR("hhh*LVd"),IO*16):CLOS
 E #IO:RETURN
Line 20150

CHECKSUM DATA.
   (see CCHECK & DCHECK or UNICHECK)

 5 DATA 771,738,722,884,34,857,16,424,3
 49,88,667,293,346,991,751,7931
 110 DATA 123,4,909,25,65,590,547,424,9
 24,502,1,910,182,723,185,6114
 10020 DATA 412,553,26,530,574,696,807,
 730,415,486,309,502,327,405,15,6787
 10170 DATA 491,587,509,525,462,777,568
 ,446,453,457,307,340,464,752,530,7668
 10320 DATA 65,626,500,716,498,266,707,
 484,242,414,286,236,464,460,722,6686
 10470 DATA 454,887,514,289,804,762,747
 ,44,783,276,236,178,849,599,821,8243
 10620 DATA 274,852,632,889,617,375,251
 ,892,579,460,175,578,328,199,598,7699
 10775 DATA 11,875,874,214,901,853,757,
 305,579,438,431,836,363,70,733,8240
 11010 DATA 86,771,4,369,26,699,712,503
 ,578,397,576,571,130,132,222,5776
 11120 DATA 987,284,310,368,844,897,922
 ,886,567,339,810,885,360,194,414,9067
 20110 DATA 736,579,477,205,172,2169

Listing 2.

 1 REM ** BASIC BURGER **
 2 REM BY DAVID H. BUTLER
 4 K1=1:K2=2:K3=3:K4=4:K5=5:K6=6
 5 DIM UP$(K1),VECTOR$(11),FOOD$(18),B$
 (12):LIFE=K3:BPNT=10000:B$="          
   ":LEVEL=PEEK(1750)
 10 RESTORE 1600:FOR I=K1 TO 11:READ A:
 VECTOR$(I)=CHR$(A):NEXT I:FOR I=K1 TO 
 18:READ A:FOOD$(I)=CHR$(A):NEXT I
 90 GRAPHICS 17:POKE 77,K0:GOSUB 20000:
 POKE 756,PGCHSET:PFLG=K0:GOSUB 7800:BF
 LG=PFLG:SOUND K1,20,12,8:POKE 764,255
 163 IF PEEK(53279)=K6 OR  NOT STRIG(K0
 ) THEN GOSUB 550:RUN 
 164 IF LIFE=K0 THEN I=USR(ADR(VECTOR$)
 ,OFF):GOSUB 1500:POSITION K6,K0:? #K6;
 "0";:GOTO 163
 165 GOSUB 550:BLUE=170:XOLD=128:POKE A
 +K1,40:POKE A,XOLD:I=USR(ADR(VECTOR$),
 ON)
 169 REM START OF MAIN LOOP
 170 X=PEEK(A):X1=INT(X/32+0.5)*32:IF  
 NOT X THEN GOSUB 9100:GOTO 163
 175 Z=PEEK(A+K2)<>K0:IF Z THEN SOUND K
 0,250,K2,Z*K4
 180 IF X-XOLD>24 THEN X0=XOLD:XOLD=X1:
 X1=X1-8:GOSUB 1000
 181 IF XOLD-X>24 THEN X0=X1:X1=XOLD:XO
 LD=X0:GOSUB 1000
 183 YOLD=PEEK(A+K1):POSITION K0,K0:? #
 K6;"LIVES ";LIFE;" SCORE ";PNT;:IF PEE
 K(53279)=K6 THEN LIFE=K0:GOTO 164
Line 183

 184 IF PNT>=BPNT THEN GOSUB 9410
 186 I=PEEK(PEPPER)*K2+K1:POSITION K1,2
 2:? #K6;B$(K1,I);:POSITION K1,23:? #K6
 ;B$(K1,I);
 187 IF  NOT BFLG THEN IF PEEK(20)>60 T
 HEN POSITION 14,23:? #K6;"      ";
 190 POKE 53761,K0:REM QUICK SO.0,0,0,0
 191 IF  NOT PFLG THEN IF PEEK(53770)<K
 4 THEN PFLG=K1:B=A+K6*32:GOSUB 1120
 192 IF PFLG=K1 THEN B=PEEK(53258)/K2:I
 F B<>INT(B) THEN GOSUB 8270:POKE A+192
 ,K2:PFLG=K0:GOSUB 9300:POKE 53278,K0
 193 IF  NOT BFLG THEN IF PEEK(53770)<7
  THEN BFLG=K1:B=A+224:GOSUB 1120
 194 IF BFLG AND  NOT PEEK(A+224) THEN 
 POSITION 14,23:? #K6;"B=";BONUS;:BFLG=
 K0:PNT=PNT+BONUS:POKE 20,K0:GOSUB 9300
 195 IF PEEK(764)=33 THEN GOSUB 9000
 200 GOSUB 1100:GOSUB 990:GOTO 170
 540 REM REMOVE ALL PLAYERS, SET DX AND
  DY TO ZERO ON ALL BUT PEPPERS
 550 FOR I=K0 TO 7:B=A+I*32:POKE B,K2:P
 OKE 53248+I,K0:IF I<>K4 AND I<>K5 THEN
  POKE B+K2,K0:POKE B+K3,K0
 560 NEXT I:POKE A+21,K0:POKE 53278,K0:
 BFLG=K0:PFLG=K0:D=K0:RETURN 
 980 REM CHOOSE CHEF IMAGE
 990 DX=PEEK(A+K2):POKE A+13,96*(DX=255
 )+128*(DX=K1)+160*(DX=K0)
 993 REM FLYING PEPPER SOUND
 995 P=PEEK(A+128):IF  NOT P THEN P=PEE
 K(A+160)
 996 DX=ABS(P-PEEK(A))/10:SOUND K1,K5,K
 4,(8-DX)*(DX<8)*(P<>K0):RETURN 
 999 REM FALLING BURGER ROUTINE
 1000 Y=INT((YOLD-40)/24+0.5)*24+40:PY=
 Y/8-K2:PX=X0/8-K5:LOCATE PX,PY,OUT:IN=
 32
 1010 IF IN=OUT THEN RETURN
 1025 REM REMOVE FOOD ON TOP BURGER PAR
 T
 1030 FOR I=32 TO 96 STEP 32:B=PEEK(I+A
 ):IF PEEK(A+I+K1)=Y THEN IF B>X0 AND B
 <X1 THEN POKE I+A,K2
 1040 NEXT I
 1045 PNT=PNT+100:POSITION PX,PY:? #K6;
 "   ";
 1050 FD=K6*(OUT=34)+9*(OUT=K6)+12*(OUT
 =139)+15*(OUT=40)+K1:SOUND K0,255-PY*1
 0,10,K4
 1051 POKE 53763,K0:IF PEEK(A+128) THEN
  SOUND K1,K5,K4,K4
 1055 FOOD=K3*(IN=170)+K6*(IN=34)+9*(IN
 =K6)+12*(IN=139)+15*(IN=40)+K1:IF PEEK
 (764)=33 THEN GOSUB 9000
 1060 IF PY>16 THEN LOCATE PX,PY+K1,IN:
 IF IN<>32 THEN PNT=PNT+400*(PY=17):POK
 E 53761,K0:GOTO 1095
 1070 IF IN=32 OR IN=BLUE THEN POSITION
  PX,PY:? #K6;FOOD$(FOOD,FOOD+K2);:IF (
 IN=BLUE) AND PEEK(A+K3) THEN GOSUB 990
 1075 PY=PY+K1:LOCATE PX,PY,IN:POSITION
  PX,PY:? #K6;FOOD$(FD,FD+K2);:IF IN<>3
 2 AND IN<>BLUE THEN OUT=IN:GOTO 1050
 1090 GOTO 1055
 1091 REM TEST FOR END OF ROUND
 1095 FOR I=K4 TO 16 STEP K4:LOCATE I,1
 7,B:IF B=32 THEN POP :RETURN 
 1096 NEXT I:POP :PNT=PNT+800:FOR I=K1 
 TO K3:PNT=PNT+100*( NOT PEEK(A+I*32)):
 NEXT I:GOSUB 550:GOSUB 9200:GOTO 10
 1099 REM BRING FOOD TO LIFE
 1100 IF RND(K0)<0.75 THEN RETURN
 1105 B=A+32+32*INT(K3*RND(K0)):IF PEEK
 (B) THEN RETURN 
 1110 D=D+K1:PNT=PNT+(D>K3)*100
 1120 Y=40+INT(RND(K0)*K5)*24:X1=32+192
 *INT(RND(K0)*K2):POKE B+K1,Y:POKE B+K2
 ,K0:POKE B+K3,K0:POKE B,X1:RETURN 
 1500 REM PUT DEAD CHEF ON SCREEN
 1510 I=PEEK(A+25)+A+1024:B=PEEK(A+13)+
 256*PEEK(A+14):FOR J=K4 TO 15:POKE I+J
 ,PEEK(B+J):NEXT J:RETURN 
 1600 DATA 104,104,170,104,168,169,7,32
 ,92,228,96
 1610 DATA 32,32,32,170,170,170,34,35,3
 6,6,13,7,139,131,140,40,35,41
 7800 REM SET SPEEDS
 7810 LEVEL=LEVEL+(LEVEL<7):RESTORE 788
 0:POSITION 14,22:? #K6;"L=";LEVEL;
Line 7810

 7815 FOR I=K1 TO LEVEL:READ B,C,BONUS:
 NEXT I
 7820 POSITION K2,K2:? #K6;"GET READY T
 O PLAY";
 7830 POSITION K2,21:? #K6;"BASIC BURGE
 R";
 7840 POKE A+K5,B+K1:POKE A+K6,C+K1:POK
 E A+197,B+K2:POKE A+198,C+K2
 7850 FOR I=K1 TO K3:POKE A+I*32+K5,B:P
 OKE A+I*32+K6,C:NEXT I:PEPPER=A+128+30
 :IF  NOT PNT THEN POKE PEPPER,K0
 7880 DATA 4,3,500,3,4,750,3,3,1000,3,2
 ,1500,2,3,2000,2,2,3000,2,1,5000
 7890 POSITION K2,22:? #K6;"PEPPERS=";K
 5-PEEK(PEPPER);
 7900 POSITION K2,23:? #K6;"LIVES=";LIF
 E;"  SC=";PNT;
Line 7890

 7905 IF PNT>BPNT THEN GOSUB 9400
 8000 REM DRAW RANDOM MAZE
 8010 FOR I=K0 TO 192 STEP 16:RESTORE 8
 050:C=( NOT I)+K2*(I=192)
 8020 FOR J=K1 TO 16:READ B
 8030 POKE 1536+I+J,B-C*(B=K3)
 8040 NEXT J:IF PEEK(53279)=K5 THEN LEV
 EL=LEVEL*(LEVEL<>7):POKE 1750,LEVEL:PO
 P :GOTO 7800
 8045 NEXT I
 8050 DATA 8,8,8,3,12,3,12,3,12,3,12,3,
 4,4,4,4
 8055 REM ADD BASIC MAZE
 8060 FOR I=K2 TO 11 STEP K3:POSITION K
 2,I
 8070 IF I=K2 THEN ? #K6;"*************
 ****":GOTO 8090
 8080 ? #K6;"%***%***%***%***%"
 8090 ? #K6;"  !   !   !   !   !"
 8100 ? #K6;"  %   %   %   %   %"
 8110 NEXT I:POSITION K2,14:? #K6;"%***
 %***%***%***%";
Line 8070

 8120 REM ADD FOOD MODIFY MAZE
 8130 FOR I=K3 TO 15 STEP K4:FD=7
 8140 B=K3+K3*INT(RND(K0)*K5)
 8150 FOR J=K3 TO 15 STEP K3
 8160 IF J=B THEN POSITION I,J-K1:? #K6
 ;"   ";:GOTO 8190
 8170 POSITION I,J:? #K6;FOOD$(FD,FD+K2
 );:FD=FD+K3
 8180 GRID=1536+16*(J-K3)+(I+K5)/K2:POK
 E GRID,PEEK(GRID)+8:POKE GRID+K2,PEEK(
 GRID+K2)+K4
 8190 NEXT J:NEXT I
 8200 REM ADD ONE WAY LADDERS
 8210 FOR I=K3 TO 19 STEP K4
 8220 UP= NOT UP:UP$="?":IF UP THEN UP$
 =">"
Line 8220

 8230 J=K4+K3*INT(RND(K0)*K4):GRID=1536
 +16*(J-K4)+(I+K5)/K2
 8240 B=GRID+48*( NOT UP):IF PEEK(B)-UP
 =K1 THEN 8230
 8250 POKE B,PEEK(B)-UP-UP-( NOT UP)
 8260 POSITION I-K1,J:? #K6;UP$;:NEXT I
 8270 POSITION K2,21:FOR I=K1 TO 17:? #
 K6;CHR$(96);:NEXT I:POSITION K2,22:FOR
  I=K1 TO K5:? #K6;" ";CHR$(14);:NEXT I
 8280 POSITION K0,23:? #K6;"   / / / / 
 /   ";
 8285 IF PNT AND  NOT PFLG THEN RETURN
 8290 B=A+128:POKE PEPPER,K0:POKE B+26,
 K0:POKE PEPPER+32,K0:POKE B+32+26,K0:R
 ETURN 
 9000 POKE 764,255:I=USR(ADR(VECTOR$),O
 FF):GOSUB 9220
 9010 IF PEEK(764)<>33 THEN 9010
 9020 POKE 764,255:I=USR(ADR(VECTOR$),O
 N):RETURN 
 9100 REM KILL CHEF SOUND
 9110 LIFE=LIFE-K1:FOR D=15 TO K0 STEP 
 -K1:SOUND K0,255*RND(K0),10,D:NEXT D:P
 FLF=D:BFLG=D:RETURN 
 9200 REM END ROUND SOUND
 9210 FOR I=160 TO 80 STEP -K1:SOUND K0
 ,I,10,K6:NEXT I:SOUND K1,60,14,K6:SOUN
 D K2,96,14,K6
 9220 POKE 53761,K0:FOR I=K1 TO 150:NEX
 T I:SOUND K1,K0,K0,K0:SOUND K2,K0,K0,K
 0:RETURN
 9300 FOR I=K1 TO 10:SOUND K0,20*RND(K0
 ),10,8:NEXT I:POKE 53761,K0:RETURN 
 9390 DATA 38,32,26,20,32,26
 9400 REM BONUS CHEF
 9410 LIFE=LIFE+K1:BPNT=BPNT+10000:REST
 ORE 9390:FOR I=K1 TO K6:READ B:SOUND K
 0,B,10,K6:FOR B=K0 TO 10:NEXT B:NEXT I
 9420 POKE 53761,K0:RETURN 
 20000 REM ONE TIME SET UP
 20015 REM ASSIGN COLORS TO PLAYERS
 20020 POKE 704,14:POKE 705,70:POKE 706
 ,PEEK(709):POKE 707,24:POKE 711,22
 20025 REM LOAD IN MHD IF NOT LOADED
 20030 PGTOP=PEEK(106):PGCHSET=PGTOP-18
 :PG=PGTOP-8:LET ON=PG*256:NUM=1012
 20035 IF PEEK(ON)=216 THEN 20090
 20040 IO=K1:OPEN #IO,K4,K0,"D:MHD.ML":
 GOSUB 20110:GOSUB 20160
 20045 REM MHD RET.=DEFERRED VBLANK
 20050 POKE ON+31,PEEK(548):POKE ON+32,
 PEEK(549):LEVEL=K0:POKE 1750,LEVEL
 20055 POKE ON+100,26:POKE ON+102,K5:RE
 M LIMIT PEPPERS TO 5.
 20060 POKE ON+146,24:REM SINGLE RESOLU
 TION.
 20065 POKE ON+951,240:POKE ON+952,240:
 REM CHANGE MISSILE KEEP MASK.
 20070 POKE ON+1003,80:REM GRID EQUATIO
 N=2Y+X/16-80 .
 20075 REM LOAD IN CHSET+STACKS+IMAGES
 20080 OPEN #IO,K4,K0,"D:BURGER.BIN":NU
 M=1032:PG=PGCHSET:GOSUB 20110:POSITION
 K2,10:? #K6;"CLEARING PM AREA";
 20085 B=(PGTOP-16)*256:FOR I=768 TO 20
 47:POKE B+I,K0:NEXT I:REM CLEAR PM ARE
 A
 20090 A=PGTOP-16:POKE 54279,A:POKE ON+
 132,A:POKE 559,62:POKE 53277,K3:POKE O
 N+K2,A:POKE 623,17:POKE 53260,208
 20095 A=A*256:FOR I=K0 TO 7:POKE A+I*3
 2+14,PGTOP-15:NEXT I:REM PG ADDRESS OF
  IMAGES
 20100 OFF=PEEK(ON+31)+PEEK(ON+32)*256:
 RETURN 
 20110 REM IO=(1=READ,2=WRITE)
 20120 REM PG=PAGE , NUM =# OF BYTES
 20130 IOCB=832+IO*16:POKE IOCB+K2,K3+K
 4*IO:POKE IOCB+K4,K0:POKE IOCB+K5,PG
 20140 I=INT(NUM/256):POKE IOCB+8,NUM-I
 *256:POKE IOCB+9,I
 20150 I=USR(ADR("hhh*LVd"),IO*16):CLOS
 E #IO:RETURN 
Line 20150

 20155 REM MAKE MHD RELOCATABLE
 20160 RESTORE 20170:FOR I=K1 TO 14:REA
 D A:POKE ON+A,PEEK(ON+A)-PEEK(ON+1011)
 +PG:NEXT I:POKE ON+1011,PG:RETURN 
 20170 DATA 243,246,270,503,524,652,662
 ,680,750,766,777,782,843,959

CHECKSUM DATA.
   (see CCHECK & DCHECK or UNICHECK)

 1 DATA 150,445,59,972,42,311,590,285,4
 99,481,318,484,332,324,920,6212
 184 DATA 222,626,598,651,401,10,899,50
 2,323,354,344,511,660,642,508,7251
 993 DATA 998,967,775,317,837,739,469,8
 01,488,390,677,954,898,833,780,10923
 1075 DATA 176,730,186,496,55,681,224,7
 99,797,361,227,104,201,119,895,6051
 7810 DATA 722,778,104,143,5,491,313,25
 ,989,142,673,586,173,352,619,6115
 8045 DATA 512,769,77,233,45,369,765,79
 5,262,939,914,724,391,777,367,7939
 8180 DATA 785,514,987,397,53,96,496,29
 8,959,919,538,949,605,842,882,9320
 9020 DATA 347,339,428,462,70,941,118,6
 6,915,464,343,511,44,592,606,6246
 20030 DATA 798,896,751,843,894,481,889
 ,814,665,406,834,714,396,496,954,10831
 20110 DATA 736,579,445,205,172,246,683
 ,42,3108

Listing 2C.

 20036 REM ADD TO BASIC BURGER FOR CASS
 ETTE SYSTEMS
 20037 POSITION 2,10:? #6;"MOUNT TAPE H
 IT KEY";
 20040 IO=1:OPEN #IO,4,128,"C":GOSUB 20
 110:GOSUB 20160
 20080 POKE 764,12:OPEN #IO,4,128,"C":N
 UM=1032:PG=PGCHSET:GOSUB 20110:POSITIO
 N 2,10:? #6;"CLEARING PM AREA  ";
 25000 REM MAKE TAPE BACKUP
 25010 IF PEEK(ON)<>216 THEN ? "RUN BAS
 IC BURGER BEFORE SAVEING":END
 25020 TRAP 25030:LPRINT :REM LPRINT BE
 FORE SAUE
 25030 TRAP 40000:? "MOUNT TAPE. HIT RE
 TURN"
 25040 CSAUE :IO=2:NUM=1012:POKE 764,12
 :OPEN #IO,8,128,"C":PG=PGTOP-8:GOSUB 2
 0110
 25050 NUM=1032:PG=PGCHSET:POKE 764,12:
 OPEN #IO,8,128,"C":GOSUB 20110


Previous | Next

Original text copyright 1984 by ANALOG Computing. Reprinted with permission by the Digital ANALOG Archive.