Sinclair ZX Spectrum Reference manual



by Steven Vickers
and Robin Bradbeer
PDF Edition 2004
prepared by Colin Woodcock,
ZXF Magazine (www.zxf.cjb.net)
© 1982 Amstrad
Amstrad has kindly given its permission for
the redistribution of its copyrighted material,
but retains that copyright.

Front cover illustration by John Harris of Young Artists

Contents
CHAPTER 1 The computer and setting it up. Page 5
CHAPTER 2 The keyboard. Page 8
CHAPTER 3 Numbers, letters and the computer as a calculator. Page 11
CHAPTER 4 Some simple commands. Page 14
CHAPTER 5 Simple programming. Page 17
CHAPTER 6 Using the cassette recorder. Page 21
CHAPTER 7 Colours. Page 25
CHAPTER 8 Sound. Page 27
CHAPTER 9 Inside the case. Page 29


1. The Computer and setting it up
This short booklet has been written for two types of people. First, those who know
nothing, or next to nothing, about computers, and, secondly, for those who are
familiar with computer based systems but who like to read instruction booklets
before plugging anything in.
There is a second, thicker book which is the BASIC programming manual. This
should not be read by the novice computer user until this booklet has been read
and understood.
Unpacking the ZX Spectrum, you will have found:
1This introductory booklet and the BASIC programming manual,
2The computer. This has three jack sockets (marked 9V DC IN, EAR and MIC),
one TV socket, and an edge connector on the back where you can plug in extra
equipment. It has no switches - to turn it on you just connect it to the power supply.
3 A power supply. This converts mains electricity into the form that the ZX
Spectrum uses. If you want to use your own power supply, it should give 9 volts DC
at 1.4 A unregulated.
4An aerial lead about 2 metres long, which connects the computer to a television.
5 A pair of leads about 75 cms long with 3.5 mm jack plugs at each end. These
connect the computer to a cassette recorder.
You will also need a television - the ZX Spectrum can work without one, but you
won't be able to see what it is doing! It must be a UHF television (in the UK); if it is
not built to receive BBC2 then it is no good. As its name implies, the ZX Spectrum
gives a colour signal which if you have a colour television, will produce a colour
picture. If you only have a black and white television, then the colour will appear as
black, white and six different shades of grey; but apart from that, a black and white
television will work just as well as a colour television.
The components of the system should now be interconnected thus:
5

Mains
electricity
Power
supply
unit
Mains lead
TV
mains
lead
TV
UHF
Aerial
Socket
TV EAR MIC 9V DC in
Figure 1
If your television has two aerial sockets marked UHF and VHF, then use the UHF
one (UK).
Turn the power on and switch on the television. You now need to tune the
television in The ZX Spectrum operates on channel 35 UHF (UK) and when it is first
plugged in and properly tuned it gives a picture like this:
Chapter 1
When using the computer, you will probably want to turn the volume on the
television right down.
If your television has a continuously variable tuning control, then you just have to
Figure 2
6

adjust it until you get the picture shown in figure 2. Many televisions now have an
individual push button for each Station. Choose an unused one and tune it in.
For use in countries that have a different TV system to that in the UK a version
of the ZX Spectrum specially designed for that system is necessary. The UK uses
aUHF system with 625 lines and 50 frames per second. It also uses a colour
encoding system called PAL. Most countries in Western Europe (except France)
use a similar system, and the computer should operate in these countries without
any modification. The USA, Canada, and Japan, for example, use a totally different
TV system and a different version of the computer is required.
When you turn the ZX Spectrum off, all the information stored in it is lost, One
way of keeping it for later is by recording it on a cassette tape. You can also buy
tapes that other people have prepared and so run their programs. The lead with
two jack plugs at each end is used to connect a standard cassette recorder to the
ZX Spectrum. Chapter 8 of this booklet explains this further.
Now that you have set up the computer, you will want to use it. The rest of this
booklet tells you how to do that; but in your impatience you will probably already
have started pressing the keys on the keyboard, and discovered that this removes
the copyright message. This is good; you cannot harm the computer in this way.
Be bold. Experiment. If you get stuck, remember that you can always reset the
computer to the original picture with the copyright message by taking out the '9V
DC IN' plug and putting it back again. This should be the last resort because you
lose all the information in the computer.
WARNING. Do not try to use the ZX 16K RAM with the ZX Spectrum. It will not
work.
Chapter 1
7

