SPECTRUM CROSS
by Stuart Nicholls
from Your Computer January 1983

Stuart Nicholls' crocodiles and man-eating spiders
soon put a stop to uneventful commuting.


THIS GAMES program - written in machine
code and Basic - just fills a 16K Spectrum. It
makes full use of all the colours available and
all 21 user-definable graphics.
	The object of the game is to cross a busy
road and river to arrive safely home. The
graphics are flicker-free and move smoothly.
The graphics character for the man, however,
flashes to indicate position.
	The machine-code section of the program is
used to roll a screen line left or right - one
pixel at a time - to give the illusion of a
smooth flow of traffic. The machine code and
mnemonics that achieve this are shown in
Figure 1. This machine code is entered above
RAMtop and is held in DATA lines 70 to 140.
	The second set of DATA - that is, lines 180
to 270 - is for the user-defined graphics. It is
the easiest way to set them up. First, the start
address of the user-defined graphics is found
by PEEKing the system variable 23675/6, so it
is equally suitable for the 16K and 48K
Spectrum, and then all 168 bytes are entered,
starting from this address, in one FOR-NEXT
loop. It does seem rather long-winded to have
21 FOR-NEXT loops as suggested in the
Spectrum manual, when the addresses of the
user-defined graphics run consecutively.
	Once the program has been entered it is
advisable to SAVE it before RUNning just in
case a wrong machine-code DATA entry has
been made which may cause the program to
crash.
	Your man moves at a speed of eight pixels
per second and so can outrun all the traffic,
but be careful not to hit traffic from behind.
Use 0 to move right, 9 to move left, and 1 to
move up.
	A fanfare is played each time a home is filled
and 50 bonus points are given. Every time
four homes are filled an extra fanfare is played,
the homes empty, the speed increases - there
are three changes of speed - an extra random
position spider is added, and the game continues.
The spiders incidentally move in both
directions. A maximum of 10 spiders can be
placed on the central island, but I have not
managed that level myself yet.
	Each time your man is hit he will flash for a
few seconds to the sound of a rising beep and
then fall back down the screen to the base line
to the sound of a falling beep. The men-
counter will be reduced by one. The sub-
routine for this flash and beep - lines 25 and
30 - has been placed at the start of the listing
so that access time is reduced to a minimum.
The Spectrum searches through the listing
from the beginning each time a subroutine is
called and so, if placed at the end of the
program, it would take longer to locate, and
slow down the rate of flash and beep.
	At the end of the game, when all men are
lost, you are given the option to replay or end.
If the N key is pressed then RAMtop will be
reset to its normal value on both 16K and 48K
Spectrums and the program - including user-
defined graphics - will be erased from memory.
This is achieved in just one instruction
		RANDOMIZE USR 0
	One last useful feature of the Spectrum is
used to detect a hit. This is shown in line 690
when SCREEN$ will return a string containing a
space if there is no traffic in the next "PRINT
man" position or an empty string if the next
PRINT position is a user-defined graphic or part
of a user-defined graphic.
