MUNCHMAN
by Chris Bailey
from Your Computer, October 1983

ZX-81 MAZE CHASE

Speedy munchman Chris Bailey gobbles ghosts, pops power points
and feeds on fruit to clear 16K of ZX-81 screen.

THIS MACHINE CODE VERSION of the popular Pac-Man game for the ZX-81
contains the main features of the original, including power points and
fruit. The machine code is stored in a Rem statement 1025 bytes long.
This is obtained in the following way. First, enter the first line:
	1 REM 97 characters
Then, create lines 2 to 9 by editing line 1. Finally, obtain line 10
by editing line 1 and then adding one extra character. Now
	POKE 16510,0
	POKE 16511,3
	POKE 16512,4
thus creating one long Rem statement numbered 0, so that it cannot be
accidentally erased. Do not list this yet. To attempt to do so will
put the display into an endless loop.

Now enter listing 1. This is a hex loader and hex lister program which
works entirely in hexadecimal, including addresses. If the program is
Run it asks for the starting address in hex. The machine code in
listing 2 should now be entered starting with address 4082. A number
of hex numbers can be entered together but they must be entered as
pairs and not single characters. Once all the program has been
entered, type S to stop the hex loader and then Save the program a
couple of times on tape.

Now enter the following lines:
	1 SAVE "MUNCHMAN"
	2 POKE 16389,72
	3 CLS
	4 RAND USR 17192
and then delete the hex loader by entering the line numbers one by one
and pressing Newline. Now Running the program will Save the game and
then Run it. Before doing this, however, it is advisable to first
enter as a command
	RAND 65522
This is to ensure that a suitable number is in the random number seed.
Some numbers cause the program to crash. If the program now Runs
correctly, then you will now have a correct version recorded which
will auto-run when re-loaded. If not, then you will have to go back to
one of your original Saved versions to look for the mistake in the
machine code. Run 500 will produce a listing.

Lines 2 and 3 are necessary in the final program as the program was
originally written to fit into less than 2K and therefore uses the
minimum display file.

The actual game is started by pressing any key. The munchman appears
on the screen as an inverse M. He is steered around the maze by the
method first shown in Toni Baker's Mastering Machine Code on the
ZX-81. The top line of keys moves him up, the bottom line moves him
down, and the two middle lines are split so that the left hand half
moves him left and the right hand half moves him right.

Collision with a ghost means instant death. The munchman's only
advantage is his speed and his ability to go through the tunnel. One
point is scored for each star eaten. Clearing a screen will result in
it being filled again.

Four times during each screen either fruit, represented by an inverse
F, or a power point, represented by a $ will appear underneath the
ghosts' nest. Eating fruit scores 10 points. Eating power points
scores 5 points, but also causes the ghosts to change so that they can
now be eaten by the munchman. Each ghost eaten scores 20 points. All
of these chances to score only last for about 10 seconds so you have
to move fast.

At the end, the game is restarted by touching any key.