The cursor now changes to an L,as a Letter is now expected by the computer.
Type in the letters "Hello". If there is already some other text, for example, on the
screen turn the computer of (remove the 9V plug) and start again. Use the CAPS
SHIFT key to get the upper case H.In general, anything coloured white above the
key requires CAPS SHIFT to access, and anything coloured red on the key
requires SYMBOLS SHIFT
Acommand beginning with PRINT tells the computer to write the letters enclosed
2. The Keyboard
The keyboard of the Spectrum is very similar to a standard typewriter. The letter
and number keys are in the same place; however each key can perform more than
one function. On a normal typewriter the letters appear in lower case, and when
used in conjunction with the shift key, appear as upper case (capitals). The
Spectrum keyboard is just the same.
To help you know what mode the keyboard is in, a reversed out (white on black)
letter appears on the screen indicating the position of the next character that
appears when a key is pressed. The letter is flashing to distinguish it from any
character already on the screen. It is called the cursor.
When first switched on the Spectrum shows a copyright message on the screen.
Pressing any key brings up the word printed below the letter on the key, (this is
called the keyword). This is because the computer is expecting a command from
you to tell it what to do and all commands must begin with a keyword. Unlike most
other computers the Spectrum allows you to enter keywords with only one key
depression.
For example, if the Pkey is pressed immediately after turning on, the keyword
PRINT appears on the screen. The “ symbol is marked on the Pkey as well. To
get it, you must press two keys at once; hold down the SYMBOL SHIFT key, which
is near the bottom right-hand corner of the keyboard, and while still doing that,
press the Pkey.
8
Figure 3

