INTRODUCTION

To demonstrate the versatility of the flicker-free mechanism I've produced this version of the arcade classic Pacman for the 4K ROM ZX80. A version to run on the ZX80 fitted with the 8K ROM upgrade is also available. The game uses concepts based on those found in Macronics' 3K Space Intruders game. However, all program code has been written from scratch, which has allowed the opportunity to incorporate improvements to the techniques. The game requires a minimum of 8K 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.


DESCRIPTION

The game implements a fully featured version of Pacman, supporting a screen display of 24 rows by 31 columns. Only 31 of the possible 32 columns are used to ensure that the maze is symmetrical.


Title screenshot of ZX80 Pacman Screenshot of ZX80 Pacman

Pacman, represented by an inverse 'O', must travel around the maze eating all the dots (worth 1 point each). He will be chased by four ghosts. If they catch him then one of the three lives is lost. If all lives are lost the game is over, and a return is made to the title screen. To even up the odds, the maze contains four power pills, situated in the four corners (worth 10 points each). If Pacman eats one of these then for a short period of time he can chase the ghosts. Catching one ghost scores 100 points, the second is worth 200 points, the third 400 points and the fourth 800 points. If a ghost is caught then its eyes float back to the cage before the game continues. Each ghost employees a different hunting stragety to make game play less predictable.

At random, a money bonus will appear below the ghosts' cage but will only remain available for a brief period of time. A dollar bonus is worth 30 points, a pound bonus is worth 50 points, and a mystery bonus (represented by a question mark) is worth is random number of points. The Pacman and ghosts can make use of the tunnels leading off the sides of the screen and will reappear at the opposite side. An extra life is awarded for every 10,000 points collected and the game is won if a score of 100,000 is reached. The game keeps track of the highest score achieved and this is displayed both on the title screen and in the bottom right hand corner of the game screen. Once a maze has been cleared, a new identical maze commences but with reduce duration of the power pills.

The game can be played using a variety of key and joystick options. Press key C on the title screen to cycle through the available controls.

The game is written entirely in machine code, and uses the technique developed by Martin Knorth to auto-run upon loading. It first performs an integrity test to ensure that it has loaded from cassette correctly and should an error be detected then a return to BASIC is made and an error message displayed.


GAME OPERATION

The game is structured to execute in six blocks of program functionality. These blocks are cycled through, with one block executed per TV field. The functionality blocks perform the following actions:

After eating a power pill, the cycle increases to seven blocks of program functionality. An additional read of the keyboard and moving of Pacman occurs in between moving the second and third ghosts.

A program cycle consists of cycling through all of the blocks of program functionality. At the start of a program cycle a variety of flags are tested. These flags are set by the functionality blocks from the previous program cycle. These flags test for conditions such as whether to display the score for a bonus, whether the game has been won, whether Pacman has been caught, and whether an extra life was awarded. The blocks of program functionality therefore determine whether any of these conditions has occurred and simply set flags to indicate this. This approach allows a program cycle to complete before further actions occur.

Miscellaneous activities - This routine handles several tasks. First it decrements the countdown timer that determines when a money bonus will be shown. When it expires, the routine displays the bonus, and sets a countdown with a random duration for when to remove the bonus from the screen. This routine is also responsible for checking whether to open or close the cage door. The door will be closed once all ghosts have left it. If one or more ghosts are locked in then the door will open after a random duration has expired. Next the routine tests whether the ghosts are in 'flee' mode and if so it will flash them. Finally, the routine decrements the countdown timer for a power pill if there is one active.

Read keyboard and move Pacman - This routine determines whether any of the cursor keys have been pressed and attempts to move Pacman in the new direction. Pacman will continue to move in the direction he is travelling until either a wall is encountered or the player selects a new direction. If Pacman can move (either in the new direction selected or continue in the current direction) then a test is made to see whether he has eaten a bonus, or a dot, or a power pill. If a bonus was encountered then the score is increased appropriately and a new timer is set to a random value for when to shown the next bonus. If a dot was eaten then the score increments and a test is made to see whether all dots in the maze have been eaten. If they have then a new round is begun, but with a reduce power pill duration. If a power pill was eaten then the ghosts are set into 'flee' mode and Pacman can chase them until this timer expires. If neither a bonus, dot, or a power pill was found then a test is made to see whether Pacman has encountered a ghost. If he has then a test is made to see whether the ghosts are in 'hunt' mode or 'flee' mode and a group of flags are set appropriately. These flags will be tested at the start of the next program cycle, thereby allowing Pacman and all the ghosts to be updated first. If the countdown timer for an active power pill is about to expire then this routine is responsible for flashing Pacman to indicate this condition.

Move ghost n - This routine is used to move a particular ghost. Each ghost has its own hunting strategy, loosely based on those in the original arcade game. The routine begins by checking whether the ghost is in the cage and if so whether the cage door is open. If it is then the ghost will be moved upwards. If the ghost is outside the cage then the routine determines which directions are available for the ghost to move in. The ghost is only allowed to reverse its current direction if there are no other available directions to move in, e.g. other ghosts or walls block the way. If in 'hunt' mode, the direction select is based on the hunting stragety and the available directions. If in 'flee' mode then the opposite direction is preferred. The ghost is then moved and a check made to see whether it has caught Pacman, or been caught by Pacman. Status flags are set as appropriate.

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 player has exceeded a 10,000 point threshold, and hence whether to award an extra life. Another test checks whether all of the dots have been eaten and if they have then a new maze is commenced. A check is also made to see whether the player has scored 100,000 or more, and hence whether the game has been won. Another test checks whether Pacman has been caught by a ghost and if so a life is decremented. Tests are made to see whether a money bonus was earned or whether a ghost was caught, and hence whether to display the points awarded for these. A separate display loop is used to shows the awarded points. If a ghost was caught by Pacman then a further display loop is used to animate moving the ghost's eyes back to the cage.


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 functionality of the two versions differs only with regard to the video display loop and character codes.

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 without explicit written permission. Please do not re-distribute the program files but link to this site instead. Should you like it and wish to make a small payment for the download then any amount would be appreciated and can be done using the Donate link at the bottom right.

Click here to download ZX80 (4K ROM) Pacman in .O program format. [Version 1.06]
Click here to download ZX80 (8K ROM) Pacman in .P and .P81 program formats. The file name is "PACMAN". [Version 1.04]

The game to be played in colour via the Chroma 80 SCART interface:

Click here to download ZX80 Pacman colourisation file.

There has been a number of updates to the game since its release, with a major update occurring in 2020 for the physical release on cassette by Cronosoft. The cassette contains both the 4K and the 8K ROM versions. The 8K ROM version of the game was originally branded as "ZX81 Pacman" but renamed as "ZX80 8K ROM Pacman" to better reflect its intended target machine. However, it will still run on the ZX81. The 4K ROM version features a custom loader routine, based upon the Volume Tester Utility, to provide visual feedback when loading the game. Both versions include a colourisation routine to allow the game to be played in colour via the Chroma 80 SCART interface, and they set up the colour scheme as per the colourisation file linked to above. The cassette is only available direct from Cronosoft. A photo of it can be seen below:


ZX80 Pacman Cronosoft Cassette Photo

When the game was originally released, I produced a small batch of cassettes (one cassette for the 4K ROM ZX80 and another for 8K ROM ZX80 / ZX81). The 4K ROM version is shown below.

ZX80 Pacman Lightning Software Cassette Photo

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