INTRODUCTION

To further demonstrate the versatility of the flicker-free mechanism I've produced this version of the arcade classic Donkey Kong for the 4K ROM ZX80. A version to run on the ZX80 fitted with the 8K ROM upgrade is also available. Like Pacman, the game uses concepts based on those found in Macronics' 3K Space Invaders game. It consists of all original code and extends upon the techniques developed for Pacman. The game requires 16K of RAM, and will automatically detect and configure itself to run on either a UK (50 Hz) or USA (60 Hz) version of the ZX80.

A video of the game running on a real ZX80 can be viewed on YouTube.

The game file is available from the downloads section.


DESCRIPTION

The game implements a fully featured version of Donkey Kong, and incorporates all four levels of the original Japanese version. The game supports a screen display of 24 rows by 31 columns.


Title screenshot of ZX80 Kong
Level 1 screenshot of ZX80 Kong Level 2 Screenshot of ZX80 Kong
Level 3 screenshot of ZX80 Kong Level 4 Screenshot of ZX80 Kong

Kong has taken your fiancé and is holding her captive in a building. You must chase him up the building, defeat him and rescue her. You are represented by an inverse 'M' and your fiancé by an inverse 'R'. There are four levels to battle through, and you have only three attempts. Kong will use any obstacle he can find to try and stop you. He will throw barrels at you (represented by 'O') and will unleash deadly roaming fireballs (represented by '*'). You can defend yourself against these by picking up a hammer (represented by a 'T'), but it will only remain useful for a short period of time.

Level 1 - You must climb up a set of girders using the ladders linking them together. Kong will throw barrels at you, which you must either jump over or smash with a hammer, and you will be chased by fireballs. You score 100 points for jumping over a barrel or fireball, and score 300 points for smashing them using a hammer.

Level 2 - You find yourself in a factory manufacturering cement. Conveyor belts carry pans of cement and you must avoid these as you make your way up. Fireballs will again chase you, and hammers can be picked up to defend yourself against the fireballs and cement pans. At the top of the level are retractable ladders which will slow your ascent. The conveyor belts will drag to with them but you can move against the direction of travel by jumping along. You score 100 points for jumping over a cement pan or 300 points for smashing it with a hammer.

Level 3 - Use the elevators to make your way across the screen, but be sure to get off before in time. Metal springs will drop down the screen and fireballs will once more roam around trying to catch you.

Level 4 - There are eight rivets holdig up a set of girders. Move across a rivet to remove it. Once all rivets have been removed, the girders will fall and Kong will go tumbling down with them. You will then be reunited with your financé. Yet again there are fireballs to avoid and hammers you can pick up to defend yourself with.

Along the way you will come across valuables dropped by your fiancé, and you can pick these up to collect extra points. To make matters more difficult, you are also up against a time limit. A 'bonus' timer will decrement from 10,000. If it reaches zero you will lose a life; if you complete the level then your score will be increased by the time remaining. After all four levels have been completed, Kong will recapture your fiancé and you rescue her again. If you score over 900,000 by the end of a round then the game is won. The program will keep track of the highest score achieved and this is displayed both on the title screen and in the top left hand corner of each level.

The game can be played using either the cursor keys (5 for left, 6 for down, 7 for up and 8 for right, 0 for jump), Sinclair joystick/keys (6 for left, 7 for right, 8 for down, 9 for down, 0 for jump), or a Kempston joystick. Press key C to cycle through the control options.


MACHINE CODE STORAGE