9
Chapter 2
in the double quotation marks onto the screen. For this command to be executed
by the computer, the ENTER key must be used. When this has been done the
screen should display the word
Hello
and some other characters. (A flashing question mark indicates a mistake
somewhere. If this happens start again and repeat the exercise). The message at
the bottom is really the computer reporting back that everything has gone 'OK'. The
message is important when running programs but can be ignored at the moment.
Notice something else: The letter O and the numeral 0 are represented by
different characters. It is important to remember this, The numeral 0 always has a
line through it. The computer will always interpret the letter O as a letter, so don't
press the wrong key. Similarly, the numeral 1 and the lower case letter L are
different and unlike some typewriters, these cannot be interchanged.
As the keyboard mode is so important to understand it is useful to summarise
what happens once again.
The flashing character Lis called the cursor. It shows whereabouts on the screen
the computer will put the next thing that you type. It is not always an L;if you turn
the computer oft and on and then press ENTER the copyright message will change
into a Kcursor. The letter that it uses tells you how the computer will interpret the
next thing that you type. At the beginning of a Line it will be a flashing Kstanding
for 'keyword'. (The copyright message and reports also count as a flashing K) A
keyword is one of the computer's special words, occurring at the beginning of a
command to give the computer a general idea of what the command is going to tell
it to do. Since the computer is expecting a keyword at the beginning of a line, when
you press - say - the Pkey the computer decides not to interpret this as a Pbut as
PRINT;and it warns you that it is going to do this by making the cursor a K.When
it has the first keyword, it doesn't expect another one so what you type now will be
interpreted as letters. To show this, the computer changes the cursor to an L-for
'letter'.
These different states are often called modes - we shall talk about keyword (or K)
mode, and letter (or L) mode.
If you want to type a lot of capital letters without holding CAPS SHIFT down, you
can make all letters come out as capitals by first pressing CAPS LOCK (CAPS
SHIFT with 2). To show this is happening, the Lcursor will be replaced by a
flashing C(for ‘capitals'). To get lower case letters and the Lcursor back, press
CAPS LOCK a second time.
(If you press CAPS LOCK during keyword mode, you will not immediately notice
any difference, but you will see the effect after entering the keyword when the
computer will be in C mode instead of L mode).
As well as keywords, letters, numbers and various programming and scientific
expressions, the keyboard also has eight graphics characters. These appear on the
number keys 1to 8,and can be printed onto the screen in a similar way to letters
and numbers. To do this the keyboard must be changed to graphics mode. This is

Chapter 2
10
done by pressing the CAPS SHIFT key with the 9.Notice the cursor change to a G
Pressing the 9key will change back to L mode.
There Is one last mode that the keyboard can be changed to. The extended
mode, indicated by an Ecursor, is obtained by pressing CAPS SHIFT and
SYMBOL SHIFT at the same time. This allows most of the scientific and
programming functions to be used. Pressing the two SHIFT keys again will revert
the keyboard back to letter, L, mode.
Even if you are the most proficient typist or programmer wrong keys get pressed.
So far the only way to overcome this has been to pull the plug out. Although this
may be convenient if only one command has been given to the computer, it is
certainly very inconvenient if a lot of information has already been entered.
Luckily we can use the DELETE key to change errors. For example, not much
can go wrong with the simple command:
PRINT "Hello"
…or can it?
Let's assume that you didn't use the SYMBOL SHIFT key to get the opening
quotes. The screen would show
PRINT PHello"
The computer would not Have recognised what came after PRINT as no quotes
indicates to the ZX Spectrum that a number is expected - and it found a letter
instead. It shows its confusion by flashing a ?at the end of the line.
Fortunately you don't have to type it all out again. On the top row of the
keyboard are four arrows pointing in different directions and the word DELETE.To
operate these keys, you have to use the CAPS SHIFT key when you press them.
The sideways arrows move the cursor to the left or the right, and the DELETE key
rubs out the character immediately before the cursor.
To correct your nonsense line press
(CAPS SHIFT and 5at the same time)
until the cursor is just after the Pthat you put in by mistake - if you hold them down
for a second or two, then they will start working continuously, emitting a quiet
clicking sound. In fact. it you keep your finger on any key for more than about three
seconds it automatically repeats itself. Key in DELETE (CAPS SHIFT and 0)to
delete the wrong P,and then type “(SYMBOL SHIFT and P)to insert what should
have been there - note that it is inserted without overwriting anything else. Try the
cursor right key as well, just to get the hang of it. If you made any genuine typing
mistakes, correct them in the same way, remembering that you can't overwrite
mistakes; you have to delete them and then insert the corrections.
Now, when you press ENTER,the computer will write your message at the top of
the screen - or underneath the one it did the first time if that is still there.
Afull description of the keyboard can be found in Chapter 1 of the BASIC
programming manual.

3. Numbers, letters and the computer
as a calculator
We have already seen how to tell the computer to print letters and graphics on the
screen using PRINT.We have also seen that ENTER has to be used to tell the
computer to execute the command just typed in. From now on we will not use
ENTER in the manual each time a command is used, but assume that you will key
it at the end of the line automatically.
Numbers can be handled by the computer more easily than letters. In the
previous chapter we hinted at this by explaining that the computer expects a
number after PRINT if quotations marks are not used.
So if we key
PRINT 2
the number 2will appear on the screen.
It is possible to mix letters and numbers:
PRINT 2.”ABC"
Notice that there is a gap on the screen between the 2and ABC
Now key
PRINT 2;”ABC”
and then
PRINT 2 “ABC”
Using a comma between the items after PRINT spaces them out by 16 columns,
using a semi-colon eaves no spaces and using nothing gives an error
PRINT can also be used with the mathematical functions on the keyboard. In fact
the ZX Spectrum can be used as an electronic calculator.
For example:
PRINT 2+2
The answer appears at the top of the screen. Compare this with:
PRINT “2+2"
11

It is possible to combine these to give something more useful. Try
PRINT “2+2=";2+2
Try some other kinds of arithmetic as well:
PRINT 3-2
PRINT 4/5
PRINT 12*2
The *Is used as a multiplication sign instead of X to avoid getting it confused with
the letter x;and /is used for the division sign.
Experiment with lots of different calculations. If you like you can use negative
numbers or numbers with decimal points in.
If you do enough to use up the 22 lines of the top par of the screen, then you will
notice something rather interesting happening; it will all move up one line and the
top line will be lost. This is called scrolling.
Calculations are not always performed in the order you might expect. As an
example, try
PRINT 2+3*5
You might expect this to take 2, add 3 giving 5, and then multiply by 5 giving 25;
however this is not the case. Multiplications - and divisions as well - are performed
before additions and subtractions so the expression ‘2+3*5’ means take 3 and
multiply it by 5, giving 15; and then add that to 2 giving 17'. 17 should be the
answer displayed on the screen.
Because multiplications and divisions are done first we say that they have higher
priority than addition and subtraction. Relative to each other, multiplication and
division have the same priority, which means that the multiplications and divisions
are done in order from left to right. When they are dealt with we are left with the
additions and subtractions - these again have the same priority as each other so
we do them in order from left to right.
Let us see How the computer would work out:
PRINT 20-2*9+4/2*3
i20-2*9+4/2*3 First we do the multiplications and
ii 20-18+4/2*3 divisions in order from left to right
iii 20-18+2*3
iv 20-18+6}
v2+6} and then the additions and subtractions
vi 8}
Chapter 3
12

