HOT PURSUIT for Sinclair ZX-81
by SA Nicholls
from Your Computer, May 1982


This program is entirely in machine code with just line 3 in Basic to
run it, and it will just fill the 1K ZX-81 including display. The
program also makes use of most of the 33 spare bytes from address 16444.

Is is a simple version of a maze chase. The display occupies 18 lines
by 17 columns and consists of five overlapping squares with a row of
inverse zeros in the last line for the score.

Five minus signs are then placed in the maze and one pound sign. The
minus signs will then move at random around the maze attempting to
corner and land on the pound sign. The pound sign is controlled by the
player and moves at twice the speed of the chasing minus signs. Any
key in the top row of the keyboard will move you up - any key in the
bottom row, except shift, will move you down. Any right-hand side key
in the middle two rows will move you right and any left-hand side key
in the middle two rows will move you left.

The movement of the minus signs is not entirely random, for once
moving in a certain direction they will continue to do so until they
meet a cross-over at which point they will choose a random change of
direction but not return on their original path. Each move of the
minus signs will increase the score which gives an indication of the
time you have survived in the maze.

Once your pound sign is captured, the game ends with a spectacular
flashing screen, where the display runs through the ZX-81 graphics and
inverse video set in about three seconds, and ends with your score
displayed.

Built into the game are five levels of play that can be accessed in
the following way:

The basic game as listed.

A game that does not allow you to reverse direction; ie. it erases the
maze as you travel but leaves a trail which the minus signs can follow
to rebuild the maze. Just type POKE 16881,155 as a direct command.

As game 1, but with speed constantly increasing after each move.
	POKE 16881,8   direct command
	POKE 16685,5   direct command

As game 2, but the speed increasing:
	POKE 16881,155 direct command
	POKE 16685,5   direct command

To change the constant speed of the game in options 1 and 2 POKE
address 16644 with any value from 1 to 100. A value less than 25 will
make it run faster and greater than 25 will run slower. Anything
greater than 100 is really too slow to play.

For anyone who has not tried loading a machine-code program, do not be
put off by the listing or the time taken - the end program justifies
this extra time and care. To start loading the program you will need
to work in the FAST mode. If you have the 16K RAM then set RAMtop to
1K, as the program will not work with a display file ready set up.
Then enter line 1 REM followed by 308 zeroes then line 2 REM followed
by 144 zeros. Unfortunately, the ZX-81 will not accept a single REM
statement with 452 zeros.

As a double-check to ensure that you have the correct number of zeros
in the REM statements, type:
	PRINT PEEK 16822  direct command
This should give an answer of 118, showing line 1 is correct. Then:
	PRINT PEEK 16825  direct command
This should give an answer of 146, showing line 2 is correct.

Then, still in FAST mode, enter the following hexadecimal loader
program:

10 LET X=16514
20 LET A$=""
30 IF A$="" THEN INPUT A$
40 IF A$="S" THEN STOP
50 POKE X,16*CODE A$+CODE A$(2)-476
60 PRINT AT 11,7;X;" ";A$(1 TO 2)
70 LET X=X+1
80 LET A$=A$(3 TO)
90 GO TO 30

RUN (in FAST)

You can now enter the hexadecimal codes as in the listing, either in
pairs or blocks; ie. 01 newline - 00 newline - FF newline or
0100FFFF1200EEFF newline and so on. Remember there are no spaces
between the codes. The hexadecimal loader program will give a display
of the last address and code entered so that you can check the listing
as you enter it.

I prefer to run in FAST mode because the screen flicker does give an
indication that an entry has been made without having to look up from
the list to check.

After the last entry, at address 16971, enter S to end. Now type the
only line of Basic necessary:
	3 RAND USR 16556
and delete lines 10 to 90 as these are no longer required.

The program is best saved at this point, before running, just in case
any incorrect entries have been made, which may result in loss of
program when run. Should the program fail to run, reload it and check
each address using the following Basic:

10 FOR X=16514 TO 16971
20 LET A=PEEK X
30 LET B=INT(A/16)
40 LET C=A-B*16
50 PRINT X;" ";CHR$ (B+28);CHR$ (C+28)
60 NEXT X

GO TO 10

Then, by the use of CONT, you can check through the listing for
errors, but remember, if correcting an error, then POKE the address
with the decimal value of the hexadecimal code. Conversions are at the
back of the Sinclair manual.

----------------------------------------------------------------------

