YOUR COMPUTER, April 1983
=========================


CHASER (aka. Death Duel)
------
Force your opponent into a corner  that is your goal in this interactive
game by Andrew Foord for the 16K ZX Spectrum.

Two people can play simultaneously using the keyboard  instructions are
shown in the program. The players shoot along the grid leaving a trail of
deadly orgone energy in their wakes. This manifests itself on the screen as a
wall. To survive you must force your antagonist to career helplessly into
either your wake or his own: both will prove equally fatal. The program gives
a view of the action  looking from an angle of 45  by using BRIGHT to make
the top of the trail brighter than the front. The player to win is the first
to achieve a score of 10. Different trace elements can be injected into the
energy conversion cycle of your overlander to alter the colour of the
exhausted field of primary energy you leave in your wake. You can have any
colour you want as long as it is not black. To make the game really confusing
the two players can even be the same colour.


**********************************************************************


RHYTHM GENERATOR (aka. Drumbeat)
----------------
David Squires, St Andrews, Fife.

THIS SHORT program, written for either version of the ZX Spectrum, expands
the idea of machine-code sound effects to produce a rhythm generator.
It is deliberately not too long or elaborate as this would mean losing some
of the speed so essential to the program. The program itself suffers from the
Spectrums usual lack of volume but even without headphones or amplification,
some fairly impressive rhythms can be produced.
You have two instruments at your command; the bass drum and sidedrum with
snare. When the program is run, it asks you for first the length of the note
of the bass drum, then the length of the note of the snare drum. It then asks
you for the number of bars the rhythm is to be played and finally the rhythm
the machine is to play each bar. This is fed into the computer as a string of
letters, with B for a note on the bass drum and S for a note on the snare
drum. The other letter that can be input is P, for pause. Two or more can be
written for longer pauses. Therefore BBSSPPSBBP would be read as two notes on
the bass, then two on the snare, a short pause, another on the snare, two
more on the bass and finally a very short pause.
Incidentally, if you are using headphones or amplification, the MIC socket
gives a more faithful reproduction of the sound you hear from the Spectrums
own speaker but the EAR socket gives a sharper, louder, more percussive sound.


**********************************************************************


SPACE CHASE
-----------
TahirAbbas, Edinburgh.

IN THIS GAME for the 48K Spectrum, you shoot down 10 alien craft before they
reach the safe zone. You are looking out of your cockpit window and have to
line them up in your sights and fire your lasers. If they reach the safe zone
then you have failed. The bottom of the screen displays time left and craft
shot down.

To fly your ship use these keys:
	Up      7
	Down    6
	Left    5
	Right   8
	Fire    0

This program uses three machine-code routines. The first of these copies the
screen into another part of the memory. It acts as a kind of CLS but it
recalls the saved screen only, clearing everything else on the screen.
Register HL holds the location where the copy starts. Register DE holds
location where screen is mOved to. Register BC holds the amount of bytes to
be transferred. LDIR carries out the task of moving the block of memory.

The next machine-code routine enhances the Spectrum's sounds. It uses the
Spectrum's sound routine in the ROM. Register DE holds duration of the note;
register HL holds pitch of the note; and register B controls the loop.

The final machine-code routine prints out the explosion. The data for the
explosion is held in Location 40051 onwards. All the machine-code routines
are held in DATA statements within the program, so there is no need to load
them separately in the Spectrum. The sound routine used in this program was
developed from the sound routine printed in November's Your computer.

Once you have mastered the game as it stands, you can make it more difficult
by reducing the time variable "ti" in line 300.

Space Chase program construction.
  10 TO 195  - SCREEN CONSTRUCTION.
 200 TO 202  -- LOAD DATA FOR SOUND AND SCREEN ROUTINES.
 300 TO 305  -- VARIABLES.
 500 TO 560  -- PRINT ALIEN CRAFT & MOVEMENT OF YOUR CRAFT.
 605 TO 700  -- FIRE LASER.
 800 TO 860  -- EXPLOSION & SOUNDS.
 905 TO 980  -- PRINT STARS.
1000 TO 9020 -- END OF GAME ROUTINE & DATA.

Space Chase graphics.
xxxx ---- ABCD LINES 505 & 605
x    ---- E    CHR$ 148
x    ---- F    LINE 965
x    ---- G    LINE 967


**********************************************************************


SPECSOUND
---------
From laser explosions to ducks quacking, Ronald Seniscal's complex sound
generator provides the special effects - without interrupting your games
program and without special circuitry.

THIS PROGRAM produces a variety of sounds at the same time as executing
instructions of a program completely separate from it. It is self contained,
so that a program written with it can run on any 48K Spectrum.

To do this I used the Z-80 interrupt mode 2. First of all, prepare a tape
ready to record the program on, and then type in the listing in Figure 1.
This is the editor which creates the sounds used in a program. There is an
extra line to be inserted in the program missing from the listing printed. It
is:
	755 SAVE "Specsound" CODE 65002,271: PAUSE 50

