SURVIVOR GRAPHICS LOADER (16K ZX81)
by Darren Spriddell
from Your Computer (June 1985), Pages 76-77

By combining the program given here with the game Survivor published in the
May edition of Your Computer, you can amend or completely rewrite any or
all of the levels to your own personal requirements.

Before using it, however, some words of explanation are called for. Each
screen consists of a playing area 28 by 17 surrounded by a grey border with
Bonus, Lives and Time displayed below. Around this the Title is scrolled.
Data is needed for each level to store the title and playing area. As long
as you stay within the constraints of the system, what is put into this
playing area is limited only by your own imagination.

The display consists of black blocks on a white background; two grey lines
of any length and direction; five aliens moving in any direction either
reversing or one way only; five aliens which are stationary but flash on
and off. Almost any character may be used for an alien - only four will not
kill you. Bridges and elevators are made from a moving alien of CHR$ 128.

You must use all ten aliens and both grey lines in each level. Unwanted
grey lines can be hidden in the border and excess aliens can be "lost" by
making them white spaces in a white area. Aliens always unprint leaving a
white trail. Remember this if you are moving them through black or grey
blocks. Forty-three characters must be used for the title. Letters and
graphics may be mixed, padded out with spaces to the correct length. You
are allowed only one Exit although several Keys are possible by using CHR$
151 for aliens.

I consider it absolutely essential to work out ideas on squared paper
first. A pad of Quadrille from W H Smith's is invaluable here. Copy the
grid from the diagram and plan your strategy carefully. Ensure that all
intended jumps are possible. Remember you can only jump up four squares
vertically or diagonally.

When you are satisfied that the drawing has been perfected it must be
converted into data. This is done by the graphics loader in two parts.
Firstly the black blocks for the screen are drawn directly and then
compressed by the machine-code section. The second stage is concerned with
the grey lines and aliens etc., and uses the Basic program. Everything must
be worked out using grid references and character codes before any attempt
is made to input a level.

Load the program from tape. It should auto-run and ask for a level number
between one and 10. You may enter levels in any sequence. You are then
given the option of drawing a new level or amending an existing one. If you
answer "yes" to the prompt the drawing section will be bypassed allowing
new data for aliens etc., to be entered.

Answering "no" will put the computer into "wait mode". If you proceed
beyond this point, all existing screen data for the level chosen will be
wiped out. You may abort at this point by using the Break key. Assuming you
wish to proceed, pressing N/L will produce the Drawing Board.

The cursor is moved horizontally by keys I and P; vertically by keys Q and
Z. Pressing 0 will deposit or erase a block. After completing the drawing,
check it carefully as mistakes cannot be rectified without redrawing the
whole picture. When you are satisfied that it is accurate press N/L and the
screen will be converted into data. The program will now return to Basic
and request information regarding the grey lines.

This second part of the loader will accept grid references and graphic
characters in the form of strings, or numbers as variables.

Using "Aboard the Fluyt" as shown in diagram 1 it can be been that the grey
lines run from S3 nine spaces to the right and from SQ five spaces to the
right. Data for these is made up from the grid reference for the starting
square followed by the number to be added or subtracted in order to reach
the next square - for a vertical line 33, a diagonal line 32 or 34 and a
horizontal line, as we have here, 1. Lastly we need the length of the line.
So, data for the first line is S3 1 9 and for the second SQ 1 5. A grid
reference must always be given vertical axis first. To input this, enter S3
and press N/L. Press N/ L again to change to a numeral input. Enter 1 N/L,
N/L a second time to recover the input and 9 N/L. Enter data for the second
line in the same way.

You should now be asked for Key, Position and Exit locations. The key is a
grid reference - CM. Enter and press N/L. Your starting position is EB.
Enter and press N/L. The exit is R3. Once again enter and press N/L. Now
comes the title. Enter this as a string of 43 characters and press N/L. If
the length was correct it will be printed on screen. If this does not
happen, you will have to re-enter it correctly.

The next prompt is for the five moving aliens. Three grid references are
needed to define each alien's position. The first is the starting square.
For the Guard on the upper deck this is L7. The next two are the extremes
of movement with - most important - the highest given first. That is, the
position nearest to the bottom right of the screen must be entered before
the position nearest to the top left.

This guard moves from L5 to LA so data will be L7 LA L5 pressing N/L
between each. The next four characters are entered as a block and are
arrived at as follows:

- Character of alien when moving from a high position to a lower position
  on screen.
- Character of alien when moving in the reverse direction.
- In the case of the guard, both are the letter I.

Next the direction in which the alien first moves; this is entered as a
graphic and is either a space or CHR$ 1 dependent on whether it moves from a
high to low position (CHR$ 1) or vice versa (CHR$ 0). Lastly the number of
squares which need to be added or subtracted to reach the next position as
it was with the grey lines, only this time entered as a graphic - CHR$ 1, 4,
5 or 6. - see your ZX-81 manual.

So we have the four characters. Enter 'I' 'I' 'graphic-1' 'graphic-1'
together and press N/L. Repeat for the other four moving aliens.

The five flashing aliens are defined by one grid reference followed by a
block of three graphics each.

The first is the character initially, the second the character it turns
into. For the Fluyt, all turn into white spaces although any of them could
equally turn into black blocks or another character entirely. The last
graphic is concerned with the time each character is flashed on and off,
and could be one of four symbols. If you mentally divide the flashing cycle
into four periods:

CHR$ 0 will print the first character for two periods.
CHR$ 1 will print the second character for two periods.
CHR$ 2 will print the first character for one period.
CHR$ 3 will print the second character for one period.

When you have finished with the loader, save the game by typing Run.

Do not test a new level with endless lives. If you have created a loop, you
will be stuck in it for ever. Make sure that the Break key is operational -
see parameters table in part 1. If you want to limit the game to fewer than
10 levels, Poke 19198, followed by the number of levels required.

The best thing to do with errors is to avoid them and get your data
accurate. Remember, this is being used by a machine-code program. If your
data does not make sense to the computer, it will crash.

In spite of all your efforts, mistakes will probably occur. In any case you
may wish to alter something to make the game harder or easier. This can be
done. Run 18 will restart the loader to enable corrections to be made. If
you make an error whilst inputting data, enter "Restart" in answer to any
prompt. This will take you to the same correction routine as would
answering "Yes" to the option for amending data given at the outset. You
will then be asked for the byte number of the section to be corrected - see
table 3.

Table 3:

To correct        Byte no.
GREY LINES        68
KEY               76
POSITION          78
EXIT              80
TITLE             82
MOVING ALIENS     125
FLASHING ALIENS   175

High quality tape copies of the original Survivor containing a full 50
levels to test your powers - no one has yet reached the 51st screen - or
the 10-level version with graphics loader for use in conjunction with this
article are available from the author D Spriddell, Cherry Tree Cottage,
Common Road, Hopton, Diss, Norfolk IP22 2QU, price 3.50 each including
postage. Please state which you require. [It's unlikely tapes are still
available! PF]