The game is written entirely in machine code, and this is held in a single giant REM statement. Storing machine code within a REM statement introduces a problem in that the ZX80 generally cannot list a BASIC program containing such a line. A system crash is likely to occur if the machine code contains any bytes that would be translated into non-displayable characters by the BASIC editor. Further, if the machine code contains a newline character (code $76) then the BASIC listing will be displayed incorrectly and subsequent lines cannot be edited. A crash may also occur. This problem is due to the ZX80 mistakenly assuming the newline character denotes the end of the REM statement. The bytes that follow the newline character are therefore interpreted as the start of the next line, and it is very unlikely that these bytes will (by chance) form a valid BASIC line. Both issues only cause a problem if the REM statement is listed, but storing the machine code in the first BASIC line is not practical since the ZX80 will automatically list a program once loaded from cassette. A way to overcome this problem is to add a sufficient number of BASIC lines before the REM containing the machine code. In this way, the listing is displayed after loading will only consist of standard BASIC lines. This is the approach used in ZX80 Kong.

When first run, the game performs an integrity test to ensure that it has loaded from cassette correctly. If an error is detected then a return to BASIC is made and an error message displayed.


GAME OPERATION

The game is structured so that each level is executed in seven blocks of program functionality. These blocks are cycled through, with one block executed per TV field. Some of the functionality blocks are common to all levels, with others specific to particular levels only. The functionality blocks for each level are shown below.

Level 1:

Level 2:

Level 3:

Level 4:

A program cycle consists of executing all of the blocks of program functionality for a level. A couple of flags may be set by a block of functionality and these flags will be tested at the start of each program cycle. Teh flags are used to indicate whether the player has lost a life, or whether the current level has been completed. This approach allows a program cycle to complete within a fixed length of time and for special circumstances to be handled at a single point within the program.

Read keyboard and move player - This routine determines whether any of the selected control keys have been pressed and moves the player in the new direction as appropriate. A state machine is implemented to track the status of the player and the following states are possible:

After each move of the player, tests are performed to check whether a collision has occurred with another object or whether the player has changed to one of the other states. If a collision is detected then a flag is set to indicate this and it will be detected within the main program loop.

Animate barrels - This routine controls the state of one or more barrels, handling the direction it is rolling in and whether it is dropping down a ladder. It also handles the movement of the first barrel that Kong drops and which will release the fireballs when it hits the oil drum. At each move, a test is made to see if the barrel is above a ladder and a random decision taken to control whether the barrel should drop down it. Checks are also performed to see if the player has been hit or whether a collision with a hammer has occurred. If a hammer was hit then the barrel is made inactive and removed from the screen. If a barrel encounters another barrel or a fireball then it will not be moved until the path ahead is clear. As each new girder is reached, the barrel changes its horizontal direction and if it reaches a level below the player then it will simply drop off the end of the current girder. This is done to allow Kong to release a new barrel since the number of concurrent active barrels is limited to only 5. It also ensures that the majority of barrels are ahead of the player, thereby making the game more difficult.

Animate fireballs - This routine controls the state of one or move fireballs, handling the direction it is moving in and whether to move up or down a ladder. On level 1 the fireballs are not released until the first barrel has hit the oil drum, and then random timers are used to determine when each fireball is activated. On the other levels, these timers are initialised directly at the start of the level and so the release of the fireballs is not dependent on any other activity. Fireballs can move up or down ladders and so tests are performed to see if the fireball is above a ladder or at the foot of a ladder. If it is then a random decision is taken whether to use the ladder. Tests are made to see whether the fireball has hit the player or if a collision with a hammer has occurred. If a hammer was hit then the fireball is removed from the screen, set inactive and it's release timer reset with a new random value. A fireball can move past another fireball or a barrel, and this is achieved by temporarily making the fireball invisible thereby allowing other objects to move past it.

Animate cement pies - This routine controls the state of the cement pies that move along the three conveyor belts in level 2. Only one cement pie is ever active at a time on each conveyor belt, and is activated using a release timer set with a random value. Since the cement pies move in a fixed direction, a more limited set of checks is required for them than is needed for barrels or fireballs. A test is made to see whether the player has been hit or whether a collision with a hammer has occurred. If a hammer was hit then the cement pie is removed from the screen, set inactive and its release timer reset with a new random value. This set of actions will also occur if the cement pie reaches the end of the conveyor belt. A cement pie cannot move past a fireball but must instead wait for the fireball to detect the collision and set itself temporarily invisible; the cement pie can then move past it on the next cycle.