It is important that you check your typing against the listing again when you
have finished, to make sure there are no POKE errors, which could crash the
program. Do not run the program at this stage, as it contains calls to a
machine-code routine you have not yet put in. When you are satisfied with
your typing save a copy of the program by typing in:
	SAVE "Specsound2" LINE 1
and VERIFY it. Leave the tape in position after verifying.

Now clear the machine by typing:
	PRINT USR 0
and input the listing in Figure 2. Again when you have finished, check each
number against the listing.

Now RUN the program. The location and contents of the addresses POKEd into
will be scrolled up the screen. When it is finished, before saving it, look
at location 65271 on the left and check that it holds the number 251. If
there is anything other than that there, you have probably put an extra
number in the DATA statements, or left one out. Go back and check it again.

Now press a key to save this code straight after the BASIC editor. You have
now finished the entire program. After doing that, use as a command
	PAUSE 50: PRINT USR 65002
One second later, the number nine should appear and there will be a slight
clicking noise. If anything else happens, there is an error.

Clear the machine again  after verifying the code  and load the entire
program in from the beginning. The second part will be automatically loaded
after the first, and then it will auto-run.

You will see nine numbers, with their names, and a cursor. The cursor is
moved by the up and down cursor keys. While the cursor is pointing to a
number, that number can be changed. This is done by pressing the left cursor
to decrement, and the right cursor to increment. To change more quickly use
the 4 key to decrease by 10 and 9 to increase by 10. You cannot go beyond the
values 0-255, and the program protects against this.

These numbers actually form a part of the machine code and it is by changing
these that you change the sound. To hear a sound at any time, press P. You
can do this while another sound is still being put out without danger of
crashing.

Now the names to which the numbers are related. First is the starting point.
If you think of a complete sound as having a value of 255, changing it to 127
would mean that you would hear it from halfway through compared to the first
version.

Second is speed. 0 is the fastest here, and higher values mean the same sound
is produced, but more drawn out.

The next four values act against each other inside the routine. The first two
control the length and frequency of the click being produced, and the second
the gap between the clicks. To find out more about these, experiment with
them, but the second number of each pair is usually set to 255. To avoid
doing this manually, press T.

The next two should be set either to 1 or 0 as anything over 1 will be taken
to mean 1. The first one, if set to 0, causes the pitch to rise. Setting this
to 1 does the opposite. The second variable does the same for the silences
between the clicks.

The last variable determines the actual quality of the sound, as balanced
against the speed penalty. A program requiring high-quality sound will run
more slowly than one which is not as critical. Setting 1 is awful, and should
not be used; 6 is highest and sounds like a custom-built generator but runs
at only 10 percent of normal speed so should only be used in machine-code
programs. A useful compromise is 2. Anything over 6 is for special effects.
Try it and see.

Technically this number is used as the high byte of a number which is
decreased by one when a sound or gap is put out, returning when zero, so six
times 256+255 or 1,791 clicks can be put out every interrupt. This is why
everything slows down so much when using this number in the length of
interrupt variable. 0 is not really useful so the routine sets it to 5.

Of course, one sound is not much good on its own, so room has been made for
28 of them. The red number in the top left of the screen is the field number
 0 to 27  and is changed by pressing C and then the number of the field you
want to work on. A field is unchanged when you are not actually working on
it, so you can go back to it at any time. Pressing M moves one field to
another. Give the start field and the destination; the field will be copied
and the one put on the screen for you to work on will be the new copy.

To make more copies of this program use GOTO 1000. Both parts of the routine
will be automatically Saved. Do not use any PRINT commands, as the numbers
are stored in the printer buffer.

It is recommended that you play around with this routine for a while before
actually incorporating any sounds into a program of your own. When you are
ready to do this, use the following as guidelines.

Calculate how many sounds you want in a program, and write down the number 
starting at 0  and a description of the sound, that is, what it is meant to
represent. Write your game with this in mind.

Inside your program, when you want a sound to be produced at a particular
point, just POKE the field number into 65186 and then use the instruction:
	LET sd=USR 65002
While writing these put a REM in front of them so that if you accidentally
RUN it, it will not try and execute these instructions. Remember to remove
them when the machine-code routine is in place. At the start of your program
put these commands:
	CLEAR 64980: LOAD "Specsound" CODE: LOAD "" CODE
and then SAVE the program, keeping the tape positioned after the item you
have just saved.

Load the editor and create the sounds you want as shown above. When you have
finished, press S and then the first field number you want saving, then the
last and finally the name. The machine-code routine will then be copied onto
tape, followed by the sounds, and that is all there is to it.

It is possible to SAVE and LOAD before a sound has finished. The sound will
stop for the duration of these commands, but resume where it left off
afterwards. LIST and EDIT can all be performed during sound production. To
stop a sound, select a field which is blank and make it produce that sound


**********************************************************************