Although all you really need to know is whether one operation has a higher or lower
priority than another, the computer does this by having a number between 1 and 16
to represent the priority of each operation: * and / have priority 8, and + and have
priority 6.
This order of calculation is absolutely rigid, hut you can circumvent it by using
brackets, anything in brackets is evaluated first and then treated as a single
number, so that
PRINT 3*2+2
gives the answer 6+2=8 but
PRINT 3*(2+2)
gives the answer 3*4=12
It is sometimes useful to give the computer expressions such as this because
whenever the computer is expecting a number from you, you can give it an
expression instead and it will work out the answer. The exceptions to this rule are
so few that they will be stated explicitly in every case.
You can write numbers with decimal points (use the full stop}, and you can also
use scientific notation - as is quite common on pocket calculators. In this after an
ordinary number (with or without a decimal point) you write an exponent part
consisting of the letter ethen maybe -,and, then a number. The exponent part
shifts the decimal point along to the right (or left, for a negative exponent) thus
multiplying (or dividing) the original number by lea few times. For instance,
2.34e0=2.34
2.34e3=2340
2.34e-2=0.0234 and so on
(Try printing these out on the computer.) This is one of the few cases where you
can't replace a number by an expression: for instance, you cannot write
(1.34+1)e(6/2).
You can also have expressions whose values are not numbers, but strings of
letters. You have seen the simplest form of this many times, the string of letters
written down with double quotes around it. This is rather analogous to the simplest
form of numeric expression, which is just a number written down on its own. What
you have not yet seen is the use of + with strings (but not -, * or /, so there is no
problem with priorities here). Adding strings together just joins them together one
after the other: so try
PRINT "jers"+"ey cow"
You can add together as many strings as you like in a single expression, and if you
want, you can even use brackets.
Chapter 3
13

4. Some simple commands
The computer memory can be used to store all sorts of things. We have seen, so
far, that the PRINT command allows us to show letters, numbers and the results of
calculations using both letters and numbers, on the screen.
If we want to tell the computer to remember a number, or a string of letters, then
we have to allocate some of the memory for that use.
Most pocket calculators have a key called 'memory' which is used for
remembering numbers for later. Your computer can do much better than that: it can
have as many of these imaginary boxes In it as you like and you write a name on
each one.
As an example, suppose you want to remember your age! The LET command is
used (LET is the keyword on the Lkey): let's say it is 34
LET age=34
What happens when the LET command is used, is that a certain section of memory
is designated 'age' and the number 34 is stored in it. To get this stored information
out type
PRINT age
and back comes the number 34. It is very easy to change the contents of the 'box'
called 'age', Type:
LET age=56
then type:
PRINT age
and 56 should appear on the screen. 'age' is an example of a variable so called
because its value may vary. It is possible to combine printing a message direct to
the screen, and the value of a variable. Type
PRINT "Your age is ";age
However the computer is a lot more useful than just remembering numbers with
names attached to them. It can also remember strings of letters. To differentiate
between number variables and string variables - as they are called - the dollar
symbol - $-is used at the end of the variable name.
For example: if we wanted to save the string of letters
"Your age is"
14

