home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Magazyn Internet 2000 December
/
MICD_2000_12_NR1.iso
/
Zx
/
doc
/
man128.txt
< prev
next >
Wrap
Text File
|
2000-11-07
|
52KB
|
1,298 lines
----------------------
--------------------------------------
============================================
Sinclair ZX Spectrum 128 Introductory Manual
============================================
--------------------------------------
----------------------
ASCII text version created by Damien Burke
Visit my Spectrum web pages at:
http://www.jetman.dircon.co.uk/speccy/index.html
Including a HTML version of this manual at:
http://www.jetman.dircon.co.uk/speccy/128manua/index.html
This manual remains
Copyright (c) 1986 Amstrad
Thanks to Cliff Lawson at Amstrad for distribution permission.
- Front cover -------------------------------------------------- Front cover -
sinclair
ZX Spectrum 128
Introduction
/////
- Page 1 ------------------------------------------------------------ Page 1 -
INTRODUCING THE SPECTRUM 128
Your Spectrum 128 is two computers in one.
It has all the features which have made the Sinclair Spectrum the most popular
home computer you can buy, and will run existing software for the ZX
Spectrumá+ and the 16 and 48K Spectrum.
But now the Spectrum 128 adds a whole new dimension to Spectrum computing.
Its full 128K of memory means that it can run more complicated programs,
play more exciting games, store more information - everything you want
to do will run that much more easily or work that much better.
The Spectrum 128 also has many convenient features in addition to those on the
standard ZX Spectrumá+. These include advanced sound, including the ability to
drive a synthesizer; a full screen editor to make it easier to write your own
programs in BASIC; and a Calculator facility. There are also extra sockets
for connecting peripherals such as a colour monitor or a printer and a
special extension keypad giving easy control of the editing facilities.
A simple command lets you switch off the features which are unique to the
Spectrum 128 so that it performs exactly like a standard 48K Spectrumá+
(if you want to run a 48K Spectrum game, for instance).
Your Spectrum 128 has two manuals. This introduction describes in detail how
to set up your Spectrum 128 and how to use its special features. There is
also a copy of the ZX Spectrumá+ User Guide, which describes how the
Spectrum 128 works when running as a Spectrumá+, and has detailed
instructions on how to write your own BASIC programs.
Start by reading the first section of this introduction (pages 2 to 6) which
shows how to set up your Spectrum 128, how to load 128K programs, and how to
use the computer as a Spectrumá+.
The second part of this introduction covers the special programming features
of the Spectrum 128, including how to write or edit a BASIC program, how to
use the Calculator and how to program music. If you want to learn
programming on the Spectrum 128, we suggest you start by trying
some of the examples in the ZX Spectrumá+ User Guide.
- Page 2 ------------------------------------------------------------ Page 2 -
==========
SETTING UP
==========
When you unpack your Spectrum 128, make sure that you have all the parts shown
on page 4 of the ZX Spectrumá+ User Guide. (Note that the software supplied is
different from that detailed there). You will also need your own colour TV or
colour monitor, although you can use a black and white TV if you want. You
will also need a cassette player if you want to load any cassette-based
software.
===============================
Connecting up your Spectrum 128
===============================
All connections to the Spectrum 128 must be made firmly - especially the power
supply. If you accidentally switch off the power or disconnect the power lead
while the Spectrum 128 is running, you will lose the program and any
information which is in the computer.
You must be careful how you plug or unplug the connectors for some of the
equipment which can be connected to the Spectrum 128. Like any computer, the
Spectrum 128 can be damaged if some of its leads are carelessly plugged in or
disconnected when the computer is switched on. This applies especially to any
equipment which plugs into the edge connector on the back - such as a
joystick, for example. Never make or break any connection to the edge
connector (or to an extension of it on a 'through' peripheral) without first
turning off the Spectrum 128's power supply by pulling out the plug from the
back of the computer. If you do not, you may damage either the Spectrum 128,
or what you are connecting it to, or both.
Your TV or monitor is a powerful generator of static electricity for a few
seconds after it is switched on or off. if you connect or disconnect it from
the Spectrum 128 during this period, you could end up giving your computer a
fatal static shock - so leave the connections alone for a few seconds after
switching the TV or monitor on or off.
The other connectors on your Spectrum 128 can be connected or disconnected
with the computer power on, but take care with any other mains powered devices
(cassette recorder, printer etc) since they can generate voltage surges at
switch-on which might cause the computer to crash. Switch them on before
connecting them to the Spectrum 128.
=============================
The Spectrum 128 power supply
=============================
The mains connection to your Spectrum 128 is the same as described on page 5
of the ZX Spectrumá+ User Guide. When you have finished using your Spectrum
128, always switch off the power and pull out the mains plug.
===============
Connecting a TV
===============
If you are using the Spectrum 128 with a colour or black and white TV, you
connect it exactly as described on pages 6 and 7 of the ZX Spectrumá+ User
Guide.
Unlike the Spectrumá+ which has an internal loudspeaker, the Spectrum 128's
sound is directed through the TV, so you can control the sound level by
turning the TV's volume control up or down.
The Spectrum 128 has a built-in TV test screen to ensure that you get the
best possible picture and sound. You turn it on by holding down the [BREAK]
key and pressing the reset button or switching on the power. When your TV is
tuned correctly, you will see a multi-coloured pattern and hear an
intermittent tone. If there is an AFC switch, turn this off, then tune the TV
until you see coloured bars and numbers and hear a sound. Make sure that you
do not tune in just the picture - the sound should be present as well. Reset
the AFC, then adjust volume and picture controls as you prefer.
====================
Connecting a monitor
====================
The Spectrum 128 has an output suitable for use with RGB or colour composite
monitors, which give a better quality colour picture than a TV. Sinclair
Research will offer advice on suitable models.
Because most monitors do not have sound, you may need to amplify the Spectrum
128's sound output separately (see page 3 for details).
The monitor lead plugs into the Spectrum 128's RGB socket. There is no need to
tune in the monitor, although some types will need setting to match the
Spectrum 128's signal.
A lead ready to connect to the RGB socket is available from Sinclair Research.
You will need to make your own connections at the monitor end, since there
- Page 3 ------------------------------------------------------------ Page 3 -
is no standard connection. The diagram below gives details of the pin
configuration of the Spectrum 128's RGB output. The monitor dealer should be
able to advise you how to make the connections to the monitor.
RGB Pin Signal Level
-------------------------------------------------
--7-- --6-- 1 Composite PAL 75 Ohms, 1.2 Volts pk-pk
| 2 0 Volts DC
3-- 8 --1 3 Bright output TTL
-- | -- 4 Composite sync TTL
/ \ 5 Vertical sync TTL
5 | 4 6 Green TTL
/ 2 \ 7 Red TTL
| 8 Blue TTL
==============================
Connecting an extension keypad
==============================
The Spectrum 128 has an optional extra extension keypad which provides extra
facilities when editing programs and works as a games controller and
calculator.
The keypad is connected by its own coiled cable which fits into the socket on
the front of the computer. There is a slight pause after you first switch on
the Spectrum 128 during which the keypad will not respond. Note that the
keypad functions are not available when running 48 BASIC or playing a 48K
game, and so the keypad need not be connected. It can safely be unplugged
while the computer is switched on.
==============================
Connecting a cassette recorder
==============================
A cassette tape recorder can be connected to the Spectrum 128 for loading or
saving programs in a similar way to that described on pages 12 and 13 of the
ZX Spectrumá+ User Guide.
Note that the MIC and EAR sockets are on the left of the computer rather than
at the back, and that the double lead can be used either to connect the EAR
socket on the Spectrum 128 to the EAR socket on the cassette player (for
loading) or MIC to MIC (for saving) - you should not connect both at the same
time. You can plug or unplug the lead while the computer is switched on.
You can also use a cassette player as an external amplifier, as shown on page
37 of he ZX Spectrumá+ User Guide.
======================
Connecting Microdrives
======================
Sinclair Microdrives are a powerful means for saving and loading programs more
quickly than using tapes. They are connected to the Spectrum 128 by using a
Sinclair Interface 1, as described on pages 46 and 47 of the ZX Spectrumá+
User Guide.
=====================
Connecting a joystick
=====================
A joystick can be connected to the edge connector on the back of the Spectrum
128 by using a suitable interface which should be available with the joystick.
Make sure that the model you buy will work with your software, as there are
several joystick standards. Do not connect or disconnect a joystick interface
while the Spectrum 128 is switched on.
====================
Connecting a printer
====================
The Spectrum 128 can be used with many types of printer which conform to the
RS232 standard (the commonest type) or which are fitted with an RS232
interface. A separate list of suitable models can be obtained from Sinclair
Research.
The printer plugs into the RS232 socket on the left hand side of the Spectrum
128, using a special connecting lead which can be obtained from Sinclair
Research.
Printers such as the Sinclair ZX printer which were designed for earlier
Spectrum models can also be used with the Spectrum 128 but will only work when
the computer is running 48 BASIC, They are not suitable for use when the
Spectrum 128's special features are in use. This type of printer plugs onto
the edge connector at the back of the computer.
==============================
Connecting musical instruments
==============================
The Spectrum 128 can be used to control electronic musical instruments such as
synthesizers and drum machines which conform to the MIDI standard (see page
14).
To make the connection, you need a MIDI lead which is available from Sinclair
Research.
============================
Connecting other peripherals
============================
Your Spectrum 128 can be connected to a wide variety of other computer
peripherals such as light pens, disk drives and modems. Make sure that the
equipment is specifically compatible with the Spectrum 128 as well as other
Spectrum models. Connection details should be provided by the manufacturers
of the equipment.
- Page 4 ------------------------------------------------------------ Page 4 -
===============
GETTING STARTED
===============
When you switch on your Spectrum 128 or press the reset button on the left
hand end, you will see the Spectrum 128 main menu screen which lists these
main functions and allows you to choose between them with a few simple
keypresses
Tape Loader
128 BASIC
Calculator
48 BASIC
Tape Tester
There is a blue bar (the selection cursor) showing the option which is
currently selected - it starts off on Tape Loader at the top of the menu. Use
the [up arrow] and [down arrow] keys on the main keyboard or keypad to move
the selection cursor up and down. Press [ENTER] (or [CMND] if you have a
keypad) to select the option shown by the cursor.
===========
Tape Loader
===========
This enables you to load any 128K program from tape at high speed. Taped 48K
or 16K programs must be loaded by selecting 48 BASIC. The Tape Loader is
described in detail on page 5.
=========
128 BASIC
=========
Select this option to write your own 128 BASIC program. 128 BASIC is similar
to standard Spectrum BASIC, with the addition of some new commands and
improved editing. Spectrum BASIC is described in the ZX Spectrumá+ User
Guide, and pages 6 - 8 of this Introduction give full details of the extra
features.
==========
Calculator
==========
This option turns the keyboard or keypad into a simple calculator. The
calculation and results are displayed on the screen. Page 8 of this
Introduction shows you how to use the Calculator.
========
48 BASIC
========
Select this to make your Spectrum 128 work as a Spectrumá+, allowing you to
load 48K or 16K Spectrum programs or write your own programs in Spectrum
BASIC.
When you select this option, the screen will clear and you will see the 1982
copyright message as shown on page 6 of the ZX Spectrumá+ User Guide.
The computer will then behave exactly like an ordinary 48K Spectrumá+. You
will not be able to use a keypad or any of the other special program features
of the Spectrum 128 - although you will be able to use a monitor.
If there is a program in your Spectrum 128's memory when you select 48 BASIC,
it will be lost. it is possible to carry over a program from 128 BASIC to 48
BASIC by typing the command SPECTRUM. However, any commands (such as sound
commands) which are only available in 128 BASIC will not be accepted by the
computer.
Your Spectrum 128 will stay in 48 BASIC until you switch off or press the
reset button. There is no command which will let you return to 128 BASIC -
you must press the reset button and start again.
===========
Tape Tester
===========
This will check that you have set the volume on your cassette player to the
best possible level for any given tape. Details are given in the Loading a
program section.
- Page 5 ------------------------------------------------------------ Page 5 -
=================
LOADING A PROGRAM
=================
The Spectrum 128 can be used to run programs which you have bought for it, or
programs which you have written yourself and saved on tape, Microdrive or
disk. It will load all programs which were specially written for the Spectrum
128, as well as many programs which were written for the Spectrumá+, Spectrum
48K and 16K. However, you must use a different loading method for these
programs, and it is extremely unlikely that a program will run if you use the
wrong method.
Loading problems can be minimised by running the special Tape Tester program
to ensure that the tape player is set to the ideal volume.
=================
Loading checklist
=================
The different loading methods are explained in detail below. This checklist
shows when to use each one.
* 128K programs on tape
Most programs will load automatically by using the Tape Loader option. A
very few may need special loading instructions entered in 128 BASIC.
* 128K programs on Microdrive or disk
The loading instructions must be entered from 128 BASIC.
* Spectrumá+, 48K or 16K programs on tape, Microdrive, or disk
The loading instructions must be entered from 48 BASIC.
======================
Loading a 128K program
======================
The Tape Loader option on the main menu can be used for any cassette-based
128K program which accepts a LOAD "" command (almost all commercial programs
do this). It cannot be used for Microdrive- based or disk-based software, nor
the very small number of taped programs which require special loading
instructions.
To use the Tape Loader, ensure that your cassette player is connected
correctly (see page 3), then select the Tape Loader option on the main menu.
If this is the first time you have used the program with your Spectrum 128,
you may wish to use the Tape Tester option first (see below). Otherwise, just
press PLAY on your cassette player and loading is then automatic.
If the program is on Microdrive or disk, or the cassette is one of the very
few which requires a special loading command, you will need to select 128
BASIC from the main menu. Now check the loading instructions given with the
software and type in the command given there (see 128 BASIC for further
details).
===========================
Loading a 48 or 16K program
===========================
Select 48 BASIC then follow the software loading instructions given in the ZX
Spectrumá+ User Guide.
=================
Loading problems?
=================
Most tape loading problems are not due to a fault with the software or the
computer. If you have problems loading a program from tape, first check that
you have used the right method. Have you tried to load a 128K program in 48K
BASIC, or vice versa?
Then check that your cassette player is set to the optimum volume (see below).
You may also find it useful to check the Software loading troubleshooter chart
on page 16 of the ZX Spectrumá+ User Guide.
=====================
Using the Tape Tester
=====================
The Tape Tester provides a means of checking that your cassette player is set
to the best volume for any given tape. This will minimise loading problems,
but if your cassette player is faulty or you have a badly recorded tape, it
does not guarantee loading.
Connect up your cassette player and insert the program tape which you wish to
test. Wind it on a little so that you have a signal on the tape. Now select
Tape Tester from the menu. You will see a horizontal blue bar on the screen
with a light blue square to the left of it. Start the tape and you should see
the light blue square move to the right.
Now adjust the volume control up or down until the light blue square fails as
far to the right as possible.
Leave the volume control in this position and rewind the tape. You can now
load it as normal. It is worth marking the volume setting on the tape label
for future reference.
- Page 6 ------------------------------------------------------------ Page 6 -
=========
128 BASIC
=========
Choosing the 128 BASIC option from the main menu lets you write your own
BASIC program. it also lets you edit a program which you have previously
written, or issue a direct command for things like loading software which
cannot be loaded using the easy Tape Loader.
If you are used to writing in Spectrum BASIC (see the ZX Spectrumá+ User
Guide), you will find that 128 BASIC is very similar but contains some extra
commands. The most important difference is the way in which you type in 128
BASIC.
Ordinary Spectrum BASIC commands are entered in by pressing one key (sometimes
after pressing one or two others). The whole keyword (printed in small letters
on the key) then appears on the screen.
In 128 BASIC none of these special key entries apply. Instead, you type each
word in full, letter by letter.
You can use 128 BASIC to type in any program which was originally written for
the Spectrum 128. it can also be used for many programs which were written for
the 16K or 48K Spectrum, including those in the ZX Spectrumá+ User Guide. It
does not matter that these originally used special keys to enter them.
However, you may find that some programs for the earlier Spectrums contain
instructions which will cause them to fail if run in 128 BASIC.
Note that the TRUE VIDEO and INVERSE VIDEO keys are not used in 128 BASIC.
INVERSE effects are available by using the keywords INVERSE 1 and INVERSE 0 as
described on page 31 of the ZX Spectrumá+ User Guide.
In 128 BASIC, EXTEND MODE is only used for a few symbols shown above the
letters on the keys, such as 1. To get these symbols, press the EXTEND MODE
key and then SYMBOL SHIFT and the symbol key together. The Spectrum 128 then
reverts to normal typing. >=, <= and <> must be entered as two characters.
GRAPHICS mode works as it does in Spectrum BASIC but you must leave GRAPHICS
mode if you wish to use the cursor keys to edit a program. Colour control
codes (see page 33 of the ZX Spectrumá+ User Guide) are not available in 128
BASIC and you should use the colour keywords instead. Spectrum BASIC programs
which contain the keywords POKE or PEEK may not work correctly in 128 BASIC.
When you are typing in 128 BASIC, you can use either capitals or lower case
letters except when entering music (see page 10) The other examples printed
here are in capitals for clarity, but this is not essential. You also do not
always need to include spaces on either side of BASIC keywords as shown in the
program examples (the Spectrumá+ puts these in automatically). However, if you
are typing a keyword next to another letter (eg, FOR N or IF A) you must put
in the space. When a program line is accepted by the Spectrum 128 (see below)
it automatically converts all the keywords to capitals and inserts spaces as
shown in the examples.
============
Start typing
============
As soon as you have selected 128 BASIC from the main menu, you will see a
blank screen ready to type onto. Try typing this
-----------------------------
10 BORDER 1:PAPER 6:INK 2:CLS
-----------------------------
Note that you could just as well type
-----------------------------
10 border 1:paper 6:ink 2:cls
-----------------------------
as they mean the same to the Spectrum 128. Press [ENTER] when you reach the
end of the line.
Now you want to run your program to see its effect, Type
---
RUN
---
and press [ENTER]. The screen should turn yellow with a dark blue border.
===============
Program errors?
===============
The Spectrum 128 will check each program line after you have typed it in. If
you make a typing mistake which it cannot understand, it will not accept the
line when you press [ENTER]. The commonest errors are spelling mistakes and
missing spaces. For example, in the program line you have just entered, you
might have typed
-----------------------------
10 BORDER 1:PAPER 6:UNK 2:CLS
-----------------------------
which has a spelling mistake.
When an error is detected, a red cursor will flash in the line. This cursor
will almost always indicate the keyword which
- Page 7 ------------------------------------------------------------ Page 7 -
contains the first error (as it will here), but with some types of mistake
this is not the case.
The Spectrum 128 only checks each line as you enter it, so it does not
guarantee that the program as a whole is correct. Nor is it a mind-reader. If
you type
-----------------
10 PRINT "Hellop"
-----------------
the line will be accepted. The computer cannot know that you meant to type
"Hello".
=======================
Correcting your program
=======================
If you make any typing mistakes or just want to change something, the BASIC
editor lets you make corrections very easily using the keyboard. And if you
have a keypad, this has extra keys which give you more control over moving
around and deleting parts of the program.
=============
Moving around
=============
Try moving the cursor around the program using the cursor keys on the
keyboard
[right arrow] moves the cursor one character to the right
[left arrow] moves the cursor one character to the left
[up arrow] moves the cursor up one line
[down arrow] moves the cursor down one line
If you have a keypad, these movements are duplicated by the red cursor keys.
You also have these additional keys
[double right arrow] moves the cursor as far as the begining of the next word
[double left arrow] moves the cursor as far as the next space to the left
[double up arrow] moves the cursor up 10 lines of the program - this will not
work unless you have more than 10 lines in your current
program
[double down arrow] moves the cursor down 10 lines of the program - this will
not work unless you have more than 10 lines in your
current program
[bar and double left arrow] moves the cursor to the start of the BASIC line
[double right arrow and bar] moves the cursor to the end of the BASIC line
========================
Deleting program entries
========================
You can erase mistakes by using the [DELETE] key on the keyboard to delete
the character to the left of the cursor.
If you have a keypad, this offers several extra delete keys.
[DEL and left arrow] deletes the character to the left of the cursor
[DEL and right arrow] deletes the character which the cursor is on
You can delete larger amounts by using the following keys on the keypad. To
prevent unwanted erasures you must hold down [SHIFT] at the same time as
pressing these keys.
[DEL and double left arrow] deletes as far as the next space to the left of
the cursor
[DEL and double right arrow] deletes from the character under the cursor, as
far as the next space to the right
[DEL and bar and double left arrow] deletes from the left of the cursor to the
beginning of the line
[DEL and double right arrow and bar] deletes from the character under the
cursor to the end of the line
======================
The 128 BASIC commands
======================
Press [EDIT] (or [CMND] if you have a keypad) to bring up the Options menu
which offers these commands.
128 BASIC
Renumber
Screen
Print
Exit
This works like the main menu-you move the cursor up and down with [up arrow]
and [down arrow], and use [ENTER] to select your option.
=========
128 BASIC
=========
Selecting this returns you to the BASIC screen if you have selected the
command Options menu by mistake.
========
Renumber
========
This automatically alters the line numbers of the current BASIC program so
that it starts at line 10 and goes up in steps of 10. It also changes any
references to the line numbers which appear within the lines (such as GOTO
200, for example). This is most useful when you have developed a program by
adding new BASIC lines between the originals. You can use the command to tidy
up the program by spacing it out to absorb the new additions.
======
Screen
======
This option changes the size of the BASIC program screen. Instead of your
program occupying the whole screen area, it can be displayed in just the
bottom two lines. The
- Page 8 ------------------------------------------------------------ Page 8 -
small screen is mainly used when you are saving a screen display or copying
it to a printer - confining the program to an off- screen area ensures that
it does not overwrite the display which you want to keep.
=====
Print
=====
If you have a suitable printer connected, this lets you print out the current
program on paper.
If no printer is connected, or there is some other problem, the computer may
appear to 'freeze'. it can be cleared by pressing [BREAK]. When printing is
complete, you will be returned to the program screen.
====
Exit
====
This option returns you to the main menu. Your current program is
automatically stored and will be recalled if you select 128 BASIC again. If
you switch off, select 48 BASIC or press the reset button the program will be
lost.
====================
USING THE CALCULATOR
====================
The number keys and mathematical symbols on the keyboard or keypad can be used
exactly like an ordinary pocket calculator, by selecting the Calculator option
from the main menu.
When you select the option, you will see the blank Calculator screen. Now just
type in your calculation in standard mathematical notation. For example, type
-----
27*45
-----
When you press [ENTER] the answer = 1215 will appear. As on an ordinary
calculator, the current result is held in the Spectrum's memory - so if you
want to carry out further calculations, there is no need to retype it. For
example, to take 685 from the answer you just got, you type
----
-685
----
and press [ENTER] to see the answer = 530.
The calculator uses all the mathematical functions available in Spectrum
BASIC (see the ZX Spectrumá+ User Guide). The keypad has the four main
mathematical functions * / + - and also supports the use of brackets.
When you have finished with the calculator, you can return to the main menu by
pressing [EDIT]. This brings up the Options menu:
Calculator
Exit
Select Calculator to return to the Calculator screen, or Exit to return to the
main menu.
- Page 9 ------------------------------------------------------------ Page 9 -
======================
STORING DATA IN MEMORY
======================
The additional memory in your Spectrum 128 can be used for running large
machine code programs. It can also be used by BASIC to store programs and data
in much the same way as a cassette or Microdrive - but many times faster.
This type of storage is called a RAM disk and it allows BASIC programs to
manipulate data in much the same way as professional programs on big machines.
An important difference between RAM storage and a cassette or Microdrive is
that the data will be lost as soon as the power is switched off or the reset
button is pressed. It will also be as good as lost if you type SPECTRUM.
Always save your work to cassette or Microdrive before doing any of these
things. Data which has been stored in RAM will not be affected by a NEW
command.
All the commands for RAM disk storage are the same as cassette commands except
that an exclamation mark (!) must be typed after the keyword, eg
------------------------
SAVE! "program" LINE 10
LOAD! "program"
SAVE! "picture" SCREEN$
LOAD! "physics" DATA p()
MERGE! "overlay"
------------------------
The VERIFY keyword is not used with the RAM disk.
You can get an alphabetic catalogue of all the files (programs and data) saved
in RAM by typing
----
CAT!
----
Individual files can be removed by typing
-----------------
ERASE! "filename"
-----------------
===============
MUSIC AND SOUND
===============
The Spectrum 128 has two different ways to make music and sound effects. Both
work through the sound channel of your TV or can be sent to an external
amplifier as explained on page 3. There is no internal speaker.
The first method uses the Spectrum BASIC BEEP command (see pages 36-37 and 53
of the ZX Spectrum User Guide). But 128 BASIC also has the PLAY command which
allows you to make sophisticated music with up to three notes at once. It also
gives you more control over the sound of each individual note than is possible
using BEEP.
The PLAY command can be used to let your Spectrum 128 play tunes on many types
of synthesizer and other electronic musical instruments, such as drum
machines. The Spectrum 128 is MIDI (Musical Instrument Digital Interface)
compatible, which allows it to be connected to any other equipment which
conforms to the MIDI standard.
==================
Programming sounds
==================
Making music and sound effects with PLAY is simple. You just type in the
series of notes that make up a tune, then ask the Spectrum 128 to PLAY them.
You can also include instructions that tell the Spectrum 128 what sort of tone
you want for the sound.
To hear some of the wide range of sounds that you can make, type in one of the
two programs below, RUN it, then try the other example, Don't worry if the
program lines look complicated, they are explained in detail later
=====
MUSIC
=====
--------------------------------------------------
10 LET a$="T180O6(CDEC)(5EF7G)(3GAGF5EC)5Cg7C9CgC"
20 LET b$="O4(CDEC)(5EF7G)(3GAGF5EC)5Eb7E9EbE"
30 LET c$="O3(7CG)(7CG)(7CG)5GD7G9GDG"
40 PLAY a$,b$,c$
--------------------------------------------------
- Page 10 ---------------------------------------------------------- Page 10 -
=============
SOUND EFFECTS
=============
-----------------------------------------------------
10 LET a$="M8UX350W507(((C)))": PLAY a$ : PAUSE 25
20 LET a$="M56UX5000W1O3(((C)))" : PLAY a$ : PAUSE 25
30 LET a$="M56W2O1N8C" : PLAY a$ : PAUSE 25
-----------------------------------------------------
======================
Using the PLAY command
======================
In the examples above, you will see that each time the PLAY command appears,
it is followed by up to three different letters, each followed by a $ sign in
a statement like
-------------
PLAY a$,b$,c$
-------------
Each of these is the name of a string (a series of characters) which you have
already given to the computer earlier in the program. The strings tell the
Spectrum 128 which sounds to make.
PLAY controls three separate sound channels called A, B, and C and there can
be up to three strings, one for each channel. In the MUSIC example given
above, a$ tells channel A to play the melody line, b$ tells channel B to play
a harmony, and c$ tells channel C to play a bass part. In the SOUND EFFECTS
example, only one noise is used at a time (although up to three can be), so
each one is in channel A and the command is simply PLAY a$.
In fact any of the channels can produce either a musical tone or noise, so you
can mix sound effects in with your music (see Channel selection).
====================
Constructing strings
====================
Composing music and sound effects on the Spectrum 128 is simply a matter of
creating strings containing the information you want. You can see how this
works in the MUSIC example above. Each string is created with the LET command,
followed by the name of the string, and its contents enclosed in "" marks. Try
this example, which plays just one note - an A.
-------------------
LET a$="a": PLAY a$
-------------------
Any music program using PLAY also uses LET to tell it what to play, as you can
see by looking at the earlier examples. The reason why these programs look
more complicated than the example above is that the strings enclosed in the ""
marks contain many letters and numbers to define a longer tune or more complex
sound.
Any musical sound has a pitch and duration. It also has a volume and tone
quality. The strings in the earlier examples contain information about all of
these. The summary below lists each possible command, and they are explained
in detail opposite.
====================
PLAY command summary
====================
This is a brief list of the commands which can be contained in a PLAY string.
Note that all letters except note names must always be in capitals.
String entry Function
------------------------------------------------------------------------------
c-b or C-B Gives pitch of note within current octave range
$ Flattens note following it
# Sharpens note following it
O Followed by number 0 to 8 sets current octave range
1-12 Sets length of notes
& Denotes a rest
N Separates two numbers
V Followed by a number 0 to 15 sets volume of notes
W Followed by a number 0 to 7 sets volume effect
U Turns on volume effect in any string
X Followed by a number 0 to 65535 sets duration of volume effect
T Followed by a number from 60 to 240 sets tempo of music
( ) Enclose repeated phrase
! ! Enclose a comment
H Stops a PLAY command
M Followed by a number from 1 to 63 selects channels
Y Followed by a number from 1 to 16 turns on a MIDI channel
Z Followed by a number sends that number as a MIDI programming code
- Page 11 ---------------------------------------------------------- Page 11 -
=================
Setting the pitch
=================
As you saw above, you set the pitch of any note by giving its musical name -
eg, C E G. Sharp notes are prefixed by # (eg #C) and flat notes by $. Your
'instrument' covers two octaves in the key of C, and uses letters c to b for
the notes in the lower octave, C to B in capitals for the higher one.
Any number of notes within these two octaves can be played one after another,
eg
----------------------------
10 LET a$="cfedafgCFEDAFGCC"
20 PLAY a$
----------------------------
If you want to span more than just two octaves, you can change the overall
pitch of your 'instrument' by using the octave command 0 followed by a number
from 0 to 8. if you do not specify an octave (as in the example above) it is
automatically set to 5 (the range containing middle C). The octave command
remains in force for all notes which follow it until a new octave command is
given.
This program lets you hear the same tune played in a higher octave (just add
the O7 to your earlier program)
------------------------------
10 LET a$="O7cfedafgCFEDAFGCC"
20 PLAY a$
------------------------------
Try changing the octave number progressively to hear the full pitch range
which your Spectrum 128 can produce. Notice that some of the very lowest notes
in octaves 0 and 1 will not be reproduced at the right pitch except through
the MIDI output. The Spectrum 128 will simply play them at the lowest pitch
possible.
Since each pitch range covers two octaves, two adjacent ranges overlap. For
example, the high part of 04 contains the low part of 05 (see the diagram
below). Note that you can extend any range slightly by using a series of
sharps (####) or flats ($$$$) to raise the pitch of individual high notes or
lower the pitch of low ones.
=============
Note duration
=============
If you do not specify the length of each note, they will all be played at the
same length (as crotchets) as in the examples above. You can fix the length of
any note or series of notes by prefixing it with a number from 1 to 12. This
program lets you hear the different note duration with numbers from 1 to 9.
------------------------------
10 LET a$="1C2C3C4C5C6C7C8C9C"
20 PLAY a$
------------------------------
Pitch values for making music with PLAY
This diagram shows how you can create different notes using the Spectrum 128's
octave command. The command O followed by a number from 0 to 7 sets the
Spectrum 128 to a range of two octaves beginning with a C. The diagram shows
the complete range of notes covered by O4. O5, and O6. Adjacent octave ranges
overlap, so the same notes appear in the upper part of one range and the
lower part of another.Individual notes within an octave range are set by
using the letters c to b in lower case for the lower notes and C to B in
capitals to give the notes in the upper octave. Placing a # before any note
letter gives a sharp note - a $ flattens it.
[There was a diagram here, but it's a bit beyond ASCII art, so take a look at
the HTML version's sp128111.gif file -DB]
- Page 12 ---------------------------------------------------------- Page 12 -
1 is the shortest note and 9 the longest. They are related to musical
convention according to the following table.
Number Note Name Musical symbol
-----------------------------------------
1 semi quaver
2 dotted semi-quaver
3 quaver
4 dotted quaver
5 crotchet
6 dotted crotchet
7 minim
8 dotted minim
9 semi-breve
[The musical symbols are also beyond ASCII art so take a look at the HTML
version's sp128121.gif through to sp12812c.gif files -DB]
Each of these controls the length of all notes which follow it until you give
a new number code.
You can also use the numbers from 10 to 12 to specify triplet notes (three
notes played in the time normally used for two).
10 triplet semi-quaver
11 triplet quaver
12 triplet crotchet
Each of these only applies to the three notes following it and must be
followed by their three names, eg
-----------------
10 LET a$="11ACE"
-----------------
A rest (no note playing) is specified by a & and has the same length as the
current note. For example
----------------------
10 LET a$="7A&B&C&D&E"
----------------------
is five minims with equal pauses between them.
Tied notes can be indicated by giving the two note durations connected by an
underscore character and the note name, eg
----------------
10 LET a$="3_5A"
----------------
The second note duration you give will also apply to any following codes until
you give another duration code.
=============
The N Command
=============
In some or the examples you will see the letter N used to introduce a series
of notes within the string, eg
----------------
LET a$="O7N1CDE"
----------------
N is used in cases where two sets of numbers would otherwise clash. In the
example above, 0 is set to octave 7, then a series of notes is given, starting
with the duration code 1. Without the N code, the Spectrum 128 would read the
octave code as 71 - obviously not what was intended!
===========
Note volume
===========
The overall volume of the sound is controlled by the volume setting of your
TV or amplifier. You can control the volume of individual notes and phrases
within the tune by using the V command. V followed by a number from 0 to 15
sets the following note(s) to a constant volume. The lower the number, the
quieter the sound, with V0 completely silent (V0 is a useful way of stopping
one channel playing while others continue). V15 is the maximum and is used
automatically by the Spectrum 128 if you do not specify a level.
The low volumes are very quiet and you will normally use 10 to 15 unless you
are outputting to an amplification system or via the MIDI port to a
synthesizer. Try running this program
-----------------------------
10 LET a$="V10cdefgabCDEFGAB"
20 PLAY a$
-----------------------------
Now try changing the number after the V to a new value to hear the difference
==============
Volume effects
==============
Instead of you just setting each note to a fixed volume, PLAY also lets you
change the volume of the sound while it is playing. For example, you can make
a note start suddenly and then die away (like a piano) or make a sound effect
rise and fall in volume (like a steam train).
This effect is controlled by the letter W which can be included in any of the
strings controlled by the PLAY command. You must also include the letter U in
each string where you want to use the effect. You cannot use it if the string
already has a volume setting (if it contains a V) - the volume command will
overrule the effect.
- Page 13 ---------------------------------------------------------- Page 13 -
The W must be followed by a number from 0 to 7 which controls how the sound
builds up (the attack) or fails off (the decay). This is the full range of
numbers and what they do
0 \____________ 0 single decay then off
1 /|___________ 1 single attack then off
2 \|----------- 2 single decay then hold
3 /------------ 3 single attack then hold
4 \|\|\|\|\|\|\| 4 repeated decay
5 /|/|/|/|/|/|/| 5 repeated attack
6 /\/\/\/\/\/\/\ 6 repeated attack-decay
7 \/\/\/\/\/\/\/ 7 repeated decay-attack
This program plays the same note with each effect in turn to let you hear
what they sound like
-------------------------------------------------
10 LET a$="UX1000W0C&W1C&W2C&W3C&W4C&W5C&W6C&W7C"
20 PLAY a$
-------------------------------------------------
Notice the U to turn on the effect, then the series of W numbers.
There is one other new command used here, the letter X. This can be followed
by a number from 0 to 65535 to set the length of the sound effect - the larger
the number, the longer the effect is drawn out.
You do not have to include an X setting. If you do not, the Spectrum 128 will
automatically choose the longest. In general, repetitive effects (W4 to 7) are
more effective with quite short settings, eg X300.'Single shot' effects (W0 to
W3) need a longer period, eg X1000. Try changing the value after X in the
program above to hear the difference.
=====
Tempo
=====
The speed at which a piece of music is played can be set with the command T
followed by the number of crotchet beats per minute (bpm) in the range 60 to
240. The command controls the speed at which all notes are played, but can
only be included in channel A (the first string after the PLAY command)
otherwise it is ignored, eg
---------------------
10 LET a$="T180cdefg"
20 PLAY a$
---------------------
If no tempo is specified, the music will be played at 120 bpm.
================
Repeated phrases
================
Any musical phrase can be repeated by enclosing the appropriate string or part
of a string in brackets. For example
---------------------
10 LET a$="abC(DEFG)"
---------------------
will repeat the last four notes. If there is an unequal number of brackets,
the phrase will be repeated back to the last bracket. If there is only a
closing bracket, the phrase will be repeated back to the beginning of the
string, eg
--------------------
10 LET a$="abCDEFG)"
--------------------
will repeat all seven notes. Double closing brackets
--------------------
10 LET a$="O2CEGA))"
--------------------
will cause an 'infinite' repeat. This is particularly useful for things like
repetitive bass lines. To turn off an 'infinite' repeat you use the H command.
=============
The H command
=============
An H included in any string immediately turns off the PLAY command. The main
use of this is where you have an infinitely repeated bass line in one string.
You can stop this at the end of the tune by putting an H on the end of the
string which plays the melody.
- Page 14 ---------------------------------------------------------- Page 14 -
========
Comments
========
You can include reminders and comments anywhere you like by using !! marks.
Anything written after a ! will be ignored until the next ! or the " at the
end of the string is reached, eg
---------------------------------
10 LET a$="abCDEFG!chorus!aCEaDG"
---------------------------------
=================
Channel selection
=================
The command M is used to select which of the three channels are in operation
and whether these give noise or musical tones.
You can have a maximum of three channels in use at any one time, but it does
not matter whether they are all tone, all noise, or a mixture of both.
Your choice is entered with a number following the M, worked out like this
Tone channels Noise channels
A B C A B C
Number 1 2 4 8 16 32
Mark each channel you want to turn on, and note down its number. Then just
add them together to get the code you should use after the M. For example, if
you want to use tone channels A, B, and C, you add the numbers 1 + 2 + 4 = 7,
so you use the command M7. In the same way, M56 would turn on noise channels
A, B, and C.
Noise can be used on any channel but the most wide-ranging frequencies are
available in channel A. For the best results put your sound effects in the
string which controls this channel - a$, the first string after the PLAY
command.
===============================
Controlling musical instruments
===============================
Whenever PLAY is running, a signal can be sent to the MIDI port in the RS232
socket at the front of the computer. This output will drive any MIDI-
compatible musical instrument such as many makes of synthesizer and drum
machine, so that the instrument will play the music which has been programmed
into the Spectrum 128.
Using the MIDI output lets you play more complicated music with up to eight
notes at a time instead of three. All you do is to follow the PLAY command
with the names of up to eight strings, (a$ to h$, for example) each of which
is constructed as described above.
Do not try to send music to the MIDI port unless you have already connected
the instrument (see page 3). To send the output to the MIDI port, each string
should include the letter Y followed by a channel number from 1 to 16. If you
use the same number in each string, up to eight notes can be played by one
instrument at the same time. If you use different numbers, you can control up
to eight different instruments at the same time.
Most MIDI instruments power up in OMNI mode so that they play the notes on
channel 1 as well as the channel to which they are directed. To get the notes
on the correct channels, the MIDI instrument must be put into POLY mode. You
can do this by directly altering the instrument's MIDI channel, or by
including the appropriate MIDI programming code in the string. The programming
codes for your instrument should be listed in its handbook and can be sent to
it from the Spectrum 128 by including the letter Z in the string, followed by
the MIDI code number.
If your synthesizer understands key velocity (so that the program you send it
controls the volume at which it plays) this is interpreted from the V settings
in the strings. It is calculated at eight times the volume set by the V
command, so it takes the values 0, 8, 16 ... 120. The key release velocity
when a note is switched off is sent as 64. If the synthesizer is not designed
to understand key velocity, it will play the same volume regardless.
- Back cover ---------------------------------------------------- Back cover -
First published 1986 by Sinclair Research Ltd, Milton Hall, Milton, Cambridge
CB4 4AE
Copyright (c) 1986 Sinclair Research Ltd
ISBN 1 85016 056 2
sinclair, ZX Spectrumá+, ZX Spectrum 128, ZX Microdrive, and ZX Interface are
Trade Marks of Sinclair Research Ltd.
All rights reserved. No part of this publication may be reproduced in any
form. Unauthorized copying, hiring, lending or sale and repurchase prohibited.
[ASCII text version created by Damien Burke. You can ignore the stuff above, I
just kept it in for completeness; Amstrad do not mind distribution of old
Sinclair stuff. Lovely people! However, Amstrad retains the copyright to this
document. -DB]