Animate Kong - There are three different handler routines for animating Kong - one for level 1, one for level 2 and one used for both levels 3 and 4. Each handler routine implements a state machine to control the animation of Kong. A delay timer is used to control the speed at which transitions between states occurs, and will be set according to the actual transition in progress.

The level 1 handler animates Kong selecting and releasing barrels, and uses the following states:

The level 2 handler animates Kong stepping back and forth across the top girder and then waiting as the ladders extend and retract below him. It uses the following states:

The level 3/4 handler animates Kong standing still but shaking his fists, and uses the following states:

Animate elevators and bouncing spring - This routine controls the state of both elevators and the bouncing spring on level 3. The elevators are moved at half the cycle rate, i.e. twice as slow as the player; the spring moves at double the cycle rate, i.e. twice as fast as the player. The elevators must check whether the player is on one of their platforms and hence whether to shift the player up or down at each move. The spring follows a pre-defined path and will initially be released after a random delay. Thereafter a new spring is released as soon as the previous has dropped off the screen.

Animate hammer - This routine controls the state of the hammer. If the hammer is inactive then no action is performed. If it is active then its position is toggled from above the player to in front of the player (defined by the last horizontal direction the player moved in). The hammer is moved at twice the cycle rate, i.e. twice as fast as the player, and this ensures that the hammer will hit any objects dropping down on the player from above or moving toward them from ahead. If a barrel, fireball or cement pie is encountered then the score for the hit is recorded and this will be added to the displayed score during the miscellaneous activities functionality block (described below). Once grabbed, a hammer becomes active when the player lands back on the girder and will remain active for a duration of approximately 8 seconds.

Miscellaneous activities - This routine handles a variety of tasks. It performs a second update of the hammer (if active) to achieve the double speed movement. It also checks whether an update of the displayed score is required, and is responsible for decrementing the bonus timer. It also controls the state machine which determines when the fiancé screams.

Start of program cycle tasks - At the start of each program cycle the various flags and counters that the blocks of program functionality may have set are checked. A test is made to see whether the level has been completed and hence whether to progress to the next level or round. A check is performed to see whether the player has lost a life or whether they have won the game by scoring more than 900,000 by the end of a round.

Animation sequences - The game also includes a start of game animation (showing Kong climbing the girders of level 1), end of level animations (showing Kong climbing to the next level), and an end of round animation (showing Kong falling down). These are handled by a separate animation display loop.


DOWNLOADS

I have produced two versions of the game - one for the ZX80 with its original 4K ROM and one for ZX80 fitted with the 8K ROM upgrade. The 8K ROM version will also run on the ZX81. The two versions differ only with regard to the video display loop, character codes and the BASIC program.

Both game versions can be downloaded below, and are made available for private use or for public demonstrations. They are not to be included in emulator distributions or sold as part of a commercial package. Please do not re-distribute the program files but link to this site instead.

Click here to download 16K ZX80 (4K ROM) Kong in .O program format. Run the game using RUN. [Version 1.02]
Click here to download ZX80 (8K ROM) / ZX81 Kong in .P and .P81 program format. The file name is "ZX81 KONG". [Version 1.01]

I have produced a small batch of cassettes with printed inlay cards and labels for the ZX80 Kong game. Two versions exists - one for the 4K ROM ZX80 and one for 8K ROM ZX80 / ZX81. Please contact me if you are interested in obtaining a copy of either cassette. The 4K ROM version is shown below.



If you have a Spectrum 128 or +2 and an Interface 2 then you can use the 4K ROM ZX80 Kong game with my ZX80 Emulator ROM cartridge.


Contact Me
  -   Disclaimer