we could call it
a$
(string variable names can only have a single letter, other than the $,in them). Type
LET a$="Your age is "
If you now key
PRINT a$
back comes the string of letters on the screen.
If the computer hasn't been turned off since the start of this chapter type
PRINT a$;age
and see what happens.
There are other ways of getting information into the computer's memory without
using the LET command.
For example the INPUT command, in its simplest form tells the computer that
some information is expected from the keyboard. Instead of typing LET etc.
everytime, you can key
INPUT age
Once the ENTER key has been pressed a flashing Lcursor will appear on the
screen. This means that the computer wants some information from you. So type
your age and then press the ENTER key. Although nothing seems to have
happened the variable has now been given the value you typed in. Typing
PRINT age
should prove this.
Let's combine all this together into a series of commands.
Type
LET b$="What is your age?"
LET a$="Your age is "
INPUT (b$);age: PRINT a$;age
Note that the last line consists of two commands separated by a colon.
15
Chapter 4

INPUT (b$);age
is another way of entering
INPUT "What is your age?"; age
Chapter 4
16

5. Simple programming
Up to now we have been telling the computer what to do, directly from the keyboard.
Although it is possible to combine commands together, only limited applications are
feasible using this method.
The great thing about computers is that they are programmable. This means that
we can give them a series of instructions to make them do things in a sequence.
Every computer has its own language which allows us to communicate with it.
Some languages are very simple - so that the computer can understand them
easily. Unfortunately languages that are simple for the computer to understand are
difficult to humans. In some ways the reverse is also true - languages simple
enough for us to understand are relatively difficult to the computer - and even have
to be translated or interpreted.
The ZX Spectrum uses a high level language called BASIC.
BASIC stands for Beginners All-purpose Symbolic Instruction Code and the
language was designed at Dartmouth college in New Hampshire, USA, in 1964. It is
very widely used on personal computers but although it is broadly similar on all of
them there are subtle differences. That is why this manual is written specifically for
the ZX Spectrum. But ZX Spectrum BASIC is not too far from a non-existent)
consensus BASIC and so you should not have too much trouble adapting any
BASIC program to work on the ZX Spectrum. Unlike other BASICs ZX Spectrum
BASIC does not allow the command LET to be omitted when values are being
assigned to variables.
There is a limit to how many instructions can be stored in the computer. The ZX
Spectrum indicates this limit by emitting a buzz.
When programming in BASIC it is necessary to let the computer know the order
in which the instructions are to be executed, Hence each line of the sequence of
instructions has a number at its beginning. It is normal to start at 16 and to increase
this by 10 for each new line. This allows other lines to be inserted it they have been
omitted or the program to be modified.
Let's look at a simple program. Consider the series of commands at the end of the
last chapter. If we wanted to repeat the series of commands it would be necessary
to enter them each time. A program overcomes that necessity.
Type in the following with ENTER after each line.
10 LET b$="What is your age? ”
20 LET a$="Your age is "
30 INPUT (b$);age
40 PRINT a$;age
Note that it is not necessary to enter any spaces, except inside quotes.
Nothing will actually happen until we tell the computer to start working on the
program. That is done by using RUN (the keyword on R).
Enter this command and see what happens.
17

You may also have noticed a right facing arrow when each line has been entered.
This indicates the last line entered. If you want to see the program again key
ENTER again, (or LIST)You can use RUN to execute the program as many times
as you like. When you no longer need this program, you can remove it by using the
NEW command. This wipes out the program stored in memory, and gives you a
'clean slate’ ready to put in a new one.
Key NEW then LIST and see what happens.
Chapter 5
Figure 4
Figure 5
To recap:
When you type in a command preceded by a number then this tells the computer
that it is not simply a command, but a program line. The computer does not execute
it but stores it away for later.
18
Other manuals for ZX Spectrum
1
Table of contents
Other Sinclair Computer Hardware manuals
Popular Computer Hardware manuals by other brands

Profire Energy
Profire Energy PF3106-00 product manual

Seagate
Seagate Medalist SL product manual

Renesas
Renesas QB-RL78D1A2 user manual

National Instruments
National Instruments GPIB-PCIIB Getting started

AXIOMTEK
AXIOMTEK eBOX670-883-FL Series user manual

SIIG
SIIG 1 FireWire 800 CardBus DV-Ki Quick installation guide