Sinclair ZX INTERFACE 1, ZX Microdrive User Manual

Page 1
.
Page 2
ZX
and
INTERFACE 1
ZX
Designed and prepared by Cambridge Communication Limited
Note The names ZX Microdrive and ZX Interface 1 are trademarks of
Sinclair Research Limited Stanhope Road Camberley SlNrey GU15 3PS
Tel: Camberley (0276) 685311
First Edition 1983
@Sinclair Research Limited
Front cover illustration by John Harris of Young Artists
MICRODRIVE
Page 3
THE 2X INTERFACE 1.. .
incorporates the three functions of Microdrive controller, local area network and RS232 Interface. Connect it to your Spectrum and you can control up to eight Microdrives, communicate with other computers and drive a wide range of printers.
THE 2X MICRODRIVE.. .
gives you fast Access to a large memory. Each Microdrive can hold up to
100K bytes using a single interchangeable cartridge.
THIS MANUAL . . .
introduces the idea of using BASIC as an
programming
communication links, to send and receive data along them and to manipulate
files. This adds enormously to its power to perform tasks in which:
- data is stored and retrieved,
- data and programs are sent to peripherals,
-
communication links are established with other Spectrum computers or with other types of computer.
The combined use of BASIC as an operating system and a programming language gives it a power and flexibility, and also an ease of use, to be found in few larger computers.
language. This way, BASIC can be used to set up
operating system as well as a
You should read the chapters on the Microdrive even if you have not bought one, since they introduce various concepts (about their use) which you will need to understand.
This manual should only be read ZX Spectrum Introduction booklet and with chapters 1 to 22 of the BASIC programming manual.
after
you have familiarised yourself with the
channels
and .Weams and
Page 4
Contents
Chapter 1 Setting up your 2X Interface 1 Chapter 2 Setting up your Microdrive 9
handling cartridges
protecting programs and data stored in cartridges
the
cartridge lifespan
Chapter 3 Starting with your Microdrive
15
auto-run
the catalogue
loading programs
Chapter 4 Programs and the Microdrive
saving, verifying, loading and merging programs erasing programs formatting and naming blank cartridges setting up your own auto-run facility
Chapter 5
Chapter 6
Data. channels and streams
Data and the Microdrive
opening and naming a data file entering data closing a file reading back from a file
17
21
23
notes on PRINT and INPUT -separators
- changing weam
- setting colours
reading the file catalogue protecting a file
extending a file
5
Chapter 7 The Local Area Network
setting up a network programs and the network data and the network broadcasting
29
Page 5
Chapter 8
Using the RS232 Interface
connecting peripherals to the RS232 Interface t and b channels the t channel the b channel sending control codes
35
Chapter 9
Appendix 1 Appendix 2 Appendix 3 Appendix 4 Appendix 5 Appendix 6 Index
The MOVE statement
the printer .wver program
The net game System variables Microdrive and network channels
RS232 connections
Rep&S
The extended BASIC
39
41 45 47 49 51 55 59
Page 6
Page 7
Setting up your ZX Interface1
I
Unpacking the ZX Interface 1 you will have found:
-
this booklet,
-
the Interface itself (with two captive screws on the underside),
-
a ribbon cable about &ms long (for connecting the Interface to a Microdrivel,
- a lead with a jack plug at either end (for setting up a network).
To attach the Interface to your computer you should:
1. Unplug the computer.
2. Disconnect the computer from its peripherals.
3. Using a Posidrive screwdriver remove the two screws on the underside of the computer, as shown in the diagram below. (You will only need these screws again if you later disconnect the Interface from
the computer.)
cl
I
10
Page 8
4. Push the Interface edge connector firmly into the socket at the back of the computer.
5. Screw the Interface to the underside of the computer using the two captive screws supplied.
6
Page 9
The diagram below shows what the various sockets on the Interface are for.
You can now either:
-
set up a Microdrive see page 9,
or
-
set up a network see page 29,
or
- connect the Interface to an RS232 peripheral see page 35.
7
Page 10
Page 11
Chapter 2
Setting up your Microdrive
Unpacking the Microdrive you will have found:
- the Microdrive itself,
- an electrical connector (for connecting this Microdrive to another one),
-
a prerecorded demonstration cartridge.
To attach the Microdrive to the Interface, push one end of the ribbon cable
(supplied with the Interface) firmly into the socket on the side of the
Interface. Then push the other end of the cable into the socket in the side
of the Microdrive.
Page 12
If you have several Microdrives, the second one can be connected to the
first as follows.
1. Disconnect the Microdrive from the computer.
2. Turn both Microdrives upside down. You will find that each has a bracket screwed to the underside.
3. Unscrew and remove both brackets.
4. Turn the Microdrives the right way up again.
5. Push one of the electrical connectors firmly into the socket on the side of one of your Microdrives (as shown belowl.
6. Push the second Microdrive up against the first, so that the other end of the electrical connector pushes into the socket on the side of the second
Microdrive.
Page 13
7. Carefully turning the Microdrives over again, screw back one of the two brackets - but this time so that it links up the two Microdrives. (The remaining electrical connector, bracket and screws can now be kept for linking up a further Microdrive.)
8. Turn the Microdrives the right way up again, and reconnect the one on the right-hand end to the computer.
Note that the Microdrive nearest the computer is always known as
Microdrive 1, and the next along is Microdrive 2, and so on. Notice also that on the front of each Microdrive there is a light.
This will come on whenever the Microdrive is running.
Page 14
Handling cartridges Every
cartridge c~nw in a protective box; and should always be kept in its
box when not in we.
When you take a cartridge out of its box (being careful not to touch the tape itself) you will see that it has a label on the top and another on the side.
Push the cartridge firmly into the slot in the front of the Microdrive, making sure that the label on the side faces upwards. This will leave the top of the cartridge projecting by about %cm. The Microdrive and cartridge are now ready to be used.
When you have finished using the cartridge, pull it carefully out of the
Microdrive, and replace it immediately in its box. But remember.. .
NEVER TAKE THE CARTRIDGE OUT OF THE MICRODRIVE WHILE THE MICRODRIVE LIGHT IS ON.
NEVER SWITCH THE POWER ON OR OFF WHILE A
CARTRIDGE IS IN THE MICRODRIVE.
12
Page 15
Protecting programs and data stored in cartridges
If you wish to protect the programs and data stored in a cartridge (that is, prevent them from being over-written or erased) then you should snap off the plastic tab from the side of the cartridge, as shown below.
(As with a cassette, you can reverse this effect by sticking vxne tape OWI
the place where the tab has been removed.)
The cartridge lifespan
Microdrive cartridges will not last forever, and will eventually need to be
replaced. The symptom of an ageing cartridge is that the computer will take
longer and longer to find a program or file before loading it. So it is a good idea to keep back-up copies of important programs and files either on another
cartridge, or on a carsette.
13
Page 16
Page 17
Starting with your Microdrive
Auto-run
Now that you have set up your ZX Interface 1 and your Microdrive, you
will want to know what programs are waiting for you on the demonstration
cartridge. So. insert the cartridge into the Microdrive (or, if you have several Microdrives, into Microdrive 1). and enter:
NEW
followed by:
RUN (and ENTER)
This will automatically load and run the first program on the cartridge. When you have finished watching this program, read on.
The catalogue
To find out what other programs are stored in the demonstration cartridge, enter the CAT&ague statement:
CAT 1
I
1 identifies the number of
the Microdrive you are using
In about seven seconds the television screen will display:
-
the name of the cartridge,
-
an alphabetical catalogue of the names of all the files stored in the cartridge,
-
the amount of memory left in the cartridge (in kilobytes).
15
Page 18
Loading programs
The next thing to do is LOAD whichever program you would like to st!t! next.
So, first choose your program, then enter:
After a short pause, the screen will display the OK message (though not the name of the program). You can now run the program.
Page 19
Programs and the Microdrive
Saving, verifying, loading and merging programs
In the ZX Spectrum Introduction booklet you found out how to SAVE
programs on a cassette tape. Saving programs in cartridges is iust as easy. Here
again is a program called Squares, much like the one in the Introduction
booklet:
10 REM Squares 20 FOR n=l TO I0 30 PRlNTn,n++n 40 NEXT n
To SAVE this on a cassette tape you would enter:
SAVE “Squares”
To SAVE it in the cartridge in Microdrive 1, you enter instead:
SAVE *“m”;l :“Squares”
After about six seconds the border will flash, and the program will be saved. Try it and see.
(The names of programs stored in a cartridge, like those of programs stored on a cassette tape, can be up to ten characters long.)
As you would expect, you can now check that the program has been saved by
entering:
VERIFY W”m”;l:“Squares”
The screen will then display the OK message.
You can now LOAD the program Squares by entering:
NEW
followed by:
LOAD *“m”;l ;“Squares”
then:
ENTER
17
Page 20
Next, to make the program run automatically, try entering:
SAVE Y”m”;l;“Squarer 2” LINE 10
then:
NEW
and then:
LOAD++“m”;l:“Squares 2”
Programs can also be merged using a Microdrive. Enter:
NEW
followed by:
1bB REM more Squares 1lQ FOR n=ll TO 20 120 PRINT n,n*n 13Q NEXT n
And now enter:
MERGE *“m”;l;“Squares”
then:
ENTER
The program Squares will be added to the listing.
In short, as you have probably already realised, all the syntax used within an ordinary cassette interface (explained in chapter 20 of the BASIC programming manual) applies also to the Microdrive.
Erasing programs
Suppose you have just finished with the program Squares. To erase it, enter:
ERASE “m”;l;“Squares”
(As before “m”;l simply indicates which Microdrive you are using.) During the ERASE statement the border will flash, If you BREAK while saving a program then you will have an unclosed file
in the cartridge. You cannot LOAD an unclosed file, and an attempt to do so will give the report file not found. The ERASE Statement can delete an unclosed file, but will take about thirty seconds to do so because the compute!
checks the cartridge several times to make sure that the file has no end.
IS
Page 21
Formatting and naming blank cartridges
If you have bought a blank cartridge, before you can use it you must insert
it into a Microdrive (say, into Microdrive 11 and enter this:
FORMAT “m”.l ~“name”
The computer takes about thirty seconds to format a cartridge. During this time the border will first flash, then clear, then flash again, and finally display the OK message. What the computer is doing is identifying any areas
that cannot be written to or read from and marking them to be avoided.
Formatting need never be repeated. Note, by the way, that when you format a cartridge, any information it contains will be erased. So, if you have bought several Microdrives,
and use them as blank cartridges. Next type:
, ,
I \
you can FORMAT
your spare demonstration cartridges
CAT 1
I
1 identifier the “umber Of
the Microdrive you
In a few seconds, the television screen will display the cartridge’s name and its capacity. The capacity will vary from cartridge to cartridge, but it should
never be less than 85 kilobytes.
are
using
19
Page 22
Chapter 4
Setting up your own auto-run facility
Earlier, you used the auto-run facility on the demonstration cartridge. If you have a program that you often use, you can set up your own auto-run facility, so as to avoid repeatedly having to type the LOAD and RUN
statements. These are the rules to follow:
-
the program must be called run;
- the cartridge must be used in Microdrive 1;
- the facility must be used either immediately after switching on,
or immediately after entering NEW.
So, enter the required program, followed by:
10 SAVE %-“m”;l;“run” LINE number
the name run rn”Sf be typed Olaf in ‘“Il. DO not j”If pres rile RUN key
Now enter:
NEW
followed by:
RUN (and ENTER1
I enter the ke”vdord, not the file name
Note, however, that the MERGE statement does not work with any program
saved using the SAVE?+. LINE statement. (This is so as to protect such
programs.) An attempt to MERGE will give the report ‘Merge’error.
I \
enter here the appropriate line number
20
Page 23
Data, channels and streams
As you know, a program is a set of operations which is executed when you type RUN. Data, on the other hand, is any collection of letters, numbers or symbols on which a program might operate. An example is the numbers
1 to 10 with their squares. Data can be sent to, and come from, various parts of a computer system
Such parts are known as channels. The channels you can send data to are:
- your screen,
-
a ZX Printer,
-
a Microdrive file, to store it,
-
another ZX Spectrum computer, if both computers are on a network.
-
the RS232 Interface and from there, for example, to a modem or printer.
And the channels from which data can come are:
- the keyboard,
- a Microdrive file,
- another ZX Spectrum computer, if both computers are on a network,
- the RS232 Interface, a modem or a terminal. The routes along which the data flows to and from these channels are
known asstreams. In the Spectrum computer system the number of these
streams is fixed at sixteen. They are numbered from 0 to 15, and stream
numbers are always preceded by the sign X
Four of these streams come already linked to channels:
stream # 0 stream Xl stream #2 outputs to the upper part of the television screen,
stream #3 outputs via the ZX Printer; but cannot input.
output data to the lower part of the television screen and
but cannot input;
input
from the keyboard;
21
Page 24
Chapter 5 Chapter 5
Every statement that produces input or output uses one of these streams Every statement that produces input or output uses one of these streams
automatically. For example, the PRINTstatement uses stream #2. and the automatically. For example, the PRINTstatement uses stream #2. and the
LPRINT statement uses stream #3. So, if you enter: LPRINT statement uses stream #3. So, if you enter:
PRINT “This is a Spectrum computer” PRINT “This is a Spectrum computer”
it is. in fact, shorthand for:
PRINT # 2;“This is a Spectrum computer” Try entering both, and see, You can, however, make any statement use a different stream by keying #
followed by the new stream number. Try entering:
LPRINT 8 2;“This is a Spectrum computer”
Instead of being printed by the ZX Printer, this line too appears on the
screen.
But as well as using the established stream-channels, you can create some of
your own. Streams#4 to #15 are free for this purpose; and there are various
channelspecifiers which enable you to indicate which peripheral you require.
Some of these are:
“K” for the keyboard “S” for the screen
7”’ for the 2X Printer. (You will be introduced to the others later.) Note that K, S and Pare all established channels. They require you to use
commas (,) as separators in OPEN # statements. But with other channels YOU
can use either commas or semi colons I;). To create your own stream-channels you use the OPEN # statement. For
example enter:
10 OPEN# 4,“s”
You will have opened stream 4 and linked it to channel S. Now enter:
20 PRINT* 4: “This is a Spectrum computer”
Again, the line will appear on the screen. (It is not advisable to OPEN to streams 0, 1 or 2 as the results are unpredictable.1
22
Page 25
Data and the Microdrive
Opening and naming a data file
When you store information in a cartridge you keep it in a file. You also give the file a name so that you can find it again later. The statement that opens
and names a data file always takes the same form. For example try entering:
OPEN #4:“m”;l;“Numbers”
I\\
This statement does two distinct jobs:
- it sets up a new channel: “m”;l;“Numbers”
- it attaches this new channel to stream # 4.
This will have taken about seven seconds, during which time the computer searches the cartridge for a file called “Numbers”. Since there is no file “Numbers”, it opens a file for writing. (However, if it had found a file “Numbers”, it would have opened it for reading. And had it found a
program “Numbers”. it would have given the report Wrong file type.)
Entering data
Once you have opened a file you can enter data. Suppose that you want to store the numbers 1 to 10 with their squares.. Enter and run this:
10 FOR n=l TO 10 20 PRINT #4,n’nYn 30 NEXT n
You might think that all the numbers have now been stored away in the cartridge. But in fact the computer does not automatically transfer anything to the cartridge until a certain amount has built up, which it transfers all at
once. This is called buffering. A Microdrive buffer is 512 bytes (or characters)
long.
To store in the cartridge the data you have entered you must CLOSE the file.
Until this is done you will be unable to read back from the file.
23
Page 26
Closing a file
Closing a file ensures that the file is safely stored in the cartridge. It also
closes the channel (in this case “m”;l;“Numberr”) and leaves the stream
(in this case* 4) with no channels attached. To CLOSE a file YOU need only
CLOSE the appropriate rtream. So enter:
CLOSE # 4
The border will then flash to show that something is being stored in the
cartridge.
(Note that, like the OPEN statement, the CLOSE statement is followed
autamatically by# .I
You cannot, by the way. CLOSE streamsX0, #l. #2 or X3. If you try to do so, streams X0 and #l will default to channel K; stream # 2 will default to channel S; and stream #3 will default to channel P (see page 22).
Reading back from a file
To read back from the file “Numbers”, run this:
10 OPEN #4:“m”;l;“Numbers”
20.FOR b=l TO 10 30 lNPUTX4;m;n
“5; p;The Square of Tim;” , is , “a
60 CLOSE # 4
RUN
(Note at this point that because the file “Numbers” already exists, the channel “m”;l;“Numberr” is opened for input, and trying to output it would give an errOr.)
You can also use INKEY$ to read back from a file lit always gives the next
character in the file). Try this program:
10 OPEN # ll;“m”;l;“listing” 20 LIST *ll 30 CLOSE X11
40 OPEN X 12;“m”;l ;“listing”
50 PRINT INKEY$ HZ; 60 GO TO 50
This will finish with the End of file report.
24
Page 27
Notes on PRINT and INPUT
Because the PRINT and INPUT statements are designed mainly for use with
the screen and keyboard, you must take care when using them with files.
The PRINT statement uses three forms of separator:
- the ; (semi colon) prints nothing,
- the, (comma) takes you to the start of the next half line,
-
the ’ (apostrophe) gives a new line (the ENTER code).
The INPUT statement always expects you to type ENTER after a number or a string. So. when you are printing to any file from which you expect to INPUT,
you must either:
- print the items singly, e.g. 10 PRINT #4;2
20 PRINT #4;3
- separate them with an apostrophe, e.g.
10 PRINT#4;2’3
You must also take care when using separators in an INPUT statement. As you know, INPUT can print to the bottom half of the screen anything that you
can put in a PRINT statement. But when you INPUT from a file, the file is
only open for reading. So, if you include anything that would be printed when using the screen, you will get the error report Writing to a ‘read’ file. This means that items in the INPUT statement should be separated with a semi
colon, e.g.
10 INPUT #4:a:b
Be careful also when you INPUT a string containing ” (quotes), because the
INPUT will think that the ” is the end of the string. The way round this is to
replace, for example:
10 INPUT#4;a$
with
10 INPUT#4; LINE a$
25
Page 28
changing sfrearns
PRINT statements may also contain information for several strearm at a time.
The following program will print “one” on the screen; “two” to a Microdrive file called “digits” in Microdrive 1; “three” to station 1 on a network (see chapter 7); and “four” to the next line on the screen.
10 OPEN #4:“m”;l:“digits” 20 OPEN # 5:“n”;l 30 PRINT “one”; #4;“two”;#5:“three” ’ X 2”four”
40
CLOSE #4
50
CLOSE #ki
setting colours
After using a channel other than the screen, you may find that the PAPER and INK statements have no effect. To get round this, enter:
PRINT;
before setting PAPER and INK.
For more about PRINT and INPUT see chapter 15 of the Basic Programming manual.
26
Page 29
Reading the file catalogue
As you establish files in a cartridge they are automatically catalogued. So,
when you want to find out what files a cartridge contains, you need only
insert the cartridge into a Microdrive and enter the CATalogue statement. For example, enter:
CAT 1
The television screen will display:
-
the cartridge name,
- the file names,
- the amount of memory left in the cartridge, (in kilobytes). You can also send the output of CAT to a stream by entering:
CAT # number;number
I \
This enables you to rend the catalogue to a printer, or to a file, so that a program can use it.
Protecting a file
If you do not want a file name to appear on the catalogue, you can protect it by giving it a name beginning with the character whose CODE is 0. Enter this:
10 OPEN #4,“m”;l;CHR$0+“Results”
20 FOR n=l TO 15 30 PRINT #4;n,n)cn 40 NEXT n 50 CLOSE +4
Now enter:
CAT 1
The file name will not appear. So, whenever you create a protected file. remember to make a note of its name somewhere, in case you forget it later!
27
Page 30
Extending a file
Suppose that you want to extend the file “Numbers” to include the squarer of the numbers 1 to 20 instead of only 1 to 10. You cannot writing, so you will have to:
-
make a new version with a different name;
-
transfer the old file to the new version;
-
add the extra data;
- delete the old file. Here is how to do it. First, RUN this program:
10 OPEN #4;“m”;l;“Numbers”: REM for reading 2Q OPEN # 5;“m”;l;“Numbers 1”: REM for writing 30 FOR f=l TO l@ 40 INPUT # 4;m;n 50PRlNTX5;m’n 60 NEXT f 74 FOR n=ll TO 20 80 PRINT X 5;n’nX-n 90 NEXT n
100 CLOSE X4:CLOSE Y 5
Now, to check that you have got two files, “Numbers”and “Numbers 1”.
enter:
reopen a
file for
CAT 1
Next, to delete the old file, enter:
ERASE “m”~l~“Numbers”
I I
To check that it has been deleted, enter:
CAT 1
The file name “Numbers” will have disappeared from the catalogue, and
your new file, “Numbers 1” now contains the numbers from 1 to 20.
Page 31
Chapter 7
The Local Area Network
Setting up a network
The local area network, or net, enables you and your friends to play computer games together, and to send each other programs and data. This means that only one of you need ever type in a program. A net is especially useful. too. if only one of you has a Microdrive.
Using the lead supplied with each Interface you can link up as few as two and as many as sixty-four Spectrum computers, as shown below.
Note, however, that you and your friends should not form a loop of
computers: the computers at each end of the net should never be connected to each other. Each should be left with one net socket free.
NEVER SWITCH ON OR OFF A SPECTRUM WHICH IS ON A NET WHILE COMMUNICATION IS IN PROGRESS. You may, however, have a switched off Spectrum on the nei; and you may also switch on or off Spectrums which are on a net provided that communication is
not in progrf?s.
29
Page 32
When you have set up a net, each computer (orstarion) should be given a different identification number. So, first decide with your friends what number each station is to have, and then each of you should enter:
FORMAT “n”;number
I
enter here the station number you have chore”
Note, incidentally. that if there are only two computers on a net, both can use the same station number. And, since both computers, when switched on, become station 1 automatically, there is no need to use the FORMAT statement at all.
Programs and the network
Let us suppose that you have a friend called Jack and that both of your
computers are on a net. Your station number is, let us say, 1, and Jack’s is 2. Suppose that you want to send Jack this program:
10 REM roots 20 FOR n=l TO 10 30 PRINT n,SQRn
40 NEXT n
Enter the program, followed by:
SAVE Q “n”;Z
(Notice that the net does not use program names.) Meanwhile, Jack should enter:
FORMAT “n”;2
followed by:
LOAD +?“n”;l
Jack will now have a copy of the program. Notice, though, that while the
computer is waiting to SAVE or LOAD a program over the net. the border
of the screen goes black until the program is sent. Your computer will not send until Jack’s is ready, and Jack’s will wait until something is sent. Try entering your SAVE line before Jack enters his LOAD line, and vice versa.
30
Page 33
Chapter 7
To verify that Jack now has a copy of your program, he should enter:
VERIFY*“n”;l
while you repeat the sending of the program by entering:
SAVE++“n”;2
SAVE is. in fact. the only statement that sends programs over the net. The
LOAD, VERIFY and MERGE statements are all ways of receiving programs.
The net game in Appendix 1 is a good example of how to use programs with a network.
Data and the network
Suppose that you now want to send Jack some data. The statement OPEN #4;“n”;2 opens a channel to station 2 on the net l”n”1, and attaches stream #4. to it, so that when you output along stream #4. your message will be put on the net with a note saying that it comes from you.
(Conversely, were you to enter lNPUT# 4;“n”;Z your computer would wait for information addressed to you from Jack.)
Now enter this program:
10 OPEN #4:“n”;2: REM for output
20 INPUT a$: PRlNT#4;a$ 30CLOSEx4 40 OPEN X4;“n”;2: REM for input 50 lNPUTt4;bS: PRINT b$ 60 CLOSE X4 70 GO TO 10
Then enter:
SAVE -%“n”;2
31
Page 34
Now ask Jack to enter:
FORMAT “n”;2
then:
LOAD ++%“;I
You should now run your program, and Jack should edit lines 10 and 40 of the program to make them refer to station 1 not station 2. He should then enter:
GO TO 40
You are now ready to start a conversation. But before you do so there are three things you should know.
Your output along stream # 4
put on the net until a certain amount of output has accumulated. So whenever you finish outputting you should CLOSE the stream. This will send the buffer even if it is not full. (The buffers are 255 bytes. or characters, long.)
- Your output is marked as coming specifically from you, so that if Jack is inputting or waiting for output from a different net channel. your
message will be ignored. If your message not display the OK message, and the border of the screen will go black, until Jack asks to receive the message.
- Though the INPUT statement simply waits for something to be sent, the INKEY$ statement can be used to read the net. It will then return with
the first byte of anything that either has been sent. or is waiting to be sent,
(Otherwise it will return the empty string.) This is known as polling. (INKEY$, in fact, works the same way with the net as it does with the
keyboard.1
The program below will print anything bein,g sent to it by station 1:
10 OPEN # 8;“n”;l 20 PRINT lNKEY$ #8;
30 GO TO 20
(For more on INKEY$ see chapter 18 of the BASIC programming manual.)
is
buffered:
that is, it is not automatically
has
been ignored your screen will
32
Page 35
Chapter 7
Broadcasting
There is also a special net channel called broadcast whose channel specifier is
“n”;@. When you input from this channel you will pick up any message that is being broadcast. And when you output, your message can be read by anyone who is inputting from channel “n”;O.
This could, for example, be very useful at school if every pupil in a class has a Spectrum computer, but only the teacher has a Microdrive.
Suppose the teacher wished to broadcast a program. First, the pupils should enter:
LOAD St-“n”;Q
This will leave the pupils ‘waiting’ to receive the program. The teacher should
then save the program by entering:
SAVE -X”n”;Q
As you may have guessed, broadcasts (unlike private messages) are sent at
once, and do not wait for other computers to be ready to receive them.
Note, by the way, that when you send a broadcast, the computer does not
let you know if anyone has received it.
Note also that INKEY$ will not poll the broadcast channel. Like INPUT,
it will simply wait for something to be sent.
33
Page 36
34
Page 37
Chapter a
Using the RS232 Interface
Connecting peripherals to the RS232 Interface
As you know, the Spectrum character set comprises both single symbols (letters, digits, etc.) and compound tokens (keywords, function names. etc.). All these characters can be sent and received by the RS232 Interface to and
from any compatible serial device; for example, a printer, a modem or another
RS232 Interface connected to a different kind of computer.
To connect any of these peripherals to the RS232. you should use a lead
with a B-way D-plug on one end and an appropriate plug for your peripheral
on the other. You should insert the D-plug into the back of the RS232, as shown below. (For wiring details, see Appendix 4, page 49.)
Next, before you can use the RS232 you will need to adjust some of the
settings on the peripheral. These may include:
- the auto line feed, which should normally be switched to off. (The Spectrum outputs a carriage return and a line feed on a “t” channel but a carriage return only on a “b” channel. These t and b channels are explained below.)
-
the parity on/off, which should be set to off.
- the number of bits, since the Spectrum puts out eight bits.
- the number of stop bits, since the Spectrum puts out one stop bit.
35
Page 38
- the baudrate (i.e. the number of bits per second). The Spectrum can operate at all the standard baud rates, i.e.:
5O.l1O,3OO,6OO,12OO,24OO,48OO,96OO and 19,200.
You should set your peripheral to use the highest baud rate of which it is
capable. (You will see later how to set the Spectrum to use the same baud
rate.)
For an explanation of how to make there adjustments, consult the instruction
book supplied with your peripheral.
t and b channels
The RS232 uses two different channels: the t channel and the b channel,
The t channel
The t (or text) channel is normally used to send listings. Channel t has the
following effect on the character set:
0-31
(the control codes) are not sent, except for 13 (carriage return)
which is sent as 13 followed by 10 (carriage return and line feed).
32-127
128-164
(the ASCII codes) are sent as normal. (the graphic characters) are not sent. The message ? (code 63) is
sent instead.
165-255 (the tokens) are expanded into ASCII codes 32-127.
On INPUT and INKEY$ the t channel expects 7 bit characters, so it ignores
the 8th bit if there is one.
To use the t channel, first you must tell the computer which baud rate to use. so enter:
10 FORMAT
“t”;baud rare
I enter here the baud rate you have set your peripheral to ure
36
Page 39
Now to OPEN a stream to it, enter:
20 OPEN X3;“t”
30 LLIST
The border of the screen will flash and the listing will be sent to the peripheral.
(Notice that LLIST is shorthand for LIST #3.) Now enter:
LPRINT “This is a short message.”
This message, too, will be sent to the device.
If your ZX Interface is connected to a terminal or an RS232 device capable of
sending, then you can INPUT from the terminal or device. Enter this:
10 FORMAT “t”:baud rate 20 OPEN #4:“t” 30 PRINT INKEY$ s.44; 40 GO TO 30
Now, whatever you type on the terminal or device will appear on your screen.
-enter here the baud
The b channel
The b (or binary) channel sends the full 8 bit codes used by the Spectrum, and allova you to send control codes to printers etc.
With INPUT and INKEY$ the b channel expects 8 bit characters.
SAVE and LOAD will only work with the b channel
If you are using modems to connect your computer with another Spectrum
over a ‘phone line; or if you are storing your programs on a different kind of
computer which also has an RS232 Interface, you may well want to SAVE
and LOAD over the RS232 Interface. To do this, enter:
FORMAT “b”:baod rate
I
Now, for example, enter:
10 REM figures 20 FOR n=l TO 10
30 PRINT n,n*RND 40 NEXT n
SAVE -%“b”
37
Page 40
If this program is being sent via a modem, saneone at the other end should
enter:
LOAD *“b”
The usual extensions are also possible, such as:
SAVE Y”b”;SCREEN $
and:
SAVE W’b”; LINE number
Sending control codes
Many printers allow you to send instructions for such operations as double width printing. To send these you should use the b channel. However, with the b channel, the carriage return does not include a line feed. So you will have either to change the settings on your printer, or print the line feed
code: 10.
For example, suppose that the control code for double width printing is 14. Enter:
10 OPEN X4; “b” 20 PRINT* 4; “Normal width” 30 PRINT #4;CHR$14;“Double width”
40
CLOSE #4
(For the correct control codes to use, refer to your printer’s instruction book.1
You can have both b and t channels open at once. Try entering this:
10 OPEN #5:-b”
20
OPEN 3t6;“t”
30PRINT#5;CHR$14;
40LIST#6
50 CLOSE #5: CLOSE #6
This would give you a double width listing.
38
Page 41
The MOVE statement
So far, you have only been able to move data from a program to a channel or vice versa. The MOVE statement, however, enables you to move data from one channel to another. For example, to move data from the keyboard to the screen, enter:
10MOVE#lTO#2
then:
RUN
Anything you type on the keyboard will now appear on the screen. However, you will discover that when you press BREAK this only prints a space on the
screen. To escape from this trap, press ENTER until the print position reaches
the bottom of the screen. Then, when the computer asks scroll? you should press BREAK. (You should, by the way, avoid moving data from the keyboard to any other stream since you may be unable to BREAK out of such a mode.)
Using the MOVE statement you can also examine files stored in cartridges.
For example, set up the file “Numbers” (see page 23) and then, to
examine its contents, enter:
10 MOVE “m”:l;“Numbers” TO #2
(Note that you need not OPEN or CLOSE the file yourself. MOVE does this.) Similarly, to make a copy of the file “Numbers”enter:
10 MOVE “m”;l;“Numbers” TO “m”;l;“Numbers 2”
Here, MOVE opens a stream for reading from the existing file (“Numbers”) and another for writing to the new file (“Numbers 2”). Next, it reads the data in “Numbers” and writes it out in “Numbers 2”. Then it closes both streams.
MOVE will work with stream numbers (such as #41, and with channel specifiers (such as “m”;l;“Numbers”J. Note, however, that the established streams, #l to #3, may not be specified by the channel specifiers K, S or P.
If you have a second Microdrive. you can use the MOVE statement to make
back-up copies of data in another cartridge. Enter:
10 MOVE “m”;l;“Numbers” TO “m”;2;“Numbers 2”
(Note that MOVE only works with data files. If you want a back-up copy of a program, you must LOAD the program. and then SAVE it.)
39
Page 42
It is sensible to make back-up copies of any data or programs you want to keep.
The MOVE statement can also send files to a printer. So if you have a
ZX Printer, enter:
10 MOVE “m”:l ;“Numberr” TO # 3
The
Printer Server program
This program allows one Spectrum on a “et to control a” RS232 printer. The printer can then be used by all the other computers on the “et. This is useful, for example, if a group of people using Spectrums have only one high quality printer among them which they wish to share. The program also
shows a powerful “se of the MOVE statement.
The Printer Server computer must always be station 64, and must always make contact with station 62 (which is a contact-establishing station). So the
sender temporarily uses station 62, and sends it his real station number from
which it then moves a file to the t channel. To set up a Printer Server station
use this program:
IO FORMAT “n”;64 20 OPEN #4;“n”;62: INPUT #4;a$: CLOSE #4 30 MOVE “II”; CODE a$ TO “t” 40 OPEN X4;“b”: PRINT x~;CHR$ 12: CLOSE X4: RUN
(Line 40 sends a form feed.)
The program below is the one the” used by the sender. First, the sender’s station is temporarily set to station 62. Then, the sender’s real station number is sent. Next the sender’s station sets itself back to its real number. Last, line 60 sends whatever data is to be printed (in this case. the listing).
10 LET rtation=number
enter here the renc3er.r
real Ifation number
20 FORMAT “n”;62 30 OPEN~X4;“n”;64: PRINT #4;CHR$ station: CLOSE #4
40 FORMAT “n”;rtation
50 OPEN #4:“““;64 60 LIST #4
70
CLOSE #4
40
Page 43
The net game
There is a copy of this game on the demonstration cartridge supplied with the Microdrive. Its file name is “net game”. The program gives a good example of how the net can be used. Parts of it might usefully be included
in programs of your own.
The game
To play this game. you and your opponent must each think of a number between 1 and 100. The winner of the game is the one who guesses his opponent’s number first. At each guess you make, your computer will tell you how close you are getting.
The program
The subroutine at line 500 decides who is user 1 and who is user 2. This is
so that, when you exchange guesses, one of you uses the subroutine at
line 1100, and the other uses the subroutine at line 1200; and thus user 1
sends first and user 2 receives first.
Your computer decides who is user 1 by sending your opponent’s computer the message “1”. and then listening. If it receives back a “1”. this means that your opponent’s computer was switched on after yours. Your computer therefore rends a “2” to your opponent’s computer, and makes itself user 1.
(If, on the other hand, your computer receives back a “2”. this means that
your opponent’s computer was already switched on and listening when your
computer sent the “1”. Your computer will therefore make itself user 2.)
If both computers start at the same time they will collide and it will be
necessary to BREAK and start again. The body of the program is involved with exchanging names, inputting the
secret number (which is not sent) and then comparing guesses. First, guesses are sent, and then the replies.
Lines 190 onwards detect a win, signal it appropriately, and then offer
another game.
41
Page 44
10 GO SUB 500 20 PRINT; : BORDER 1 : PAPER 1 : INK 7 : CLS 30 PRINT ” Number guessing game” ’ ’ ”
then guess your opponent’s” 40 INPUT ‘What is your name?“;& 50 PRINT 60 GO SUB 1000+100*user 70 PRINT “You are playing”;b$ 75 PRINT ‘a$, b$ 80 lNPUT”Think of a number (I to 100)“;a 90 IFa<lORa>l00ORa<>INTaTHENGOTO80
130 INPUT “Make a guess”;b 140 LET a$-STR$b : GO SUB 1000+100 user 150 LET c=ABS (a-VAL b$) 160 IF c=0 THEN LET a$=“Right”: GO TO 170 161 IF c<4 THEN LET a$=“Very very close”: GO TO 170 162 IF ccl0 THEN LET a$=“Very close”: GO TO 170 163 IF c<20THEN LET a$=“close”: GO TO 170 164 IF cc40 THEN LET a$=“fairly close”: GO TO 170 165 IF cc60 THEN LET a$=“not very close”: GO TO 170 166 LET a$=“nowhere near” 170 GO SUB 1000+100++user 780 PRINT bS,a$
190 IF c=0 OR b$=“Right” THEN GO TO 210 200 GO TO 130 210 IF b$=“Right” THEN PRINT FLASH 1;“Victory”: FOR n-0 TO 7 :
BORDER n: BEEP.l,n:BEEP.l,n+l6:NEXTn:GOTO230
220 PRINT ,“Defeat”: FOR n=7 TO 0 STEP -1: BORDER n :
BEEP.2.n: NEXT n
230 BORDER 1 : INPUT “Another game? (~/#‘;a$ 240 IF a$=“‘~” THEN RUN 20
499 STOP 500 OPEN #4;%“;0
510 PRINT#4:“1” 520 CLOSE X4
530 OPEN #4;“n”:0 540 INPUT #4;a$ 545 CLOSE #4 550 LET a=4 : IF a$=‘?” THEN OPEN #a;“n”;B: PAUSE 5: PRINT#4;
“2”: LET user=1
560 IF a$=‘? THEN LET user=2
’ ’ “Hello”;a$
First enter your secret number,
42
Page 45
570 CLOSE #4
580 FORMAT “n”;user: RETURN 1100 OPEN *4;“n”;3-user Ill@ PRINT#4;& 1120 CLOSE*4 1130 OPEN #4;%“;3-us% 1140 INPUT #4;b$ 1150 CLOSE*4 1160 RETURN
1200 OPEN # 4;%“;3-user 1210 lNPUT#4;b$
1220 CLOSE #4
1230 OPENX4:“n”;3-user 1240 PRINT #4;a$ 1258 CLOSE #4 1260 RETURN
43
Page 46
44
Page 47
System variables
In addition to the system variables given in Chapter 25 of the Spectrum BASIC programming manual, the Microdrive. local area network and RS232 software use the system variables below.
NOtC?A
Xl x2 x10 2
1 23749 NTSTAT
1 23750 IOBORD
N2 N2 N2 1 1
1 x2 Nl
Xl Nl
Nl N2
Nl Nl N2 N2 NB
Nl
Address Name
23734 FLAGS 3 23735 VECTOR 23737 SBRT 23747 BAUD
23751 SER-FL 23753 SECTOR 23755 CHADD­23757 NTRESP 23758 NTDEST
23759 NTSRCE 23760 NTNUMB 23762 NTTYPE 23763 NTLEN 23764 NTDCS 23765 NTHCS
23766 D-STRl
23768 S-STRl 23769 L-STRl 23770 N-STRl 23772 23774 D-STR2
23782 HD-00
Contents
Flags
Address used to extend the BASIC interpreter
ROM paging subroutine Two byte number determining the, baud rate calculated as follows:
BAUD=(3500000/(26*baud rate))-2 You can use this to set up non-standard baud rates Own network station number
Border colour used during I/O You can POKE any colour you want 2 byte workspace used by RS232 2 byte workspace used by Microdrive Temporary store for CH-ADD Store for network response code
Beginning of network buffer
contains destination station number 0-64
Source station number
Network block number 0-65535
Header type code
Data block length 0-255
Data block checksum
Header block checksum Start of 8 byte file specifier 2 byte drive number 1-B Stream number 1-15 Device type “m”, “II”, “t” or “b”
Length of filename Start of filename Second 8 byte file specifier
used by MOVE and LOAD commands Start of workspace for SAVE, LOAD, VERIFY and MERGE data type code
45
Page 48
Appendix 2
Notes Address Name contents
N2 N2 N2 23787 HD-OF Program length 0-65535 N2 23789 HD-11 Line number 1 23791 COPIES Number of copies made by SAVE
23783
23785 HD-QD Start of data 0-65535
23792 Start of Microdrive MAPS or CHANS
HD-‘38
Length of data 0-65535
WARNINGS
1. Opening a stream to the Microdrive or net requires a certain amount of free memory with which to create a channel. A Microdrive channel is 595 bytes, and a net channel is 276 bytes. These channels will be created either by OPEN#, MOVE or by SAVE/LOAD/VERIFY/MERGE. This meant
that an existing program with insufficient room below RAMTOP will give
the report Out of memory to any of these operations.
2. Another effect of the creation of these buffers is to move machine code stored in a REM statement. This may create problems. So always put machine
code programs above RAMTOP.
3. It is inadvisable to BREAK during a Microdrive write operation (one during which the border is flashing), since you may end up with an unclosed file. ERASE will remwe unclosed files, but will take about thirty seconds to do so, as the computer checks the cartridge several times to make sure that
the file has no end.
46
Page 49
Microdrive channel‘
Every time a file is opened an area called a CHANNEL is created in the area designated CHANS in the BASIC programming manual. This area is usually addressed by the IX register in the software. The channel has a length of
595 bytes. and contains the 512 byte buffer. The contents of the channel are as follows:
0
2
4
5 7 9
11
13 CHREC
14 CHNAME
24
25 CHDRIV
26 CHMAP
28
40
41 42 44
54
55
67 RECFLG
68 RECNUM Number of this record in the range 0-255
CHBYTE Current byte counter indicates the next byte to be
CHFLAG
CHMAP
HDFLAG
HDNUMB
HDNAME HDCHK
Address 8 Address 8 ‘M’ Address of output subroutine in ROM Address of input routine in ROM Address 595
added or removed from the data area in the range 0-512 inclusive
Record number. Indicates the position of the record in a file range 0-255 10 byte filename with trailing spaces Flag byte bit 0 set. open for write
clear. open for read
bits l-7 unused
Drive number Address of the MAP for this Microdrive
12 bytes of header preamble marks the start of
the header workspace
Flag byte bit 0 set
Sector number in range 0-255 Unused Cartridge name and trailing spaces Header checksum 12 bytes of data block preamble.. marks the start
of the data workspace
Flag byte bit 0 = 0
0-J
bits l-7.. unused
bit Z=not a PRINT file bits 3-7 unused
47
Page 50
69 RECLEN Number of bytes of data in this record &512
71 81 82
594
MAP
For every Microdrive containing an opened file there is an area called a MAP
created in the area called “Microdrive maps” in the BASIC programming
manual. The MAP contains 32 bytes. Each bit corresponds to a sector on the corresponding Microdrive. If that sector contains data or if it is unusable then the bit is ret. The bits are numbered as follows: bit 0 byte 0 = sector 0,
bit 1 byte 0 =sector 1, bit 0 byte 1 = sector 8. and so on.
RECNAM Filename with trailing spaces DESCHK CHDATA DCHK Checksum of the preceding 512 bytes
Checksum of the preceding 14 bytes 512 bytes of data
Network channel
When a stream is opened to the network, a channel is created in the area designated CHANS in the BASIC programming manual. This area is usually
addressed by the IX register in the software. The channel has a length of
276 bYtes, and contains the 255 byte buffer. The contents of the channel are described as follows:
0
2
4 5 7
9 11 12 13 15 16 17 18 NCHCS 19
20 21 NC6
49
NCIRIS NCSELF NCNUMB NCTYPE NCOBL NCDCS
NCCUR NCIBL
Address 8 Address 8 “N”
Address of output subroutine in ROM Address of input subroutine in ROM Address 276
The destination station number
This SPECTRUM’s station number The block number The packet type code. .0 data, 1 EOF
Number of bytes in the data block The data checksum Theheaderchecksum The position of the last character taken from the buffer The number of bytes in the input buffer A 255 byte data buffer
Page 51
RS232 connections
The RS.232 socket is wired as follows:
1. No connection
2. TX data (input)
3. RX data (output)
4. DTR (input) this should be high when ready
5. CTS (output1 this should be high when ready
6. n.c.
7. Ground (pull down)
8. n.c.
9. +9v (pull up)
An RS232 cable is available from Sinclair Research. which connects the 9 way D-socket to a 25 way D-plug (25 way D-sockets are comma” on
RS232 peripherals). For details of how to obtain this cable, see the software and peripherals catalogue included with the ZX Interface 1. This cable is wired as follows:
2. TX data
3. RX data
5. CTS
6. +9v (normally DSR)
7. Ground
20 DTR
49
Page 52
50
Page 53
Reports
Now that you have attached a ZX Interface 1 to your computer, your programs may produce reports which are not described in Appendix 6 of the BASIC programming manual. Suctc reports will be followed by the line number and statement number at which the program stopped.
These new reports are explained (in alphabetical order) below.
Code error
You have tried to LOAD a code block that is larger than the destination area
specified by your LOAD statement.
Drive ‘write’ protected
You have tried to write data to a Microdrive containing a protected cartridge (i.e. one with the plastic tab on the side removed).
File not found
This means that either you have tried to LOAD from a file which does not
exist. or part of the file cannot be found. (This would either be because the
file has not been closed, or because the file has been damaged by the power being switched on or off while the cartridge was in a Microdrive.)
Invalid device expression
A device has been specified other than s,p,k,m,n,t or b. The same report can be produced if a semi-colon, rather than a comma, is used with one of the channels
s,p or k.
invalid drive number
A Microdrive number has been specified outside the range 1 to 8,
Invalid name
A file name has been specified as an empty string or a string with more than
ten characters.
Invalid station number
A network station has been specified outside the range 0 to 64 (or outside the
range 1 to 64 for FORMAT statements).
Invalid stream number
A stream has been specified outside the range Q to 15.
51
Page 54
Merge error
You have tried to MERGE data or code. You can only MERGE programs.
This report will also appear if you have tried to MERGE a program saved by the SAVE . . . LINE.. statement.
Microdrive full
You have tried to write data to a cartridge containing no free space. You should therefore run your program or command again, with a cartridge that does contain free space. This can be done by erasing old files from the present cartridge. A file opened for writing on the full cartridge cannot be cloned.
It should be erased. This will, however, take about thirty seconds because the
computer checks the cartridge several times to make sure that the file has
no end.
Microdrive not present
You have either tried to use a Microdrive which is not attached to your
computer. or a Microdrive which does not contain a cartridge. or a Microdrive containing an unformatted cartridge.
Missing baud rate
The baud rate has not been specified.
Missing drive number
The Microdrive number has not been specified.
Missing name
The file name has not been specified.
Missing station number
The network station number has not been specified.
Program finished
You have tried to execute a line beyond any existing line. This report will appear if a GOT0 instruction is followed by a number beyond any existing line. It will also appear if RUN is typed without a program.
Reading a ‘write’ file
You have tried to input data from a file which does not yet exist, or which has already been opened for input.
52
Page 55
Stream already open
You have tried to OPEN to a stream which has already been opened to a
new channel (m,n,t ot bl. The stream can only be opened if it is first closed.
Verification has failed
A saved file does not agree with the program. data or code currently in the computer.
Writing to a ‘read’ file
You have tried to output data to an existing file. The existing file should be erased if it is not needed. Otherwise. a new file should be used.
Wrong file type
You have tried either to INPUT or MOVE a saved file or to LOAD, VERIFY or MERGE a PRINT type of file, or to LOAD a CODE or DATA file as a
program (or vice versa).
If you are using INPUT then you should be using LOAD. If you are using
LOAD then either you should use the CODE or DATA options or YOU should “se INPUT.
53
Page 56
Page 57
The extended BASIC
The ZX Interface 1 extends the BASIC already in the Spectrum. The extensions and additions are summarised below.
Streams
Streams are specified as # n where n is a number in the range 1-l 5. Streams
1, 2 and 3 are usually used by BASIC. The # character is part of the keyword
for the OPEN Y and CLOSE X statements.
Channels
There are seven types of channel in the extended BASIC; the keyboard (k), the screen (s), the ZX Printer (p), the text RS232 Interface (t), the binary
RS232 Interface (b), the network (II) and the Microdrive (m).
Each channel type is specified by its letter which may be upper case or lower case. The network and Microdrive require additional information to specify the channel completely.
A network channel requires a station number, so a network channel is specified as “n”;x where x is a station number in the range Q-64.
A Microdrive channel requires a Microdrive number and a file name. so a
Microdrive channel is specified as “m”;y;“name” where v is the Microdrive number in the range of l-6 and “name” is a string of between 1 and 10 characters.
CAT y
CAT # z;y Sends the catalogue of the cartridge in
CLOSE #stream
Gives a list of all the files in the cartridge in Microdrive y. The list is presented in alphabetical order and is preceded by the name of the cartridge and followed by the remaining capacity in kilobytes.
Microdrive y. as described above, to stream z. Unlinks any channel from the specified stream.
If there is any buffered data then this is either
transmitted ion the network) or recorded
(on the Microdrive).
55
Page 58
Statements
ERASE “m”;y;“name”
Erases the file with the specified name from the
cartridge in Microdrive v.
FORMAT “m”;y;“name”
FORMAT “n”;x
FORMAT “t”;x FORMAT”b”;x ]
INKEY #Stream
INPUT #Stream;variable
Prepares a blank Microdrive cartridge in Microdrive y for “se by BASIC. The name “name” is given to the cartridgi and this will appear in
catalogues.
Sets the network station number to x.
Set the baud rate for the RS232 Interface
to x (x should be chosen from one of the standard baud rates 50, 110, 300,600, 1200,
2400,4800,9600,19200).
Returns a single character as a string if a
character is available, and returns the null string
” ” if no character is available from the stream.
This instruction is only meaningful if the stream
is linked to the network. or the RS232 Interface.
Inputs the variable from the specified stream. The stream must previously have been opened to an input channel. It is important to note that any print items in the INPUT statement will be output to the stream. This is usually only required when inputting from the keyboard.
It should also be noted that the “,” separator
outputs a character. The LINE option is available as before.
LOAD * channel options
MERGE -Yr channel options
56
Loads the program, data or code from the
specified channel. Only the channels “b”, “II”
or “m” may be used. All the options available with LOAD are
available with LOAD*.
The same as LOAD above except that it does
not delete old program lines or variables except to make way for new ones with the same line
number or name.
Page 59
Statements
MOVE source TO
destination
Moves data from the source to the destination. The source and destination may be either stream numbers or channels.
The command only terminates when an end of file marker is encountered in the source: thin can only happen if the source is either a network or
Microdrive channel or else a stream linked to one.
If the source or destination is a channel then it is effectively opened first and closed afterwards.
OPEN #stream, channel
PRINT # stream.
SAVE C+ channel options
VERIFY
-X channel options The
Links the specified channel to the specified
stream in order to allow BASIC input or output to that channel. The stream must
previously be closed or opened to k, s or
Outputs the print sequence (. .) to the
specified stream. The stream must previously have been opened to an outp”t channel.
The print sequence has the same syntax as before, and may contain further # tokens.
Saves the program, data or code to the specified channel. Only the channels “b”, “II” or “m” may be used.
All the options available with SAVE are available
with SAVE*.
same as LOAD above except that data is not
loaded but is compared with the data already
there.
p,
57
Page 60
Page 61
Index
This index includes the keys on the keyboard and how to obtain them,
A
apostrophe (‘) ASCII
auto-line feed
auto-run
B
b channel baud rate binary,see b channel bits,numberput put
by Spectrum BREAK broadcasting buffers
C CATalogue channels channel specifiers character set CLOSE# colourr,changing cOrnma (,) control codes
CAPS SHiFTand SPACE.
H.SYMBOLSHIFT9.
21ff.36ff. 39.46.48.55
0. SYMBOL SHIFT 5.
37,38,55
l&39,46
15.19.27.28.55
23,24,32,39,55
36,37,38
25 36 35
15.20
36
35
33
23,32
22,39
36
26
22,25
E
ERASE
F
FORMAT
G
graphic characters
q
.SYMBOLSHIFT7.
•,SYMBOLSHIFT~
18,28,46.52,56
19,30,36,37,56
36
59
Page 62
I
INK INKEY$ INPUT
K
k channel
L listings LLIST LOAD
LPRINl
M
m channel MERGE MOVE
N
n channel
naming blank cartridaes naming data files naming programs
q
, shifted X H,0nN. Q,onl.
q
,Cl”V.
13, on J.
q .OllC.
q
, shifted T.
q
, SYMBOL SHIFT 6.
26
24,32,33,36,37,56
25,26,31,36,37,56
22,24,39,55
36
37
16.17.18.30.31.33, 37,38,39.46.51,56
22.37
16ff. 55
18.20.31.46.56 39,40,46,57
30ff. 55
19
23, i;
17
0
OPENX
P
P channel PAPER parity on/off
POKE
PRINT
Q
q"OteS ("J
60
q
,SYMBOLSHIFT4.
q
, shifted C.
Q,onO. Q , on P.
22.23.31.37.39.46.57
22.24.39,55 26 35
45
22,25,26.57
25
Page 63
R
RAMTOP
run, see aoto-run
S
s channel SAVE
SAVEJC...LlNE...
SCdl?
semicolons (;I separators sockets, on the
zx lntehce
station numbers
streams stop bits,numberput
out by Spectrum
T
t channel
text. see t channel
tokens
El, on s.
Index
46
22,24.39,55
17.30.31.33.37.38.
39.46.57 20 39
22,25
22,25
7
30
Zlff, 26.39.46.48.55
35
36ff. 40.55
36
V VERIFY
q
, shifted R. 17,31,46,57
61
Page 64
Sinclair Research Limited 25 Willis Road,
Cambridge CBI 2AQ
England
Loading...