© Copyright 1988 Locomotive Software Limited
Sections of the text: © 1985, 1987 AMSTRAD plc
All rights reserved.
Neither the whole, nor any part of the information contained in this manual may be adapted or reproduced in any material form except with the prior written approval of Locomotive Software Limited.
While every effort has been made to verify that this software works as described, it is not possible to test any program of this complexity under all possible circumstances. Therefore the software supplied in this package is provided 'as is' without warranty of any kind either express or implied.
The particulars supplied in this manual are given by Locomotive Software in good faith. However, the software described is subject to continuous development and improvement , and it is acknowledged that there may be errors or omissions in this manual. In particular, the messages shown in this manual may differ in detail from those actually shown on the screen.
Locomotive Software reserves the right to revise this manual without notice.
Written and edited by Jean Gilmour, Locomotive Software
(Includes material written for AMSTRAD plc and material written by Ed Phipps Documentation Services
for Locomotive Software)
Produced and typeset electronically by Locomotive Software Ltd
Printed by Ashford Colour Press, Gosport, Hants
Published by Locomotive Software Ltd
Allen Court
Dorking
Surrey RH4 1YL
First Published 1988
ISBN 1 85195 011 7
LOCOMOTIVE and LOCO are registered trademarks of Locomotive Software Ltd
Mallard BASIC is a trademark of Locomotive Software Ltd
AMSTRAD is a registered trademark of AMSTRAD plc
Spectrum +3, PCW8256, PCW8512, PCW9512, CPC6128 are trademarks of AMSTRAD plc
CP/M, CP/M Plus are trademarks of Digital Research Inc
WordStar is a trademark of MicroPro International Corp
VT52 is a trademark of Digital Equipment Corp
Z19, Z29 are trademarks of Zenith Data Systems Inc
CP/M for the Spectrum +3 comprises:
CP/M is an operating system which means that its job is to run programs and help you organise your data. CP/M makes each computer on which it is used behave in the same way. As CP/M is used on many different computers the world over, you will have many thousands of programs from which to choose - programs that might have originally been written with another computer in mind but which will run equally well on your Spectrum +3. These programs might be accountants' spreadsheets or word processors - even computer games (though perhaps without some of the spectacular effects of programs written specifically for the Spectrum).
What is particularly important is that CP/M Plus for the Spectrum +3 is fully compatible with the CP/M for other Amstrad computers - the CPC6128 personal computer and all the PCW machines. So CP/M programs supplied for these computers are automatically set up correctly for running on your Spectrum +3.
One of the main advantages of using a well-established operating system such as CP/M is that it opens up a wide range of professional programming languages to you. Locomotive Software's Mallard BASIC, supplied on the disc alongside CP/M, is just such a programming language.
Mallard BASIC is a powerful modern BASIC with a number of significant improvements. In particular, Mallard BASIC has the very unusual facility (for BASICs on microcomputers) of indexing data stored in a file and automatically keeping this index in alphabetical order. This takes all the hard work out of preparing and using your own database.
In addition, Mallard BASIC will accept programs written for the industry standard Microsoft BASIC with little or no modification.
This User Guide is in three parts:
Part I gives you all the information you need for general use of the CP/M Plus operating system; Part II is specifically to help you use the Mallard BASIC programming language supplied on the disc; Part III provides reference information on CP/M for the Spectrum +3.
Part II provides only an introduction to Mallard BASIC. If you wish to use Mallard to write anything more than very simple programs, we would recommend you to buy a copy of 'Mallard BASIC: Introduction and Reference' (available from Locomotive Software, price £9.95).
The first thing to do is to make a copy of the supplied Master CP/M disc. You need this copy to give yourself a disc to use every day to load CP/M. (Such a disc is often described as a Start-up disc.) The supplied disc shouldn't be used as your Start-up disc because then you would risk damaging the disc and losing all the valuable software on it. Instead, it should be stored safely away, to use only to make another copy if your 'Working' copy gets damaged.
Copying a disc means copying all the data from one disc to another in such a way that the second disc becomes identical to the first. The program that does this is called DISCKIT. To use DISCKIT, you simply load the program and then follow instructions on the screen. The whole process should take about five minutes. The steps to take are given below: these assume that your Spectrum +3 is switched off at the start.
You also need to give yourself a 'Data' disc to store any other programs and data on. It is best not to use your Start-up disc as anything other than the disc you use to load CP/M and its associated 'utility' programs.
You will need two new blank discs for this - one for your copy of the supplied disc, and one for your Data disc.
If all is well, the Spectrum then displays a message like:
CP/M Plus Locomotive Software Ltd vx.x, 61K TPA, 1 disc drive RAMDISC vx.x [size=12k] installedand carries out a few extra commands. Finally it stops, with A> on a fresh line followed by a bright oblong.
If instead the screen flashes red or you see the message Insert TAPE and press PLAY, the disc you've used either isn't suitable for loading in a Spectrum or is damaged in some way. Check that you inserted the correct disc then try again. If it still fails, take the disc back to your dealer.
Copying will now start. You will see the system counting through the numbers 0...39 both as it reads the information on the Master disc and as it writes the copy on the new disc. If you have a single-drive system, copying will take place in a number of parts - each part copying a section of information on the disc to READ (the supplied disc) onto the disc to WRITE (the disc you've labelled 'CP/M Start-up disc'). This involves swapping the disc you have in the drive at various points in the process in response to messages displayed on the screen.
DISCKIT will start to write the information it has copied from the Master disc onto the new disc. If the new disc hasn't yet been marked out ready to store information, DISCKIT will display a message telling you it is 'Going to format the disc in drive A: while copying'.
Insert disc to READ into drive A: Press any key to continueYou must now re-insert the supplied disc so that the second part of the copy can go ahead (press
If you accidentally mix up the disc you are reading from (the Read disc) and the disc you are writing to (the Write disc) DISCKIT will spot this and display an appropriate message.
Any error messages that appear should also be self explanatory, but if you feel in need of extra help, refer to Part I, Chapter 5 where full details of DISCKIT are given.
Copy completed Remove the disc from the drive Press any key to continueRelease the disc(s) from the drive(s) and press
Side 2 of the Master disc is copied as before. When a message appears asking you to insert
the disc to WRITE, insert your new disc in the drive specified in the message - this time with
Side 2 uppermost - and press .
You now need to use DISCKIT to prepare your second blank disc as your Data disc. Important: Do not use a disc that already has information stored on it unless you are sure that you do not want that data. The process described here completely erases any information currently on the disc.
Formatting will now start. You will see the system counting through the numbers 0...39 as it prepares the new disc.
Side 2 of the disc is then formatted as before.
Throughout this user guide, various conventions are used to represent different types of information. The principal conventions are as follows:
INPUT, PRINT,
etc.
The majority of descriptions are explained in the accompanying text. The remainder are self-explanatory.
1 | Introduction to CP/M Plus | 1 |
---|---|---|
1.1 | Getting started | 3 |
1.2 | CP/M and the keyboard | 4 |
1.3 | CP/M and the screen | 5 |
1.4 | More about CP/M | 9 |
1.5 | Some practice in using CP/M | 13 |
2 | CP/M Programs | 25 |
2.1 | Suitable software | 25 |
2.2 | First steps | 26 |
2.3 | Running ready installed software | 26 |
2.4 | Installing the software | 29 |
2.5 | Spectrum +3 parameters | 29 |
3 | Standard 'housekeeping' tasks | 33 |
3.1 | Assessing the available space | 34 |
3.2 | Copying discs | 34 |
3.3 | Copying files | 36 |
3.4 | Creating files | 38 |
3.5 | Editing the command line | 40 |
3.6 | Editing text files | 41 |
3.7 | Erasing files | 43 |
3.8 | Finding the size of a file | 44 |
3.9 | Formatting discs | 45 |
3.10 | Listing the directory | 46 |
3.11 | Listing a file | 47 |
3.12 | Organising your discs | 48 |
3.13 | Protecting your files | 49 |
3.14 | Renaming files | 52 |
3.15 | Shortening the command line | 53 |
3.16 | Switching which disc is read or written | 56 |
4 | Tailoring the Spectrum to your needs | 57 |
4.1 | Setting up the parallel Printer port | 58 |
4.2 | Setting up the RS232 port for a serial printer | 66 |
4.3 | Using your Spectrum +3 for communications | 69 |
4.4 | Configuring the Memory disc | 72 |
4.5 | Selecting the appropriate national language | 73 |
4.6 | Redefining the keyboard | 75 |
4.7 | Redirecting console input and output | 80 |
5 | The CP/M built-in commands and utilities | 85 |
Alphabetical listing of the commands and utilities, with full descriptions and examples of their use. |
1 | Starting with BASIC | 129 |
---|---|---|
1.1 | Entering BASIC | 129 |
1.2 | Leaving BASIC | 129 |
1.3 | Using BASIC | 130 |
1.4 | Giving BASIC commands | 130 |
1.5 | Types of information | 131 |
1.6 | Chapter review | 135 |
2 | Starting programming with BASIC | 137 |
2.1 | A first program | 137 |
2.2 | More complex programs | 139 |
2.3 | Changing a program | 140 |
2.4 | Chapter review | 142 |
3 | Real programming | 143 |
3.1 | Designing programs | 143 |
3.2 | Getting information | 144 |
3.3 | How information is stored | 148 |
3.4 | Outputting the results | 155 |
3.5 | Controlling the output device | 157 |
4 | Real programming | 165 |
4.1 | Compartmentalising a program | 165 |
4.2 | Sequences and loops | 166 |
4.3 | Making decisions | 168 |
4.4 | Stopping the program | 172 |
4.5 | Organising the program | 172 |
5 | Real programming | 179 |
5.1 | Manipulating numeric information | 179 |
5.2 | Manipulating textual information | 182 |
5.3 | Converting between different types of information | 185 |
6 | Using discs for information storage | 187 |
6.1 | General disc commands | 188 |
6.2 | Sequential access files | 180 |
6.3 | Random access files | 200 |
7 | Keyed access files for data bases | 213 |
7.1 | Writing a program using Keyed files | 215 |
7.2 | Working out the main program | 216 |
7.3 | Preparatory stage | 217 |
7.4 | Adding a record | 219 |
7.5 | Reading a record | 223 |
7.6 | Deleting an entry | 225 |
7.7 | Closing the Keyed file | 227 |
7.8 | Enhancements | 229 |
8 | Machine level operations | 239 |
8.1 | General information | 239 |
8.2 | Applying a Patch | 240 |
8.3 | Loading a machine code program | 241 |
8.4 | Using a machine code program | 243 |
8.5 | Examples | 244 |
I | Disc contents | 247 |
---|---|---|
II | CP/M Plus character set | 249 |
II.1 | The complete character set | 250 |
II.2 | The standard CP/M keyboard | 257 |
III | Terminal characteristics | 259 |
IV | BASIC keywords | 265 |
V | Reference books | 267 |
VI | Technical description | 269 |
VI.1 | Character devices | 270 |
VI.2 | Disc driver | 275 |
VI.3 | Memory organisation | 278 |
VI.4 | The BIOS | 280 |
VI.5 | Field installable device drivers | 317 |
VII | Error messages | 343 |
VII.1 | Disc handling errors | 343 |
VII.2 | Device errors | 344 |
VII.3 | CP/M Plus error messages | 344 |
CP/M is an operating system - which means its job is to run programs and help you organise your data. You can use it for:
Facilities here include: keeping a record on your printer of what you have typed and the programs you have run; extending the number of discs CP/M will search automatically to find the program you want; telling the program to take its input from a file or from a telephone link; setting up a sequence of programs to run one after another automatically - for example, whenever you load CP/M.
Creating new files; making copies of existing files; erasing files you no longer need; changing what files are called; protecting important files.
Preparing new blank discs; making duplicate copies of your discs so that you have a reserve or 'back-up' copy in case of accidents; checking that the data stored on a disc has not become corrupted by 'Verifying' the contents of the disc.
Bringing a printer or a communications link into play; setting device parameters; configuring the keyboard to suit your needs.
To do this, CP/M Plus has some special programs called the CP/M commands. These come in two groups, built-in commands and Transient Utility Programs - or Utilities for short. The built-in commands are automatically read into the Spectrum +3's memory every time the CP/M operating system is loaded and they are always available to you. The utilities are also stored on the Start-up disc, but they have to be loaded into the Spectrum +3's memory each time they are used.
Both programs and data are stored in Files, and to run a program what you have to tell CP/M is the name of the file holding the program you want to run. Often you also have to give CP/M the name of the file holding the data the program is going to manipulate for you.
You give CP/M all this information by typing in what are known as Command Lines. These command lines each contain:
You use command lines like this to run programs you buy such as word processor programs and spreadsheets, programming languages such as BASIC, text editors for editing your file, computer games or advanced computing tools such as assemblers. You also use command lines like this to call up the CP/M commands that help you run other programs and organise data.
Within the command line you give all the information CP/M needs to do the job you want. In particular, you must remember to include details of where the program you want to run is stored (ie. which drive it is in) and, similarly, details of where the files you want the program to work on are located. If you don't tell CP/M where to find these files it will assume that they are to be found among the files on your current disc.
Precisely how you present this information depends on the program you want to run or the command you want to use. The details are given by the program's or the command's Form or Syntax. The Form of each CP/M command is given in this User Guide as part of its detailed description in Chapter 5. The Form of the command lines you need to run any commercial programs you buy will be given in the programs' own user guides.
For example, to ERASE a file called FILE.X you would use the command line:
A>ERASE FILE.X | | | | | The Command Tail, in this case the name of the file you want to erase | The Command Name, ie. the name of the program you want to run The System Prompt
The System Prompt is put up on the screen by CP/M to show that it is ready to receive a command. The rest of the command line you type yourself. It automatically appears to the right of the system prompt.
Command lines have to be typed correctly if the command is to work properly. You will need to pay attention to every detail of each command line: every comma, colon, semi-colon, space etc. has to be included exactly as described by the program's or the command's Form.
However, you can type characters in either upper or lower case or even a mixture of the two. For example, your Spectrum will do exactly the same actions whether your command line is:
A>ERASE FILE.X or A>erase file.x or A>ERASE file.x
Most mistakes will be picked up when CP/M starts to process the command
line (see 'When commands fail', below), but there is always a chance the
CP/M will do what you say, rather than what you want! If you
spot a mistake while you are typing in the command line, use the
key to rub out what you have typed back to the mistake and then type the
remainder of the command line in again.
When you have finished typing the command line, you press the
key. This sends your instruction to CP/M for processing. The program you
specified in the command line is then run. When the program has finished,
CP/M puts a fresh system prompt on the screen. It is then ready to process
another instruction for you.
Before you can run any application program under CP/M Plus on the Spectrum +3, the computer has to read CP/M off the CP/M Start-up disc into its memory. The Spectrum loses the information it needs to run CP/M programs each time it is switched off or reset.
As you will find yourself changing the disc in the drive quite often while you run CP/M, you should remind yourself of the rules about handling discs given in Chapters 3 and 5 of the Spectrum +3 User Guide. In particular, remember that you should never remove a disc while the light on the disc drive is on or flashing on and off: that could damage your disc, let alone the data on it.
The steps involved in loading CP/M onto the Spectrum +3 (the process often referred to as 'booting CP/M') are as follows (Note: You may have just done this in the preparation section of this guide: if so, you don't have to load CP/M again):
If all is well, the Spectrum then displays a message like:
CP/M Plus Locomotive Software Ltd vx.x, 61K TPA, 1 disc drive RAMDISC vx.x [size=12k] installedand carries out a few extra commands. Finally it stops, with A> on a fresh line followed by a bright oblong.
If instead the screen flashes red or you see the message Insert TAPE and press PLAY, the disc you've used either isn't suitable for loading in a Spectrum or is damaged in some way. Check that you inserted the correct disc then try again. If it still fails, take the disc back to your dealer.
The bright oblong is called the Cursor and its position marks where the next character you type in will appear on the screen.
Note: To finish working with CP/M at any time, simply make sure the disc drive is empty and then press the Reset button on the lefthand side of your Spectrum.
When you are using the CP/M operating system and programs like Mallard BASIC that run under CP/M, the keyboard works in essentially the same way as it does when you are running Spectrum BASIC.
If you press any letter or digit key on its own, then you type the
character shown on the keytop. If you hold down the key and
press one of the letter keys, you type a capital letter. If you hold down
the
key and press either a letter or a digit key, you type
the punctuation mark or other symbol shown on the keytop.
Other key combinations, in particular involving the function keys round
the edge of the keyboard, carry out a range of actions. In particular, the
four keys either side of act as Cursor keys and allow you to move
the cursor to a different place on the screen, the
key allows you
to rub out the character you typed last and the
key in the top
righthand corner of the keyboard usually (but not always) stops whichever
program you are using.
However, this is where the similarity ends because the range of special characters you can type, the key combinations you use to type these and the actions you get by pressing particular keys are not the same as those you get when you are using Spectrum BASIC.
In particular, holding down the key and pressing a letter
key types one of the CP/M 'Control codes'. For example, holding down
and pressing the A key types the code Control-A.
These codes have special actions depending on what you are doing. In
Chapter 3, we will see how some of the codes can help you correct typing
mistakes in CP/M command lines; other codes may be used by your program to
access special features.
Full details of the key combinations you need to type each character and of the special actions and control codes you can access are given in Appendix II alongside the details of the CP/M Character Set.
CP/M uses the screen in three main modes which give you different numbers of characters on each line of the screen. In addition, you have the option of using the bottom line of the screen purely for messages from the system such as 'Drive not ready - Retry, Ignore or Cancel'. The advantage of having this line as a 'Status line' is that then such messages attract your attention without interfering with the rest of the screen display. (Some Status line messages draw attention to themselves by scrolling right to left like a newscaster). Moreover, they can be cleared away once the problem has been coped with. With the Status line 'turned off' the message simply appears on the next line of the screen and rolls off the screen with the rest of the display.
The three fundamental ways of using the screen are:
The 24 x 51 and 24 x 80 screen sizes are the ones you are most likely to use. 24 x 51 is the standard screen size for CP/M on the Spectrum +3. 24 x 80 is the standard screen size on most other computers that run CP/M. When you run a program that was originally designed to run on a computer with a 24 x 80 screen, you will want to use your Spectrum's 24 x 80 option so that any output from the program is displayed properly on the screen. The 24 x 32 screen is supplied for programs that use colour and which would be adversely affected by the 'attribute clash' effects that you would get on the Spectrum screen when this uses the smaller character size.
To change over to using a different size of screen, you have to send a special group of characters to the screen called an Escape sequence. The way you do this depends on what type of job you are doing:
SET24X80![]()
When you want to return to using the standard 24 x 51 screen, you insert your Start-up disc as before and type the command:
SET24X80 OFF![]()
In 24 x 80 mode, you can swap between the two 'halves' of the screen by
holding down (or
plus
) and
pressing
. (Note: pressing both
and
requires both hands, but you only need one hand to press
and
together with
.)
The screen may also be swapped over from one side to the other while you are running a program. The standard rule is that you always see the 'half' of the screen with the cursor. The cursor isn't displayed continuously - only when your program pauses - so it is just if the program stops sending output to the screen that you might be automatically swapped over to the other half of the screen.
If you don't want the screen to automatically flip between the two halves, you can disable (and re-enable) this feature by sending further Escape sequences to the screen (the sequences are also detailed in Appendix III). These escape sequences can be sent to the screen while the A> system prompt is displayed by pressing the following keys:
The Status line is also turned on and off by sending Escape sequences to the screen (also detailed in Appendix III). Typically you would send these sequences by pressing keys while the A> prompt is displayed. The keys to press are as follows:
The best way to become accustomed to these different options is to try them out. Simply type the command or the sequence of keystrokes for the option you want and then type a few characters at random to see how the screen now works.
In particular, type the command SET24X80 to select
a 24 x 80 screen; notice how there is now a
at the lefthand end
of the Status line. Next hold down the
key and press
. This moves you the righthand end of the screen.
Notice how there is now a
at the righthand end of the Status line.
These markers on the Status line give you an easy way of telling which half
of the screen you are working on. (Note: They are not
displayed when the Status line is turned off.)
You should also try out turning the Status line off and on by pressing keys. In particular, note how the keys you press appear as characters in the current command line. Note: The remainder of introduction assumes the Status line is displayed, so finish with the Status line on.
The other aspect of the screen is to think about the colours it displays. When you first load CP/M, the screen is shown as white characters on a blue 'page'. But this isn't the only combination of colours you can use: you can change either the foreground colour (the colour used to write characters) or the background colour (the colour used to write characters against) whenever you like.
The colours that you can use are Black, Blue, Red, Magenta, Green, Cyan, Yellow and White and they can be displayed either at normal intensity or as the 'Bright' version of the colour (though there is no such thing as Bright Black!). All these colours can be used either for the foreground or for the background. In general, you should make both colours either normal intensity or bright: if you mix a 'normal' colour with a bright one, you just get the normal version of both colours.
To change the screen colour, you can use a special CP/M command called PALETTE. The command line you need is:
PALETTE background-colour foreground-colourImportant: Background-colour and foreground-colour are what are known as 'place-holders'. They mark the place in the command line that you need to specify a particular piece of information and they also describe the information that is required. In fact, what is needed at these points when you actually type your command line are the numbers which represent the colours you want. The numbers you need to type are given in the table below. These numbers probably look a little strange: they are in fact chosen to be compatible with the CP/M systems on other Amstrad computers, some of which show more colours.![]()
Normal colour | Number | Bright colour | Number |
---|---|---|---|
Black | 0 | ||
Blue | 2 | Bright Blue | 3 |
Red | 8 | Bright Red | 12 |
Magenta | 10 | Bright Magenta | 15 |
Green | 32 | Bright Green | 48 |
Cyan | 34 | Bright Cyan | 51 |
Yellow | 40 | Bright Yellow | 60 |
White | 42 | Bright White | 63 |
So for example, if you want to have Bright Cyan characters (colour 51) on a Bright Red background (colour 12) you would use the command:
PALETTE 12 51When you change colour, the border of the page is instantly changed to your new background colour. You won't see any other effect until something is written on the screen, for example when you type new commands, and then the new colours are only used for the updated parts of the screen. As a result, your screen display can become a very complex pattern of colours.![]()
When CP/M is loaded, it works with (Bright) White characters on a Blue background. The command to restore the screen to this combination is:
PALETTE 2 63![]()
Before you go on to use CP/M to run applications programs, it is worth looking at the components of CP/M command lines in a little more detail and what happens when you get the command wrong.
A>ERASE FILE.X | | | | | The Command Tail, in this case the name of the file you want to erase | The Command Name, ie. the name of the program you want to run The System Prompt
CP/M identifies files by a two-part name. The first part is called the Filename and the second part the Filetype.
The filename can esssentially be any combination of up to eight characters, though you shouldn't use certain special characters:
< > = ! | * ? & / [ ] ( ) . , : ; \ + -Often just the letters of the alphabet A...Z and the digits 0...9 are used. (CP/M doesn't distinguish between capital letters and small letters in file names and so there is no difference between using A...Z and a...z.)
The filename will usually have been chosen to suggest what the file contains but this doesn't have to be so.
The filetype is up to three characters long, and again the characters recommended are A...Z and 0...9. However, the sort of operations that are to be done using the file may force you to give the file a particular filetype.
When typing in your command line, you will always have to give the filename and often you will have to give the filetype as well. If so, the way to type this is the filename, followed immediately by a dot, followed immediately by the filetype. For example, if the file you want to specify has the filename MYFILE and the filetype TXT, you would type MYFILE.TXT in your command line.
The other piece of information you may have to give CP/M is a letter that tells it which disc holds the file you want.
CP/M can cope with up to 16 drives, which it calls A, B,...P. So, for example, if MYFILE.TXT is on drive B, you might have to type B:MYFILE.TXT. The B: tells CP/M to look for the disc in Drive B.
At any one time, CP/M calls one of these drives its Default Drive and you don't need to give the drive letter for files on the disc in that drive. This is usually Drive A but you can change it as we shall describe later. Thus specifying MYFILE.TXT will usually be the same as specifying A:MYFILE.TXT.
The main job of the system prompt is to tell you that CP/M is ready to receive a new command. If there is a system prompt on the screen with the cursor to the right of it, you can type in your command.
The system prompt also tells you which drive is the current default drive. When the system prompt is A>, the default drive is Drive A - the built-in disc drive. If you have two floppy disc drives, you might change the default drive to Drive B (your second disc drive); the system prompt would then become B>. (How to change the default drive is described on page 18.)
You will be able to recognise which of your files contain programs you can run from their filetype. CP/M programs have the filetype COM (ie. names like MYPROG.COM) and Submit files have the filetype SUB (for example, MYSUBMIT.SUB).
The command name has two parts:
The command name never includes the filetype of a program, a command file or a Submit file.
The location part of the command name is only included when the command or program is not immediately available. CP/M internal commands are always available; the other programs that are immediately available are the CP/M external commands and other programs on the disc in your default drive.
For all other commands and programs, you have to tell CP/M in which drive to look for the program. For example, if you want to use the external command GET which you have stored on the disc in Drive B, you would start your command line:
B:GET ...Note: Not B:GET.COM ...
The information a program needs in the Command Tail and the order this is given in depend on the program. It is all laid out in the 'Form' or 'Syntax' statement for the command line and must be followed exactly if the program is to work correctly.
The Form of the command line for each CP/M command is given in Chapter 5 where the commands are described in detail. The form of the command lines you will need to run the commercial programs you buy depends on the programs' own user guides.
The Form statement shows you how to give CP/M the details of the files you want the programs to process and it tells you how to specify the program options you want to take advantage of. The way it does this is through options like d:, filename, parameter, and physical-device written in a different style to the rest of the line. (In this manual these are always written in an italic script). These are known as placeholders and they show where you need to insert details of the actual job you want to do, for example the name of the file you want to copy or the name of the file you want to store the copy in.
For example
RENAME new-name=old-nametells you to type RENAME, followed by a space, followed by the new name you want to give the file, followed by =, then the old name (ie. the current name) for the file, and finally press
RENAME MYFILE.X1=FILE.X![]()
What you need to replace the placeholders with should be explained either in the notes describing the command line or in a section covering the conventions used in the manual. There may also be parts of the command line that you can miss out if they are not appropriate. The way this is shown in this manual is explained at the start of Chapter 5.
Commands fail because:
The commonest reason for this is that you mistyped the command name. For example, you might have typed ERAES instead of ERASE. The other possibility is that the program file isn't on the disc CP/M searched. You may have misdirected CP/M, for example because you forgot which disc you had in the drive. Check where you told CP/M to look for the file.
Either you mistyped the filename or the filetype or the file isn't in the directory you specified. Check where you told CP/M to look for the file.
In both of these cases you can either retype the command line at the new system prompt or
copy and then edit your previous command line. The keystrokes to help you do this are described
in Section 3.5. When you have finished preparing your new command line, press .
Turn to Appendix VII where error messages like this are explained and then take whatever action is appropriate. You may, for example, need to erase some files you no longer need from the disc or change what you are trying to do.
If in doubt, consult your dealer.
Release the disc(s) in the drive(s), reset your machine by presing the button on the side of your Spectrum and then work through the Startup procedure again (see page 3). Then try running your program again. If you get the same failure, try running your reserve copy of the program (if you have made one of these). If that fails too, consult your dealer.
In principle, you now know enough about CP/M to run any well-documented CP/M program.
Unfortunately, this will not always be the case. We give advice on how to go about choosing the software to buy in Chapter 2 but, even so, you are advised to spend some more time learning about CP/M itself. Then, you'll be able to get the CP/M application software you buy working that much easier.
The rest of this introduction takes you through some simple uses of CP/M. Although you can just read it, we suggest that you work through the instructions using the Spectrum as it will get you used to how CP/M works.
The Spectrum is supplied with more than 30 utilities. Some of these utilities extend a similarly-named built-in command to give that command extra features.
As we described earlier, you give instructions to CP/M by typing in what are known as
Command Lines. These must be absolutely correct if they are to have the right effect but
it doesn't matter if you make a mistake while typing in the line: just use the
key to rub out
what you have typed back to where you made the mistake and then type it in again from that
point.
At the end of each command line, you have to press the
key; this sends the
instructions to CP/M. We will remind you to do this throughout this introduction by putting
at the end of
each command line we suggest you type in. But in line with almost every reference book on
CP/M, these are omitted in the more advanced parts of this User Guide.
Command lines will only be obeyed if they are typed when CP/M is ready to receive a command, which it shows by putting a system prompt (for example, A>) on the screen.
The rest of this section is designed to help you learn what instructions to give CP/M.
The first thing you will want to know about any disc you put in the drive is what files are on the disc.
The names of all the files on a disc are held in a Directory and you look at the contents of the directory with the aid of DIR, one of the built-in CP/M commands.
Put your CP/M Start-up disc back in the drive. To see the names of the files on this disc type in this instruction after the A>:
DIR![]()
CP/M never distinguishes between lower case and upper case letters so you can use whichever you prefer. You don't even have to be consistent.
Up on your monitor screen will come something like:
A>dir A: S01CPM3 EMS : RPED BAS : LANGUAGE COM A: PALETTE COM : BASIC COM : SET24X80 COM A: DIR COM : DISCKIT COM : ED COM A: ERASE COM : SETKEYS COM : SETLST COM A: PIP COM : RENAME COM : RPED SUB A: PROFILE SUB : SET COM : SETSIO COM A: SETDEF COM : TIMEOUT COM : SHOW COM A: SUBMIT COM : TYPE COM : RAMDISC FID A: DUMP COM : RESET KEY : DEVICE COM A>![]()
The leftmost column is full of 'A:'s because the disc is in the drive CP/M calls drive A.
The rest of the list is made up of alternate columns of filenames and filetypes, starting with filenames. Each filename goes with the filetype immediately to its right - so SxxCPM3 and EMS is one file, BASIC and COM is another, and so on.
Some of these files contain CP/M programs, some hold BASIC programs and some are data files. You can tell which is which from their filetypes.
For example, you will see that most of the files listed on the screen have the filetype COM. This means that the file holds a program that CP/M can run. Other special filetypes in this list are: BAS - indicating a file containing a BASIC program; SUB - indicating a file that contains the instructions to run a sequence of CP/M programs; and EMS. The EMS file is the one that contains CP/M.
Much of the time, you will be interested, not so much in what files are on a disc, but whether the file or files you want are on the disc. The DIR command can do this for you.
Suppose you want to see if you have a file with the filename SET and the the filetype COM on this disc. The command line that does this is:
DIR SET.COM![]()
Notice that we have quoted the name of the file by putting its filename and then its filetype, separated by just a dot.
The response on the screen will be:
A:SET COMIf the file hadn't been on the disc, you would have seen the message:
No FileIf you had known that the filename of the file you wanted was SET but you couldn't remember its filetype, you could have used the DIR command to list out the whole directory as before. A better solution would have been to give DIR a template that fits the name you are looking for and instruct it to search through the directory for all the files that match this template.
Templates are constructed using the Wildcards * and ? - an asterisk represents any number of characters but a question mark only represents a single character.
The template for all the files with the filename SET is SET.* and so the command line you would type in is:
DIR SET.*![]()
What will appear on the screen is again:
A:SET COMwhich tells you that DIR has found just one file matching the template - the file SET.COM.
You would use a similar template if what you wanted listed out was all the program files on the disc. This time we would use an asterisk in place of the filename:
DIR *.COM![]()
You would also use an asterisk in the template if you knew just the first few characters of either the filename or the filetype or if you wanted to list all the files with the same few characters at the start of their filenames.
Say, for example, that you wanted DIR to list out all the files on the disc that have filenames starting with SET, regardless of their filetype. The command line that does this is:
DIR SET*.*![]()
Notice that you have to use two asterisks: one in the filename and one in the filetype.
So far, we have just described how to use the asterisk wildcard. You would use the question mark wildcard if, for example, the files you wanted listed out all had filenames starting with SET but no more than six characters.
Suppose you want all these files whatever their filetype. The command line you would need is:
DIR SET???.*![]()
We will tell shortly of some other uses of wildcards and how these will often save you a lot of typing.
The CP/M utility that makes a copy of a file, either on the same disc or on another disc, is called PIP. This utility is not built into CP/M: instead it is stored on Side 1 of your CP/M Start-up disc and it has to be read from the disc every time you want to use it.
The information you give PIP is the name of the file you want copied (the Source) and the place you want the copy stored as (the Destination). PIP will proceed to make the copy, provided that there is enough room on the disc for the new file.
To illustrate how the PIP utility works, we will make a copy of the file called BASIC.COM on the Data disc you prepared in the initial preparatory session. BASIC.COM holds your copy of the Mallard BASIC programming language. In copying this file to your Data disc, we are taking advantage of a good opportunity to move this file from your CP/M Start-up disc to a separate 'BASIC' disc where it can be stored alongside your BASIC programs.
(Note: The techniques we describe here are important throughout your use of CP/M, particularly if you don't have a second disc drive. They don't just apply to copying files from one disc to another - but to any case when you want to make use of more than one floppy disc at a time.)
You might expect the commands involved in making this copy to be very different, depending on whether you just have one floppy disc drive or whether you have added another disc drive to your system. But in fact they are remarkably similar, thanks to a subtle trick whereby the Spectrum pretends to CP/M that your single disc drive is really two disc drives - called Drive A and Drive B. The only real difference is that on a two-drive system, you can put each of the discs into its own drive and leave them there throughout, but on a single-drive system, you have to swap from one disc to another according to the needs of the program you are using.
On a single-drive system, you can see whether CP/M currently regards the drive as Drive A or Drive B from the message in the bottom righthand corner of the screen (on the 'Status' line). Normally this shows Drive is A, but the moment the drive is changed from Drive A to Drive B, the message in the bottom right hand corner of the screen changes to Drive is B and you will get a message asking you to replace the disc currently in the drive by the 'disc for Drive B' - ie. the one that you would use in the second drive if you had such a drive.
Similar messages appear when the drive is changed from Drive B to Drive A.
In this case, the disc to put in 'Drive A' is Side 1 of the CP/M Start-up disc and the one to put in 'Drive B' is Side 1 of your Data disc. If you have a two-drive system, you can insert both these discs now. On a single-drive system, start with the CP/M Start-up disc in the built-in drive (with Side 1 uppermost) because this has the PIP program on it.
The command line you use whether you have one or two drives at your disposal is:
PIP B:=A:BASIC.COM![]()
This tells CP/M to copy the file BASIC.COM on the disc in Drive A and to store the copy on the disc in Drive B. Notice that you give PIP the details of the Destination file, before you give it details of the Source file.
CP/M's first job is to read the file BASIC.COM into memory. The PIP command tells it that this file is on the disc in Drive A and as the built-in drive is currently Drive A, it looks and finds BASIC.COM on the disc currently in the drive. So it goes ahead and reads it.
Then it wants to write a copy of this file on your Drive B disc. On a two-drive system, this disc will already be in your second disc drive, but on a single-drive system, the drive is changed from A to B and the following rolling message is displayed at the bottom of the screen:
Please put the disc for B: into the drive and press any key
Release the Start-up disc from the drive, insert the 'disc for B:' (your Data disc) with Side 1 uppermost, and press, say, the space bar. The computer then writes a copy of BASIC.COM onto this disc and again gives it the name BASIC.COM. You can check that this has been done by typing:
DIR B:![]()
Note: In some cases, the file will be too big to copy in one go. When this happens, CP/M will copy as much as it can (as described above), then put up the message Please put the disc for A: into the drive and press any key so that it can read some more of the original file. Later it will ask again for the disc for Drive B. Simply keep swapping over discs and pressing the space bar until the copy has been completed.
As with DIR, you can use a template to specify a number of files to copy at the same time but often there won't be a template that fits all the files you want to copy and no others. When this happens, you have to type a number of PIP commands. This can be fairly laborious - particularly as the PIP command is stored on disc and has to be loaded into memory each time before it is used. Fortunately, there is a neat way of making a sequence of copies that doesn't involve loading PIP into memory specially for each copy. This is explained in Section 3.3.
If you want to have a second copy of a file on the same disc as the original, you have to give the new file a different name from the original: you cannot have two files with the same name on one disc. For example, to make a second copy of the BASIC.COM file on your Data disc and call this COPY.TMP you would give the command:
PIP B:COPY.TMP=B:BASIC.COM![]()
So far in this tour, we have been using Drive A as the default drive - ie. as the drive CP/M will assume you want it to work with unless you tell it otherwise. Drive A is the default drive that you always get immediately after CP/M has been loaded and often there's no need to change this. But if you are using a number of files on your Drive B disc, it may be better to change the default drive to Drive B. The command you use to do this is simply:
B:![]()
CP/M responds by making the system prompt B> - to show that Drive B is now the default drive. The letter usied in the system prompt always shows you which drive is currently the default drive.
Whenever the system prompt is B>, the default drive is Drive B and any files that are on Drive B can be specified just by typing their filename and filetype but any files that you want to use on Drive A have to be written with A: in front of them. So, for example, the PIP command we gave above when Drive A was the default drive:
A>PIP B:COPY.TMP=B:BASIC.COMbecomes when the default drive is Drive B:![]()
B>A:PIP COPY.TMP=BASIC.COM![]()
Return to drive A as the default by typing A:
As well as letting you copy files, CP/M helps you to rename them or erase them from the disc. These (and other similar) operations are often referred to as Disc Housekeeping. As you use CP/M more, you will find you need these quite often.
The CP/M command to use to rename files is called RENAME - often abbreviated to REN. This command works purely on the directory of a disc, substituting the new filename and filetype for the old ones. The data itself is not changed.
You can change the name of a file as many times as you want. All you have to give RENAME is first the new name and then the old.
We shall illustrate this by changing the name of the COPY.TMP file you made on your Data disc, to TEMP. The command line that does this is:
REN B:TEMP=B:COPY.TMP![]()
Obviously the drive letter should always be the same in both the new name and the old.
If you have a single-drive system, you will notice how this time you haven't had any message about inserting the disc for Drive B. The reason for this is that CP/M still sees the disc drive as drive B (from the last action you did). As Drive B is the only disc it needs to read for this command and as you've got the Drive B disc in the drive, it simply goes ahead and renames the file for you.
So far, we have only described changing the name of one file. Templates like the ones you set up for use with the DIR and PIP commands can also be used with RENAME. However, there are two things to be careful about here:
You erase any files you no longer need with the ERASE command - often abbreviated to ERA.
To show how to use the ERASE command, we shall erase the file you have just renamed TEMP. The command line that does this is:
ERA B:TEMP![]()
Again you won't have had a message about inserting your Drive B disc.
The ERASE command also allows you to set up a template with wildcards and so use just one command line to erase a number of files. This should be used with care, as files once erased cannot be restored. Again, you have to have the supplementary ERASE utility available on the default drive when you use this command.
However, there is an extra feature of the ERASE command that ensures that none of the files that fit the template are erased until you confirm that you want this done.
We shall illustrate this by using this feature to erase BASIC.COM from your Start-up disc. Check that the current default drive is drive A (ie. the system prompt is A>) then type in the following command line: (Note: If you don't want to use your new Data disc for BASIC programs, then you could if you wish erase BASIC.COM from your Data disc instead of from your Start-up disc by putting B: in front of the filename in the command).
ERA BASIC.* [C]![]()
The [C] tells CP/M that you want to use the 'Confirm' or 'C' Option of the ERASE command.
A number of the CP/M commands and utilities have Options, which we cover mainly in the reference sections of this user guide. They are always specified by putting their name between square brackets at the end of the command line. In some cases, you can omit the closing square bracket.
In this case, you will first get a message telling you to insert the disc for Drive A (CP/M needs this disc both to find the files to erase and, as it happens, to find the supplementary ERASE utility). Then you will see:
A: BASIC .COM (Y/N)?
Type Y to confirm that you want this file erased.
Before you can say whether there is enough room for a file on a disc, you need to know three things - how big the file is; how much free data space there is on the disc; and whether there is room in the directory for its name. The directories on Spectrum discs can't hold more than 64 names.
For example, you can find out how big the PROFILE.SUB file is through the command line:
DIR PROFILE.SUB [SIZE]![]()
What this does is use an extra features of the DIR command provided by the DIR utility - the SIZE option. DIR searches through the directory as before but this time it displays, not just the filename and the filetype, but the size of the file as well.
Among the information that should now be on your screen is:
A: PROFILE .SUB 1k
This tells you that PROFILE.SUB occupies 1k of disc space and so there will have to be at least 1k of free space on the disc if you are to put a second copy of this file on it.
The 'k' here stands for Kilobyte and it is the unit in which disc space is always measured. It corresponds to roughly 1000 characters. The disc in the drive can store up to 173k of data.
The next thing to do is to find out how much free space there is on the disc you propose to use. The utility to use here is SHOW and to find out how much space there is on the disc in drive A, you use the command line:
SHOW A:![]()
Up on the screen will come something like this:
A: RW, Space: 29k
This tells you that the amount of free space on the disc is 28k, while the RW tells you that the Spectrum is allowed to both read from and write to discs in Drive A. (If you erased the copy of BASIC.COM on your Data disc rather than that on your Start-up disc, the amount of space will be 1k rather than 29k!)
The fact that the status of the drive is RW is no guarantee that you will be able to write to the disc in the drive. If the Write Protect Hole on the disc is open, you will always be prevented from writing to that disc and from erasing or renaming any of the files.
The remaining check is that there is enough room in the directory for trhe new filename. The maximum number of names that can be held in the directory is 64 and once that number of directory entries has been reached, no more files can be written onto the disc, however much free space there is available on the disc. (Note: The number of directory entries you have used up isn't always the same as the number of files on the disc: larger files can use up more than one entry in the directory.)
SHOW is again the utility to use, but this time with one of its options. The command line to use is:
SHOW A:[DIR]![]()
Up on the screen will come something like:
A: Number of free directory entries: 36(34 if you erased BASIC.COM from your Data disc, rather than form your start-of-day disc.)
These commands together confirm whether you have both enough room both on the disc and in the directory for the new file you wish to make.
To find out what the PROFILE.SUB file contains we need to use another of CP/M's built-in commands, TYPE.
The command line that lists out its contents is:
TYPE PROFILE.SUB![]()
If you do this, you will see that each like of the file is rather like the commands you have been typing in yourself. We will explain why next.
Note: TYPE is only useful to display simple ASCII text files such as PROFILE.SUB. If you try to display anything other than an ASCII text file, the result won't be readable.
A useful facility of CP/M is that it lets you put a number of command lines into a file and then just type one command line to get exactly the same effect as typing all the commands in separately.
The command you type in uses the SUBMIT utility, which is stored on side 1 of your CP/M Start-up disc. The file holding the command lines must have the filetype SUB. PROFILE.SUB is just such a file.
Most of the commands in PROFILE.SUB are PIP commands, which copy the two files PIP.COM and SET24X80.COM to a special drive called Drive C. This isn't a drive that you can insert discs in, but part of the Spectrum's memory which is specially set up to work like an extra disc. This drive, also known as the Memory disc or RAM disc, is only small (just 12k) but it can be used as a temporary storage place for a few files that it is useful to have available while you're working. The storage can only be temporary because the memory is wiped clean the moment you switch off or reset your machine.
The other commmand line in the file uses the SETDEF utility to instruct CP/M to look for its utilities on more than one drive. This is another useful shortcut provided by CP/M.
The particular form used here:
SETDEF *,C:[ORDER=(SUB,COM)]tells CP/M two things:
PROFILE.SUB is a special SUB file. It is accessed by a SUBMIT command embedded in the file that loads CP/M, and the command lines within the file are obeyed every time you load CP/M - you won't normally need to SUBMIT this file yourself. However, if you did want CP/M to carry out these commands again (for example, because you accidentally erased PIP.COM and SET24X80.COM from the Memory disc), you would simply have to type:
SUBMIT PROFILE![]()
(You don't have to give the filetype because it has to be SUB.)
A final shortcut to mention here are the keystrokes you can use to save effort in typing in and correcting command lines.
Rather than use the
key to rub out everything back to the part of the command line you want to correct, you can
use the cursor keys
and
. You can then use the
key and
key
(next to the
key) to
erase characters and type in any new characters you want at the cursor position.
You can also use the
key to recall the previous command line. This is covered,
alongside details of other editing shortcuts, in the section on Command Line Editing (Section 3.5).
Your Spectrum +3 is now well set up for working with CP/M application programs. Chapter 2 contains advice on buying and running software, while Part II of the User Guide tells you about writing and running Mallard BASIC programs.
From time to time, you will need to check up on how CP/M itself operates. For this, we have provided Chapters 3 and 4, the separate sections of which describe how to carry out particular actions. Chapter 3 covers general 'housekeeping' tasks; Chapter 4 covers the more complicated actions involved in setting up your Spectrum to work with printers, modems and the like. Chapter 5 gives full details of the individual CP/M commands and utilities.
The advantage of running CP/M Plus on the Spectrum +3 is that you can then run a number of programs - both programs bought 'off the shelf' from your computer dealer and 'Public Domain' programs available, for example, on computer enthusiasts' Bulletin Boards. These programs might be computer games, word processors, accountants' spreadsheets or project planners.
Unfortunately, although CP/M software will run on the Spectrum +3, it won't always produce the results you expect. It may not control the screen or the printer properly, or it may not respond correctly to the keyboard. If it is to work correctly, it will usually have to be 'installed' on the Spectrum +3.
This chapter provides a guide to avoiding the pitfalls and generally getting the best out of CP/M programs you buy. It will be useful to have this chapter handy when you buy software from an independent software dealer so that the dealer can check whether the software will work properly on the Spectrum +3.
Software for the Spectrum +3 must be:
It is also advisable to choose, if possible, software that has been installed to run on the Spectrum +3.
Your dealer will be able to tell you whether a suitable version of the software you want to use does exist. If the software is available in the right format but has not been installed on the Spectrum +3, you (or your dealer) will need to modify the program so that it will work correctly on your machine. This is a straightforward task but it may require detailed background knowledge.
If the program was written specifically for another computer, it may not be possible to modify it without specialised help. Check with your dealer that this is not the case! The process of modifying the program is called installing and it is covered in Section 2.4 of this chapter.
Whether your software is ready to run on the Spectrum +3 or whether it has to be installed first, it is wise to start by making a copy of the software discs you have just bought. That way you can keep the originals as the Master Copy, safely stored away in case of accidents.
A good move before you get involved in copying is to open the Write Protect Holes on your system disc and the discs you intend to copy so that you cannot spoil them by accidentally writing to them. So do this before you go any further. There is a diagram showing the position of the Write Protect Holes and how they open and close in Chapter 5 of the Spectrum +3 User Guide.
If the programs are supplied specifically for use with CP/M on the Spectrum +3, you can use DISCKIT to copy the whole disc.
If the programs are supplied set up for some other computer, for example the Amstrad CPC6128, you will need to format as many new blank discs as you require using DISCKIT (see Section 3.9) and then copy the files on the Master disc to your new discs. This file transfer can be done by using the PIP utility (as described in Section 3.3).
You are now ready to go on to either run the software or to install it.
The next step is to organise your working discs to make the software easy to run. There are essentially two approaches to running an applications program. You can:
Either: Load the CP/M operating system from your CP/M Start-up disc. Then replace this disc with the one holding the copy of the software and type the command(s) you need to run your applications program
Or (if possible): Create a special Start-up disc that holds the following:
We describe how to set up such a disc below.
The other things to pay attention to are:
You can either plan to store this on the same disc as the program (if there is enough room) or use a special disc just for data. If you take the second option, either use a disc that has already been formatted or format a new blank disc.
The standard screen size for CP/M on the Spectrum +3 is 24 x 51 but many CP/M programs will have originally been designed to run on computers that have an 24 x 80 screen as standard. When you run one of these programs, you will want to use your Spectrum's 24 x 80 option as well so that any output from the program is displayed properly on the screen.
The command that changes over to the 24 x 80 size of screen is:
SET24X80![]()
When you want to return to using the standard 24 x 51 screen, type the command:
SET24X80 OFF![]()
You can now run the software by loading CP/M and then running your program, following the instructions in the program's own instruction manual / user guide. The final piece of advice is to keep duplicate copies of all your important data files: the quick and simple way of doing this is to copy the whole disc, using DISCKIT.
Note: You can only create a Start-up disc for your application if it is possible to fit the file containing the CP/M operating system on the same disc as your application program and all the support files it needs.
If your application program is supplied specifically for use with CP/M on the Spectrum +3, the way to create such a disc for yourself is to use the DISCKIT utility to make a copy of this disc on a fresh disc (see Section 3.2) and then use PIP with the [O] option to copy from your CP/M Start-up disc the file containing the CP/M operating system, the current PROFILE.SUB file and any CP/M utilities you want to this disc - see Section 3.3.
(Using the [O] option is not essential but it is advised, whenever you want to copy program files. See the description of the PIP utility in Chapter 5 for details.)
If the program is supplied for use with CP/M on some other computer (for example, a CPC6128), you need to use DISCKIT to format a fresh disc (see Section 3.9) and then use PIP to copy the files you require both from your CP/M Start-up disc and from your application master disc (see Section 3.3). Again, we suggest using PIP with the [O] option when copying these files (see the description of the PIP command in Chapter 5 for details).
Either of these routes gives you a disc holding all the programs and data files you need. All that remains to do is to set up the PROFILE.SUB file so that immediately after loading, CP/M automatically loads and runs your application program.
The precise details will depend on the software you want to run in this way, but essentially, what you have to do is edit PROFILE.SUB so that it ends with the command lines you would normally type to run the application.
Suppose, for example, that to run your program you normally type the commands:
SETKEYS KEYS.APP APPLIC B:DATAFILE
and when you have finished using the APPLIC program, you return the keyboard to normal with the commands:
SETKEYS RESET.KEY
(What these 'Keys' commands do is explained in Section 4.6.)
To make all this happen for you, you might edit the supplied PROFILE.SUB file (using RPED, say - see Section 3.6) and add these command lines to the end of this file, giving you the new PROFILE.SUB file:
SETDEF C:,* [ORDER=(SUB,COM),TEMPORARY=C:] PIP <C:=PIP.COM <C:=SET24X80.COM < SETKEYS KEYS.APP APPLIC B:DATAFILE SETKEYS RESET.KEYUsing a Start-up disc with such a PROFILE.SUB on it is sometimes known as Turnkey Operation because you just turn the computer on and the software runs. It is particularly useful if you want other people, who may not understand CP/M, to use the software you have bought. You can then just tell them to turn the Spectrum +3 on, put in the disc, press the Space bar and follow the instructions both on the screen and in the program's own instruction manual / user guide.
A number of programs are designed for use on computers with two disc drives. These programs can still be run on a Spectrum +3 with just one disc drive.
The reason you can do this is that the Spectrum +3 can pretend to CP/M that there are really two disc drives - called Drive A and Drive B. CP/M then alternates between addressing the disc drive as Drive A and addressing it as Drive B, according to the needs of the application program.
The moment the drive is changed from Drive A to Drive B, the message in the bottom right hand corner of the screen changes to Drive is B and you will get a message asking you to replace the disc currently in the drive by the disc 'for Drive B' - ie. the one that you would use in the second drive if you had such a drive. Similar messages appear when the drive is changed from Drive B to Drive A.
The messages that you get are the same as those you will have seen if you worked through the 'Practice in using CP/M' (Section 1.5) and so used PIP to copy BASIC.COM to your Data disc. There the disc to put in 'Drive A' was the CP/M Start-up disc and the one to put in 'Drive B' was your data disc, and the messages you saw were:
Please put the disc for A: into the drive and press any keywhenever CP/M needed your CP/M Start-up disc, and:
Please put the disc for B: into the drive and press any keywhenever it needed your Data disc. When you have inserted the right disc, you simply press a key - for example, the Space Bar.
This section advises you on how to go about installing software. If your software comes ready installed, this section should be ignored.
The first thing to find out is whether the application you would like to install on your Spectrum +3 was written specifically for another computer or for a range of computers. If it was written specifically for another computer, you will probably need specialised help.
If it was written for a range of computers, there will be a program (either with the software or as a special part of it) that is designed to help you install the application. The job of this installation program is to set details within the main program according to information you supply about how the Spectrum +3 works.
The relevant information about the Spectrum +3 is tabulated at the end of this chapter. However, the form in which the details will be requested varies from software package to software package, and so there is no guarantee that you will be able to use this information directly.
If you are lucky, how the installation program works will be explained in the documentation supplied with the software. Your best source of advice is your dealer who will know both the Spectrum +3 and the software you propose to install.
The installation program will typically request information from you through a sequence of questions on the screen.
Software suppliers typically include a fairly detailed set of instructions with any software package that needs installing, and we strongly advise you to read this.
The questions that appear on the screen mainly refer to the codes generated by keystrokes at the keyboard, the codes required by the screen to move the cursor around or display information, and the form in which data needs to be presented to the printer. Many of these codes have been standardised over the years: it is just the ones that can vary from machine to machine that need to be specified.
The installation program is likely to start by asking you what kind of monitor and what kind of printer you have. It may well do this by offering you a list of possibilities.
If Zenith Z19/Z29 is on its list of monitors, select this. The Spectrum's screen is sufficiently like these to allow most programs to run properly.
Other programs may require you to specify the parameters more precisely. You will need to draw the answers to specific questions one by one from the tables on the following pages.
One option you can take in matching the keyboard to the program is to use the SETKEYS utility to redefine the codes the keyboard produces. The way to do this is described in Section 4.6. This can be simpler than giving the installation program details of the codes produced at present.
The installation program of the software package sould only ever need to be run once. The program ensures that the special parameters are set to the right values throughout the software package. However, if you do use SETKEYS, this has to be run each time.
Hex Value | Decimal Value | Key Number | |
---|---|---|---|
Cursor up ![]() |
#1F | 31 | 23+![]() |
Cursor down ![]() |
#1E | 30 | 24+![]() |
Cursor left ![]() |
#06 | 6 | 22+![]() |
Cursor right ![]() |
#01 | 1 | 19+![]() |
Delete character under cursor ![]() |
#07 | 7 | 21+![]() |
Delete last character ![]() |
#7F | 127 | 20+![]() |
Escape (exit) ![]() |
#1B | 27 | 35+![]() |
Return ![]() |
#0D | 13 | 30 |
Space ![]() |
#20 | 32 | 35 |
Tab ![]() |
#09 | 9 | 18+![]() |
Further details of the keyboard control codes are given in Appendix II.
Hex Value | Decimal Value | |
---|---|---|
Sound bleeper (Bell) | #07 | 7 |
Move cursor back one space | #1B #44 | 27 68 |
Move cursor forward one space | #1B #43 | 27 67 |
Move cursor down one line | #1B #42 | 27 66 |
Move cursor up one line | #1B #41 | 27 65 |
Carriage return | #0D | 13 |
Line feed | #0A | 10 |
Delete character under the cursor | #1B #43 | 27 78 |
Backspace | #08 | 8 |
Clear the screen | #1B #45 | 27 69 |
Clear all the screen up to the cursor | #1B #64 | 27 100 |
Clear all the screen after the cursor | #1B #4A | 27 74 |
Clear the line to left of cursor | #1B #6F | 27 111 |
Clear the line to right of cursor | #1B #4B | 27 75 |
Move the cursor to top left corner of the screen | #1B #48 | 27 72 |
Move cursor to row r, columnc | #1B #59 r c | 27 89 r c |
(r and c are actual values plus #20 (hex), 32 (decimal)) | ||
Insert a line | #1B #4C | 27 76 |
Delete a line | #1B #4D | 27 77 |
Enter inverse video | #1B #70 | 27 112 |
Leave inverse video | #1B #71 | 27 113 |
Enter underline mode | #1B #72 | 27 114 |
Leave underline mode | #1B #75 | 27 117 |
Further details of the keyboard control codes are given in Appendix III.
This chapter looks at the most common tasks you are likely to use CP/M utilities for - keeping your discs organised and up-to-date. These tasks are often described as Disc housekeeping.
Each section covers one aspect of disc housekeeping, describing the commands you will need and how to use them for the job in hand in more detail than was possible in Chapter 1. If you need to know more about a particular command or utility, you can look it up in Chapter 5.
The topics covered are:
Throughout this chapter, we assume that the utility you require for any command is either on the disc in the default drive or that you have set the disc search order (see Section 3.15) so that the utility is automatically found.
If neither is the case, you will have to include the drive the utility is on as part of its name. For example, you may have to type:
B:PIP NEWFILE=OLDFILEto copy a file OLDFILE on the default drive, if the copy of PIP you want to use is on the disc in Drive B.
The easiest way of finding out how much free space there is on a particular disc is to use the SHOW utility.
The simplest form of SHOW displays the free space on all the discs in currently logged-in drives, along with what type of access is allowed to that disc. For example, the screen could look like this:
A>SHOW A: RO, Space: 44k B: RW, Space: 158k
This tells you that the discs CP/M currently has access to, are the one in Drive A and the one in Drive B and that while you are allowed to read from and write to the disc in drive B, you may only read from the disc in Drive A. (RW stands for Read-Write; RO for Read-Only). It also tells you that you have 44 kilobytes of free data space on the disc in Drive A but 158 kilobytes still free on the disc in Drive B.
You can display just the information about one particular disc by typing, for example, SHOW B: The screen display would then be:
A>SHOW B: B: RW, Space: 158k
If you want to find out the number of free directory entries on a particular disc, and thus the maximum number of new files you could store on that disc, the command to use is SHOW drive:[DIR]
For example, the screen could look like this:
A>SHOW A:[DIR] A: Number of free directory entries: 12
Making copies of discs on the Spectrum +3 involves using the DISCKIT utility. If necessary, DISCKIT will also format the disc being written to as part of the copying process.
DISCKIT presents menus to help you select the correct options for the job you want to do and puts up messages to tell you what to do or to advise you of any errors that have occurred.
Before you start copying, always check that the Write Protect Holes on your CP/M Start-up disc and the discs you intend to copy are open so that you cannot spoil them by accidentally writing to the disc. (There is a diagram in Chapter 5 of the Spectrum +3 User Guide showing the position of the Write Protect Holes and how they open and close.)
Start with your CP/M Start-up disc in Drive A (the built-in drive) with Side 1 uppermost.
Then type the command
DISCKIT
after a system prompt. This runs the DISCKIT program, which starts by telling you to remove
any discs you have in your disc drive(s). (If all you see is DISCKIT?, CP/M hasn't
found the DISCKIT program on the disc(s) it searched. Check that you inserted the right disc.)
When you have done this and pressed a key (say,
), it then displays
further messages. The first of these offeres the choice of Copy, Format or Verify (or Exit
from DISCKIT), and tells you which function key to press to select the desired action. In
this instance, you want Copy ie. the 1 key.
If you have just one disc drive, the next screen merely asks you to type Y to confirm that you want to copy the contents of one disc onto another.
If your system has two disc drives, the next screen will ask which drive you want to read from (press A for Drive A; press Q for Drive B). This is followed by a message asking which drive to write to (press A for Drive A; press Q for Drive B). You will then be asked to type Y to confirm that this is what you want to do.
The process of copying a disc may take place in a number of parts - each part copying a section of the information on the disc to READ onto the disc to WRITE. The messages that follow prompt you to put the right disc in at the right time, and tell you how the copying process is progressing (counting through the tracks, numbered 0...39, as these are copied).
The messages are designed to be self explanatory: for example, if DISCKIT needs a disc to be inserted in a particular drive, you will see a message like:
Insert disc to READ Press any key to continueor
Insert disc to WRITE Press any key to continue
Put the disc to be copied into the drive with Side 1 uppermost. When the corresponding WRITE message appears, insert the disc you want to copy to, again with Side 1 uppermost. Remember that copying can take place in a number of parts - each copying a section of the information on the disc to READ onto the disc to WRITE.
If, in swopping discs in and out of a single disc system, you mix up the disc you are reading from with the disc you are writing to, DISCKIT will display an appropriate message and allow you to change to the correct disc before continuing. However, DISCKIT can only do this after it has used both discs at least once - in other words, it can't perform this service on Part 1 of the copy. This is why it is so important to write-protect the disc you are copying.
Any error messages that appear should also be self explanatory, but if you feel in need of extra help, refer to Chapter 5 where full details of the DISCKIT messages are given.
Once the process of copying one disc has been completed, DISCKIT tells you to remove all discs from the drives, and then gives you the option of copying another. If this is what you want, type Y and follow all the steps of copying a disc again.
The utility that makes a copy of a file either on the same disc or on a different disc is the Peripheral Interchange Program, PIP.
As you might suppose from its full title, this utility is used for more actions than just copying files from disc to disc. Details of the options are given in Chapter 5.
The fundamental command needed to copy files is:
PIP destination=sourcewhere source represents the name of the file to be copied and destination the name of the new file which is created to hold the copy.
This command is used whatever the details of the file you want to copy and wherever you want to store the new file. For example:
When you want to copy the file to a different disc but retain the original filename and filetype, there is a shorter command you can give:
PIP destination-drive:=source
For example:
This form of the PIP instruction can't be used to make a second copy of a file on the same disc because you can't have two files with identical filename and filetype on the same disc.
As a general rule, if the destination file already exists, the old file contents are erased as part of the copying process.
In common with many other CP/M commands, PIP allows you to use Wildcards to reduce the number of instructions needed to copy a number of files from one disc to the other. The characters that can be used as wildcards are * and ?
An asterisk is used to represent any valid group of characters. It can replace a whole filename or filetype or complete a filename or filetype when you quote the character(s) that start it.
A question mark represents a single character or blank in the same position as itself.
For example:
These versions of the PIP instruction cannot be used to produce copies of a file on the same disc as the original.
When you have a number of files to copy, you won't always be able to find a template that picks out just the files you want. So instead of using one PIP command to copy all the files, you will have to use a number of separate PIP commands. To help you do this, PIP has a special Multiple Command Mode in which it prompts you for the next file to copy.
To start using PIP in Multiple Command Mode, you just type:
PIP
This command loads the PIP utility into memory and starts it running. PIP then prompts you for the details of the copy you want to make by displaying an asterisk. You then type these details in the form:
destination=sourceIn other words, what you type is the PIP command for the copy you want to make but without the PIP. For example, you might type:
NAME.TXT=MYNAME.ADR
PIP makes the copy you have specified and then prompts you for details of the next copy you
want to make by displaying another asterisk - and so on until you simply type
after the asterisk.
Typing just
leaves
PIP and returns you to the CP/M prompt. So, from start to finish, the copy operation might
go something like this:
A>PIP* NAME.TXT = MYNAME.ADR
* B:=A:USEFUL.SUB
* B:=A:*.COM
*
A>
There is more than one way of creating a new file under CP/M.
For shorter files such as SUBMIT files (see Section 3.15), we recommend using RPED - the text editor supplied on your CP/M Start-up disc. Another option you have is to use CP/M's own Text Editor ED, details of which are given in Chapter 5 of this part of the User Guide.
These each have their own ways of handling the characters you type in, so follow the instructions carefully.
The first thing to do always is to check that there is enough room for the new file on the disc you propose to use. Use the SHOW command to do this (see Section 3.1).
RPED is a fairly simple Text Editor. Its advantage is that it displays a constantly updated version of the file you are working on and allows you to use the cursor keys etc. to move around the text and edit it.
To use it, insert your CP/M Start-up disc in Drive A and just type A:RPED after a system prompt. (If you don't use the supplied PROFILE.SUB on your Start-up disc, CP/M may simply respond with RPED?. If this happens, try typing SUBMIT A:RPED.)
CP/M then loads RPED. When it has finished loading, you will see a display like this:
This screen editor is for small files (up to 200 lines) and uses normal cursor and delete keys on both text and filenames. EDIT toggles insert/overstrike mode, BREAK ends the edit, ^C aborts the edit. 5 To edit last screen 3 To edit new screen 1 To edit existing file 0 To quit |
The top few lines of the screen explain in general terms how RPED works. Read this carefully. Displayed in the centre of the screen are the keys you need to press either to start editing an existing file or to create a new file or to stop using RPED. The other aspect of using RPED to note is that your Spectrum is now working with a 24 x 80 screen - so that the lines of your text file are displayed correctly. (Each line is 80 characters long.)
The key to press to create a new file is 3. Press this now. RPED then asks you to type in the name for your new file.
Type this in as filename.typ. For example, if the file you are preparing is a SUBMIT file (see Section 3.15) you might type MYPROG.SUB. This name is then inserted in the box provided for it.
If you make any mistakes typing this name, use the Cursor keys to move back to the part
of the name you want to change and then re-type this part of the name. You should also use
this technique to change the drive letter at the start of the file name if you want to store
the file on a different drive to Drive A. (Note: Pressing
to try to delete
the old filename does not work: you have to move the cursor to the left of the current drive
letter and then type the new drive letter.)
When the name is correct, press .
RPED then displays a second screen - which is essentially a blank piece of paper on which to
type your file. Type the file line by line, pressing
at the end of each line to move to the start of the next line.
If you make any mistakes in your typing, simply use the Cursor keys to position the
Cursor where you want to make the change, use
and
to delete characters
you no longer want and type in fresh characters.
Note: This is the simplest way of editing the file. You can also:
Details of these actions are given in Section 3.6 'Editing text files'. (Creating a file and editing a file are very similar action.))
When you have finished preparing your file, press .
The file is then saved on disc and you are returned to RPED's first screen so that you can, for
example, create another file by pressing 3 again.
Press 0 to finish working with RPED.
You can always use the
key to rub out characters when you make a mistake or change your mind about the command you want
to execute. However, CP/M Plus provides some short cuts to getting the command line typed in correctly -
including using an earlier command as part of the current command. These short cuts are taken by
pressing particular keys or combinations of keys on the Spectrum +3 keyboard.
The keys you want are as follows:
![]() |
to move the cursor back one character |
![]() |
to move the cursor forward one character |
Typing a character inserts the character at the cursor. The cursor and any characters to its right are moved one character to the right.
Using the key followed
by the arrow keys and the
and
keys can avoid much
re-typing when you want to execute a series of similar commands.
There are two tools on your Spectrum +3 that you can use to edit text files - RPED and the CP/M Text Editor ED. We suggest you use RPED. This displays a constantly updated version of your file on the screen and allows you to use the Cursor Keys etc. to move around the file and edit it. Details of how to use RPED to edit a file are given below. Alternatively, you might use the CP/M Text Editor ED to edit this file - see the description of ED in Chapter 5.
If you have already used RPED to create a file, you will fid the steps involved in editing very similar. The only difference is that you select a different option from RPED's initial 'menu' and you have to specify both the name of file you want to edit and where you want the new version stored. (You don't have to overwrite the 'old' file if you don't want to.)
To use RPED, insert your CP/M Start-up disc in Drive A and just type A:RPED after a system prompt. (If you don't use the supplied PROFILE.SUB on your Start-up disc, CP/M may simply respond with RPED?. If this happens, try typing SUBMIT A:RPED.)
CP/M then loads RPED. When it has finished loading, you will see a display like this:
This screen editor is for small files (up to 200 lines) and uses normal cursor and delete keys on both text and filenames. EDIT toggles insert/overstrike mode, BREAK ends the edit, ^C aborts the edit. 5 To edit last screen 3 To edit new screen 1 To edit existing file 0 To quit |
The top few lines of the screen explain in general terms how RPED works. Read this carefully. Displayed in the centre of the screen are the keys you need to press either to start editing an existing file or to create a new file or to stop using RPED. The other aspect of using RPED to note is that your Spectrum is now working with a 24 x 80 screen - so that the lines of your text file are displayed correctly. (Each line is 80 characters long.)
The key to press to edit an existing file is 1. Press this now. RPED then asks you to type in the name of the 'Source' file - that is, the file you want to edit. Type this in as filename.typ. For example, if the file you want to edit is a SUBMIT file (see Section 3.15) you might type MYPROG.SUB. This name is then inserted in the box provided for it.
If you make any mistakes typing this name, use the Cursor keys to move back to the part
of the name you want to change and then re-type this part of the name. You should also use
this technique to change the drive letter at the start of the file name if you want to store
the file on a different drive to Drive A. (Note: Pressing
to try to delete
the old filename does not work: you have to move the cursor to the left of the current drive
letter and then type the new drive letter.)
When the name is correct, press .
RPED then asks you to give it the name of the Destination file - that is, the file you want to
save the edited version in. If you want the new version to replace the existing file, just press
: otherwise edit the name
in the box as described above and then press
.
When you press ,
RPED displays the current file (or, at least, the first section of this file) on a second screen.
You can now move the Cursor to any point in the file by pressing the Cursor keys and you can make
changes as follows:
Note: You effectively edit a line at a time and so you must plan your editing
in terms of correcting each line separately. You can't, for example, split one line into two
by positioning the Cursor where you want to make the break and then pressing
. Pressing
merely moves the
Cursor to the start of the next line.
When you have finished preparing your file, press .
The file is then saved on disc and you are returned to RPED's first screen so that you can, for
example, create another file by pressing 1 again or re-edit this file by pressing
5.
Press 0 to finish working with RPED.
You delete files you no longer need by using an ERASE command. The space taken up on the disc by the data and the entry in the directory are automatically reclaimed for use by a later file.
The most general form of this command is:
ERASE fileor
ERA filewhere file represents the name of the file to be erased.
For example:
If no file is found with exactly the given name, the screen message No File will appear.
The ERASE command also allows you to use Wildcards to reduce the number of instructions needed to erase a number of files.
The characters that can be used as wildcards are * and ?
An asterisk is used to represent any valid group of characters. It can replace a whole filename or filetype or it can complete a filename or filetype when you quote the character(s) that start it.
A question mark can only represent any single character or blank in the same position as itself.
Note: The wildcard version of the ERASE command needs to be used with care. Files erased in error cannot be restored.
A way of guarding against this while still taking advantage of the compact wildcard instruction is to use the Confirm Option of the ERASE command. The usual command is followed by [C] or [CONFIRM]. However, this option can only be used when the associated utility ERASE.COM is available either on the default drive on another drive that you tell CP/M to search (either directly by putting the drive letter followed by : at the start of the command or indirectly by using SETDEF to put the drive on the search path - see Session 3.15).
As CP/M finds entries in the disc's directory that match the given specification, it displays the filename, along with a message asking you to confirm whether this file is to be deleted by typing Y or N as appropriate. It then proceeds to find the next match.
For example:
If you want to know the size in kilobytes of one or more files, the command to use is a DIR command with the SIZE option. CP/M recognises that you want this additional information if you add [SIZE] to the end of your DIR command. However, this option can only be used when the associated utility DIR.COM.COM is available either on the default drive or on another drive that you tell CP/M to search (either directly by putting the drive letter followed by : at the start of the command or indirectly by using SETDEF to put the drive on the search path - see Session 3.15).
You get this information only for the files you want, either by going through one by one giving the ful names of each file you want or by making appropriate use of Wildcards. The characters that can be used as wildcards are * and ? An asterisk is used to represent any valid group of characters. It can replace a whole filename or filetype or it can complete a filename or filetype when you quote the character(s) that start it. A question mark can only represent any single character or blank in the same position as itself.
For example:
Formatting is the preparation a blank disc needs before data can be stored on it. Formatting a new disc involves using the DISCKIT utility. You can also format an old disc, but you should remember that this will destroy all the old data.
If you also want to be able to load CP/M from the new disc, you must both format the disc and then put a copy of the file containing the CP/M operating system onto the disc. The operating system is stored in the file called S01CPM3.EMS or a similar name to this. One way of doing this is to copy your CP/M Start-up disc onto your new blank disc, as described in Section 3.2. (Formatting is automatically a part of the copying process.) You can then use the ERASE command to erase all but S01CPM3.EMS from the newly copied disc (see Section 3.7).
Start by checking that the Write Protect Holes of your CP/M Start-up disc are open so that you cannot accidentally format this disc. (There is a diagram showing the position of the Write Protect Holes and how they open and close in Chapter 5 of the Spectrum +3 User Guide.)
Then ensure that the CP/M Start-up disc is in Drive A.
Type DISCKIT ;
then remove any discs from the drive(s) and press a key when prompted. This brings up a set of
messages, which offer the choice of Copy, Format or Verify (or Exit from DISCKIT), and tell you
which key to press to select the required option. In this instance, the Format option is
required, and so press the Q key.
(If all you see is DISCKIT?, CP/M hasn't found the DISCKIT utility. Check that you inserted the right disc.)
Users with just one disc drive will then get a message asking them to insert the disc to be formatted. Those with two drives at their disposal will be asked which drive will be used for formatting, and then asked to type Y to confirm that this information has been entered correctly.
Place the new disc in the specified drive with Side 1 uppermost and press a key (say,
).
Throughout the formatting process, messages can appear at the top of the screen. Most of these should be self explanatory: for instance, no disc in the drive could lead to the screen message:
Insert disc to format Press any key to continue
Th messages that indicate that some error has occurred should also be self explanatory, but if you need extra help turn to Chapter 5 where the DISCKIT messages are given in full.
The command normally used to display information about your files is DIR. This is a built-in command: in some circumstances, it is supported by the DIR utility.
If you simply want a list of the files on a disc, type:
DIR drive:where drive is the letter representing the drive holding the disc and is omitted in the case of the default disc. For example:
If there are also some special files called System Files on that disc, you will be told this once all the Non-system files have been listed. The command needed to list these files is the DIRSYS command.
A detailed discussion of the DIRSYS command is inappropriate here. All you need to remember about DIRSYS is that is works very much like DIR, but only DIR can be enhanced through the various directory searching options.
You can also use the DIR command if you just want to see if a particular file is on the disc you are working with. The command line to type is:
DIR filewhere file represents the name of the file. For example:
If it isn't, then No File will appear on the screen.
You can use this version of the command, but with Wildcards, to list out details of a group of files. The characters that can be used as wildcards are * and ?. An asterisk is used to represent any valid group of characters. It can replace a whole filename or filetype or it can complete a filename or filetype when you quote the character(s) that start it. A question mark can only represent any single character or blank in the same position as itself. For example:
You can obtain more information about the files by using the Options associated with the DIR command. To use these options, you must have the companion DIR.COM utility either on the default drive or on the search path you have set with a SETDEF command (see Section 3.15) - or you should tell CP/M where to find it by putting the drive letter followed by : at the start of your command.
Some of the more useful options are EXCLUDE, FULL and SIZE. EXCLUDE enables you to list all files except those with the given filename; FULL makes the directory listing include size and all the special characteristics along with each file; and SIZE gives the size of each file listed.
The SIZE option is used most often to discover how big a particular file is, typically just before it is copied from one disc to another.
For example:
If you want to examine the contents of any file on the screen, type:
TYPE filewhere file represents the name of the file to be listed.
The contents of the file are displayed on your monitor, a screenful at a time. Press
to see more.
If you would like to get a print out of the file at the same time, type 'Control-P'
(+P)
before you type the above command. The Spectrum will bleep when you do this. Now all the text
that appears on the screen will be 'echoed' on the printer.
A second 'Control-P' will turn the printer off.
Alternatives to both of these instructions are provided by the PIP utility.
The way files are organised on CP/M discs allows you to put files on the same disc into separate more manageable groups, each with its own directory. You can then work on just the files listed in one directory at a time.
The files in the separate directories are treated as if they belonged to different people. The 'people' are referred to as Users and so each group is given a User Number. User Numbers run from 0 to 15, giving you up to 16 different groups in which to put your files.
All the time you are running CP/M, you have a User Number. This is referred to as the Current User Number. You can always tell what the Current User Number is from the System Prompt. For example, if the system prompt is 3A>, the Current User Number is 3 but if the prompt just gives the letter of the default drive, then the Current User Number is 0.
In general the files you work with at any time are the ones with the current user number. Files with a different User Number are hidden from you. Any new files you create will also have the current User Number.
For example, suppose you had the files MYFILE.A, MYFILE.B and MYFILE.C with User Number 0 and the files YOURFILE.A and YOURFILE.B with User Number 1. While the Current User Number is 0, the files you can process are the MYFILE files and the YOURFILE files are hidden from you. If the Current User Number is some other number (say, 5) both groups of files will be hidden from you.
Most of the commands only work with files from the Current User Number. However, a few can process files of a different User Number. In particular, you can use the PIP command to create copies of these files either with the Current User Number or with a different User Number. You can therefore 'tidy up' a disc by copying files to a different User Number and then erasing the original copy. However, you may have to change the Current User Number before you erase a file because the only files you can erase are ones with the Current User Number.
To change the Current User Number, type either:
USER numberor![]()
number:![]()
For example, to change to User Number 3, type either:
USER 3or just
3:
If you wish, you can change the Current Drive at the same time as the Current User Number by typing:
number drive:![]()
For example, you can change to User Number 3 on Drive B: by typing:
3B:![]()
CP/M responds by changing the System prompt - in this case to 3B>
In general the only program files that you can run have the Current User Number. The exception to this is program files that have User Number 0 and that have been designated System files (see Section 3.13), which can be run whatever the Current User Number is.
If you regularly make back-up copies of your valuable files - something we advise most strongly - you may not need to take any special steps to protect your files. If this is the case, you don't need to read any further.
Protecting your files is all about giving files the right set of labels. For example, if you don't want the contents of a file to be overwritten, then you give the file a label to say that it can only be read. These labels are often called Attributes, they can be changed at any time during the lifetime of the file and they are copied when the file is copied.
The way to ensure that your important files are not lost through being accidentally overwritten or deleted is to give them a RO (Read-Only) label. The files are then said to be Write-protected, and they stay Write- protected until you replace the RO label with a RW (Read-Write) label.
The utility you use to mark a file Read-Only or Read-Write is the SET utility and you use it as follows.
To mark a file Read-Only, you type the command:
SET file [RO]
To mark it Read-Write, you type the command:
SET file [RW]
So, for example, to make MYFILE.A Read-Only, you would type the command:
SET MYFILE.A [RO]
Note: Marking a file RO protects against an unwise ERASE command (eg. one involving wildcards). It does not stop you losing files when you re-format the disc they are stored on or when you damage the disc, for example by pouring coffee over the disc!
Programs which are vital to your system are protected by making them System files by giving them the label SYS. All other files have the label DIR.
System files:
Another reason for labelling a program as a System file is to make it available for use when the Current User Number is not the program's User Number. However, this only applies to program files (ie. files with the filetype COM) with User Number 0.
The utility you use to make a file a System file is again the SET utility and you type the command:
SET file [SYS]
So, for example, to make MYPROG.COM a System file, you would type the command:
SET MYPROG.COM[SYS]
To make it a 'non-system' file again, you would type the command:
SET MYPROG.COM[DIR]
Note: Marking some of your files as System files is also a way of making your disc appear tidier when you list its contents, because Directory files and System files are listed separately using different command (see Section 3.10).
If you are worried about a file being read or changed by someone else, you can give the file a password which must be typed in before the file can be used. This stops anyone who doesn't know the password from using the file - but it also means that you have to remember the passwords you set if you are going to be able to use the file yourself! There's nowhere you (or anyone else) can rediscover what password you used.
CP/M gives you a choice of actions to protect through a passowrd, which you select by setting the Protection mode as follows:
Reading, copying, changing, deleting and renaming | the READ mode |
Changing, deleting and renaming but not reading or copying | the WRITE mode |
Just deleting | the DELETE mode |
You set both the password and the Protection mode with SET commands as follows.
The first step is to ensure that the disc holding the file has password protection 'turned on'. This is done by using the command:
SET drive:[PROTECT=ON, PASSWORD=password](You need the password to stop someone else simply coming along and turning password protection off!)
You can then set the password and the protection mode you want for the individual files on this disc by typing commands of the form:
SET file [PASSWORD=password, PROTECT=mode]
For example, to protect MYFILE.A against being changed, deleted or renamed, you might type the command:
SET MYFILE.A[PASSWORD=SECRET, PROTECT=WRITE]
Once a file has been given a password, you have to give this password before any of the protected actions can be carried out. You do this either by following the name of the file in your command line with ;password or by setting the 'Default' password to this password by using the command:
SET [DEFAULT=password]
To clear the password protection, you have to set the Protection mode to NONE - but before you can do this, you have to show that you have a right to do this by quoting the password immediately after the name of the file as follows:
SET MYFILE.A;SECRET[PROTECT=NONE]Note: If you copy a password-protected file, the new file you create will also be password protected if you:
In the first case, the copy is given the same password and the same Protection mode; in the second case, the copy is given the new password and the Protection mode is set to READ.
You can only copy a group of files that includes password-protected files if they all have the same password and you set the Default password to this password first.
The renaming of files is handled by the built-in RENAME command, in some cases supported by the RENAME utility.
Renaming is just a change of name; the data or program file itself is not altered in any way by RENAME.
The most general form of this command is:
RENAME new-name=old-nameor
REN new-name=old-namewhere old-name represents the current name of the file and new-name the name you wish to change it to.
For example:
The only restriction on your choice of new-name is that it must not be the name of any existing file on that disc.
RENAME won't accept a different drive for the file under its old name to that you quote with its new name: in other words, it cannot be used to move a file from one disc to another. To do that, you have first to use PIP to copy the file (see Section 3.3) and then use ERASE to delete the original copy of the file (see Section 3.7).
If CP/M fails to find old-name in the directory, the message No File will be displayed on the screen.
You can reduce the number of instructions needed to rename a number of files by appropriate use of Wildcards.
The characters that can be used as wildcards are * and ?
An asterisk is used to represent any valid group of characters. It can replace a whole filename or filetype or it can complete a filename or filetype when you quote the character(s) that start it.
A question mark represents a single character or blank in the same position as itself.
But if you do decide to use the wildcard option, you must remember to make the wildcards in old-name and new-name identical. For example, REN *.TX1=*.TEX and REN A*.T*=S*.T* are valid commands but REN A*.TEX=A*.T* isn't.
You can shorten many of your command lines by extending the way CP/M interprets the commands you give it:
Suppose, for example, that in order to run a particular program, you usually type the commands:
PIP B:=*.DAT SETKEYS KEYS.APP APPLIC B:DATAFILE.DAT
If you were to put these command lines in this order into a file which you called TRANS.SUB, you could then use CP/M SUBMIT utility to get the same effect by just typing:
SUBMIT TRANS
The TRANS.SUB file is called a SUBMIT file. SUBMIT files are always just simple text files which you can create (and edit) by using the RPED text editor (see Section 3.4). They always have the filetype SUB.
SUBMIT files are typically made up of a sequence of command lines written exactly as you might type them at the keyboard, with each command line on a separate line of the file. Sometimes they will also include lines of data that will be required by the programs being run. Each line of data appears on a new line, at the point in the sequence where the information will be needed, and starts with a <.
A common requirement for data lines is given by any SUBMIT file that uses the PIP utility in its multiple command form (see Section 3.8). The lines giving details of the Source and Destination of each copy, that follow the command line
PIPare essentially lines of data required by the PIP program and so appear on separate lines of the SUBMIT file, each starting with a <. This includes the last line on which you just press
For example, suppose you would need to type the following to make the copies you require:
PIPthen this should appear in your SUBMIT file as:B:=A*.DAT
B:=B*.DAT
![]()
![]()
PIP < B:=A*.DAT < B:=B*.DAT <
If you want CP/M to carry out a specific sequence of actions immediately after it has been loaded, you just put the commands you would type to carry out these actions into a special file in User Number 0 called PROFILE.SUB. Any command in PROFILE.SUB are always executed as part of loading CP/M.
Your Spectrum +3 was supplied with a PROFILE.SUB as follows:
SETDEF *,C: [ORDER=(SUB,COM)] PIP < C:=PIP.COM < C:=SET24X80.COM <
This copies the PIP and SET24X80 utilities into the Memory Disc and sets a program search path such that CP/M will automatically look for programs both on the default drive and on the Memory Disc (see below). If you create your PROFILE.SUB by adding to the supplied file, you will retain these actions as an automatic part of loading CP/M.
The utility which sets up the search path is called SETDEF. It has two principal actions: extending the number of drives automatically searched for programs; and instructing CP/M to treat SUBMIT files as additional programs.
Normally, if the program you want to run is not on the default drive, you have to specify the drive it is on in your command line. You can make your command lines much simpler by giving CP/M a list of drives to search alongside the default drive. To do this, you use the SETDEF utility with the drives you want searched as its parameters. The order in which you list the drives will be the order in which they are searched for your programs.
For example:
If you want to put the default drive on this list, then you use an asterisk to represent the default drive. For example:
This use of an asterisk is special to SETDEF. It is not followed by a colon.
The ORDER option of the SETDEF utility is used to extend the search to cover SUBMIT files that you set up.
You can either specify that CP/M searches .SUB files first and then .COM files or vice versa. It executes the first file it finds with the given name.
The two possible SETDEF commands are:
SETDEF [ORDER=(SUB,COM)]and
SETDEF [ORDER=(COM,SUB)]
Choose the first of these if you have called the SUBMIT file to run a particular program program-name.SUB. Otherwise typing the command program-name will just execute the program itself and not the other commands that you have put into your SUBMIT file.
Suppose you had made this choice. Then, the command line:
MYCOMMwould make CP/M search first for a file called MYCOMM.SUB and only if it cannot find it, would it carry on and search for a file called MYCOMM.COM.
If it finds MYCOMM.SUB, CP/M will execute the command as if you had typed:
SUBMIT MYCOMM
Note: You can, if you want, override the rule you've set with SETDEF in order to run individual program or SUBMIT files. If you want to run the program file rather than the SUBMIT file, you type the program name as name.COM. If you want to run the SUBMIT file rather than the program file, you use the SUBMIT utility explicitly and begin your command line SUBMIT name.
You switch discs either by changing which drive is treated as the default drive or by physically changing the disc in a drive.
The default drive is changed by simply typing in new-drive:
For example, suppose you would like Drive B to become your default drive. The command to type in is just:
B:![]()
Most of the time when you want to change which disc is in Drive A or Drive B, all you need to do is release the old disc and put in the new one. But there are some circumstances in which CP/M won't be able to find all the files on the new disc if you don't tell it that you have changed the disc in the drive immediately after putting the new disc in. In particular, DIR may not give you details of all the files on the disc.
Always resetting the drive is therefore a good habit to get into.
The drive is reset by the control code, Control-C, which is generated by
holding down
and pressing C.
When you bought CP/M for your Spectrum +3, it was set up to be used in a very conventional way with:
Moreover, the programs you use have probably been designed to take some information through the keyboard and other information from, say, the RS232 port and to send some messages to the screen and some, say, to the printer.
This is a perfectly satisfactory arrangement if, say, you use a parallel printer with your Spectrum but not if you have a serial printer (which you would need to attach to the RS232 port) or you want to use your Spectrum for communications. The RS232 port on the Spectrum is a very simple device, which cannot handle the simultaneous input and output of communications: instead you need this 'auxiliary' information to be handled by a dedicated Serial Interface attached to the Expansion port.
In addition, you might want to change how some of your input and output devices are set up. For example, you might want to replace your printer or your communications link with a new one that needs data sent to it at a different speed or checks the data has been sent correctly in a different way - or you might just want to change the speed at which data is sent to your current link.
Changing where information comes from and goes to would seem impossible without rewriting the program. But in fact such changes are made very easily because in the main your programs don't make use of your input and output devices directly. Instead, they use 'logical' devices (with names like CON:, LST: and AUX:) which CP/M links to the 'physical' devices CRT (your keyboard and your monitor), LPT (the Printer port), SIO (the RS232 port) and SERIAL (the Expansion port).
All you have to arrange is that each logical device is 'assigned' to the right physical device. In particular, you need to ensure that you don't assign a logical 'output' device to a physical 'input' device (such as the keyboard) or a logical 'input' device to a physical 'output' device (such as a printer). Your computer can't write to a keyboard and and you can't enter data through a printer!
This chapter explains how to tailor your Spectrum +3 to your needs by:
The Printer Port on the back of the Spectrum +3 is a standard 8-bit Centronics Interface and so can be used to connect a wide range of parallel printers to your Spectrum. If your printer has a standard Centronics connector, you should be able to connect it directly to the Printer Port. If it has an IBM-type Centronics connector (with pins), you will need an adaptor. Consult your printer dealer for details.
(If you have a Serial printer, you will have to connect it to your Spectrum's RS232 port. How you use this port is explained in Section 4.2)
Unfortunately, using a printer with a computer is rarely just a matter of connecting the two together. Some programs do all the hard work for you where the printer's own defaults don't give you the settings you want but often it falls to you to ensure that:
In addition, CP/M has a built-in timeout mechanism to stop your system 'hanging up' if you accidentally try to send some output to a printer (say) when none is connected. However, this can work against you rather than for you if it takes your printer a long time to feed a sheet of paper - so you might also need a way of overriding the timeout mechanism.
There are CP/M commands to do all these things. The details are given below.
As we pointed out in the introduction to this chapter, the key to directing output to a particular device is in linking the logical device associated with this output to the correct physical device. In the case of printer output and the built-in Printer port, this means linking the LST: logical device to the LPT physical device.
Immediately after CP/M is loaded, LST: is assigned to LPT - ie. this is the normal assignment for LST:. However, it is always best to check that this is still true before you start printing. The command line to use is simply:
DEVICE
CP/M responds with details of the available physical devices and the current assignments of the logical devices. For example, you might see:
Physical devices: I=Input, O=Output, S=Serial, X=Xon-Xoff CRT NONE IO LPT NONE O SIO NONE IOS Current Assignments: CONIN: = CRT CONOUT: = CRT AUXIN: = SIO AUXOUT: = SIO LST: = LPT Enter new assignment or hit RETURN:
The section of this display you are interested in is the list of Current Assignments. CONIN: etc. on the left of this list are CP/M's logical devices; CRT etc. on the right are the physical devices to which the logical devices are currently assigned. Any Null Devices listed aren't real devices: they just record that these logical devices are unassigned. (Note: Output sent to a Null Device is simply thrown away.)
The line of this list to look at is the one for LST:. If this
reads LST:=LPT, all is well and you should just press
.
(The
key is the equivalent on the Spectruom of the RETURN
key mentioned in the message.) If this line shows any other assignment, you
should type:
LST:=LPT![]()
When you initialise a printer, you typically clear its buffer of any text that might be waiting to be printed and then set how the printer will operate. In particular, you might set:
These are all aspectes of printing that can be set by sending special Printer Control codes to the printer, details of which should be given in the printer's own user guide. So the problem comes down to how you can send these codes to the printer.
One way of sending these codes is by running a BASIC program containing a number of LPRINT commands: this is described in Part II, Section 3.5. What we describe here is an alternative method in which you set up the details of the codes in a special file, called a Printer Definition file, and then use the CP/M utility SETLST to send the contents of the file to the printer. This method is very useful if you always need to set up the printer in a particular way because SETLST command can very easily be included in your PROFILE.SUB file and executed as part of loading CP/M.
The first part of the job is to set up the Printer Definition file. The codes are all single characters and they can be entered in the printer definition file in a number of different ways - char, ^'value', ^char or ^'name', depending on the code. Here char is the character corresponding to the code, value is either its decimal or hexadecimal value, ^char is the control code Control- char, and name is the special name associated with the code (see Appendix II.2). For example, the code corresponding to the capital letter A (decimal value 65) can be entered as A or as ^'65' or as ^'#41', while the control code Control-M (decimal value 13) which generates a Carriage Return can be entered as ^'13', ^'#0D', ^M or ^'CR'. However, the codes corresponding the characters ^ and " cannot be entered as char but they can be entered as ^^ and ^", respectively.
Printer Definition files are typically not very long. For example, the whole file might just be:
^'ESC'@^'ESC'l^'0'^'ESC'Q^'139'^'SI'^'ESC'd
This example string is made up of codes that are used by Epson-compatible printers. If this string were sent to such a printer, it would:
- | reset the printer into FX-80 mode: | ESC @ |
- | set the left margin at character position 0: | ESC l(lower case L)0(value zero) |
- | set the right margin at character position 139: | ESC Q 139 |
- | set Condensed (17 pitch characters): | SI |
- | Make this the default set-up for the printer: | ESC d |
Note: Spaces between the codes are not significant in this file, so you can space the individual codes out any way you like.
Once you have created the Printer Definition file, you can initialise the printer simply by typing the command:
SETLST filespec
For example, if your Printer definition file is called PRINTER.DEF, then the command you need is simply:
SETLST PRINTER.DEF
Note: The printer that this command initialises is the one that is currently addressed by the logical device LST:. This normally points to the built-in Printer port, but this can be changed by using a DEVICE command. (For details, see the description of the DEVICE command in Chapter 5.)
As a rule, CP/M Plus automatically times out sending information to a device in order to prevent the system 'locking up' completely because the information is being sent to a non-existent device. So, for example, if Control-P is typed accidentally when no printer is connected, CP/M will recognise after about 30 seconds that no printer is responding and produce a message like this:
LPT not ready - Retry, Ignore or Cancel?
You can then either switch the printer on-line and Retry - or type C for Cancel. (Note: If you do select the Cancel option, you should follow this up as soon as possible by using DEVICE (as described above in the section on 'Sending printer output to the Printer port') to link LST: with a suitable physical device. Typing C told CP/M to throw away any further output that you or your program tries to send to the LST: device - which might not be what you want!
Unfortunately, some printers take such a long time feeding a sheet of paper that CP/M times out before the operation has finished, requiring you to type R to continue. The better solution is to disable the timeout for the device by using the TIMEOUT command:
TIMEOUT device OFF
When you want timeout in operation again, you then simply type the command:
TIMEOUT device ON
WARNING: IF 'TIMEOUT OFF' IS SELECTED FOR A DEVICE THAT IS NOT FITTED, CP/M WILL LOCK UP.
A standard issue in any kind of data transfer is how you ensure that data is transferred only when the receiver at the other end of the line is ready for it. This involves either establishing a protocol, under which the receiver sends specific codes to interrupt and to re-start the flow of data, or using one line of the cable between the two devices to signal when to stop and when to re-start. The latter method is known as handshaking.
When the Spectrum is attached to a parallel printer via the Printer port, handshaking between the two devices is automatically established and there's no protocol to be set up. You don't have to do anything.
It is possible that all of your printing comes out with double-line spacing under CP/M, even though you may have been printing satisfactorily on the same printer under Spectrum +3DOS. The problem can also occur in reverse, with the printer working fine under CP/M but each line simply overprinting the previous one under +3DOS. The reason for this effect is that Spectrum +3DOS normally sends only a carriage return (CR) code to the printer at the end of a line, while CP/M sends both a carriage return code and a line feed (LF) code.
So that most printers can move to the start of a new line correctly in both cases, most printers have an 'AUTO-LF' option with the following effect:
How you select or de-select AUTO-LF depends on your printer. The following notes, read alongside your printer's own manual, should help you decide what you need to do in your particular case. We also describe what actions are required in the specific case of a few popular printers.
Many printers have one or more blocks of little switches (often in rather inaccessible places, but your printer manual should tell you where!), which provide various options, one of which may be used to determine the way in which CR is handled. If your printer has an option switch for AUTO-LF, simply set it to on when using +3DOS and off when using CP/M. (But see also the comments in 'Selection via escape sequences' and 'Using the AUTO FEED XT signal' below.) Note: Always turn off the printer before adjusting any option switches, and wait for at least five seconds before turning on again. The printer will then work to the new setting(s) of the option switches.
IMPORTANT:
With some printers, you can use escape sequences to control the interpretation of the CR code, over-riding the setting of any option switch. There are normally two sequences, one to select AUTO-LF and one to select CR only. The initial selection will normally be the option switch setting.
If your printer has this facility, we suggest you set the option switch for AUTO-LF, so that the printer will work correctly under +3DOS. When you want to print from CP/M, you need to send the sequence for 'CR only' before sending output to the printer (and to send the sequence for AUTO-LF prior to leaving CP/M). This may be done, for example, using Mallard BASIC and LPRINT commands. (The description of the Qume Sprint below gives an example of this.)
With many parallel printers, the way in which CR is handled depends on AUTO FEED XT signal, which appears at pin 14 of the parallel interface. The Spectrum permanently grounds this signal, which means that these printers will give AUTO-LF, whatever the setting of any other options. This can only be over-ridden by software if the printer has special escape sequences for setting the handling of CR. The only alternative is to cut line 14 on your parallel printer interface cable. (Line 1 will usually be marked by a red line down its length.)
A few printers do not give you the choice, but will always AUTO-LF on receiving a CR code. This is not a problem under +3DOS, but may be a problem under CP/M depending on how the LF code is treated by the printer. If the LF code is ignored by the printer, or ignored whenever the preceding character was a CR, you have no problem. If, however, the LF code always causes a line- feed, or if it is treated in exactly the same way as the CR code, all CP/M software using the printer will produce double-spaced text, unless the software can be 'configured' to cope with this.
These printers do not have an escape sequence for setting or clearing AUTO- LF.
Amstrad LQ3500: AUTO-LF is selected in very much the same way as on the DMP3000/4000 printers described above. The only difference is that the switch we have to set is DS2-2 - ie. the second from the left, on the right-hand block of option switches.
Epson FX-80: This printer also uses the AUTO FEED XT signal, so the interface cable must have line 14 disconnected. You then have to set the SW2-4 option switch to OFF for CP/M or to ON for +3DOS.
The option switches are all under an access cover on the right-hand side of the printer. This cover is held in place by a single cross-point screw. If you remove the cover, you will see two blocks of option switches, one of which has eight switches (SW1) and the other four (SW2). The AUTO-LF switch (SW2-4) is the one in the SW2 block nearest to the SW1 block.
The printer does not have an escape sequence for setting or clearing AUTO-LF.
Epson LQ-2500+: This printer has both parallel and serial interfaces built in. If you are using the parallel interface, the interface cable must have the AUTO FEED XT line (line 14) disconnected. In both cases, you need to use the 'SelecType' from panel (which consists of four buttons and a liquid crystal display) as follows to inspect and, if necessary, change the AUTO-LF option:
Juki 2200: This printer always produces an LF code in response to a CR code. However LF is ignored if it immediately follows a CR, so the Juki 2200 should print satisfactorily from both +3DOS and CP/M.
Qume Sprint 11: There are several models of this printer,
some of which use a serial interface and some a parallel interface. Neither of
the interfaces use a signal to control AUTO-LF, so no alterations
are needed to the interface cable. Instead, the Sprint 11 has escape sequences
for handling AUTO-LF: ESC , to turn ON AUTO-LF (for +3DOS) and ESC . to turn
OFF AUTO-LF (for CP/M). You should also set the printer's AUTO LINE FEED
switch. The commands to send these sequences from Mallard BASIC are as
follows:
LPRINT CHR$(27) + "," to turn AUTO-LF ON.
LPRINT CHR$(27) + "." to turn AUTO-LF OFF.
There are three sets of option switches to contend with on this range of printers, including one set on the interface module. The Sprint 11/40 and 11/55 Plus have one set of switches at the front and another at the back: the Sprint 11/90 Plus has two sets at the back. The AUTO LINE FEED switch is the 'Front' SW4 switch on the 11/40 or 11/50 Plus, or the 'Back left' SW7 switch on the 11/90 Plus. Since we can control AUTO-LF by sending escape sequences, this switch may be left ON (the setting required for +3DOS).
The RS232/MIDI Port on the back of the Spectrum +3 provides a suitable Serial Interface for a Serial printer. (If you have a Parallel printer, you will have to connect it to the Spectrum's parallel Printer port, as explained in Section 4.1)
Unfortunately, using a printer with a computer is rarely just a matter of connecting the two together. Some programs do all the hard work for you where the printer's own defaults don't give you the settings you want but often it falls to you to ensure that:
In addition, CP/M has a built-in timeout mechanism to stop your system 'hanging up' if you accidentally try to send some output to a printer (say) when none is connected. However, this can work against you rather than for you if it takes your printer a long time to feed a sheet of paper - so you might also need a way of overriding the timeout mechanism.
There are CP/M commands to do all these things. The details are given below.
As we pointed out in the introduction to this chapter, the key to directing output to a particular device is in linking the logical device associated with this output to the correct physical device. In the case of printer output and the built-in RS232 port, this means linking the LST: logical device to the SIO physical device.
Immediately after CP/M is loaded, LST: is assigned to LPT - the Printer port, so before you use your serial printer you need to re-assign it to SIO. The command line to use is simply:
DEVICE LST:=SIO
In addition, there are various aspects of the data transfer you might have to set - in particular:
A DEVICE command will let you set the baud rate and protocol (see Chapter 5 for details) but the command that lets you set all these parameters is the SETSIO command.
The details you set depend on your printer, but the following command line illustrates the sort of command you might need:
SETSIO 300, BITS 8, STOP 1, P NONE, XON OFF, H ON
The first figure is the baud rate - that is, the rate at which data is sent to the printer in bits per second. The allowed baud rates are 150, 300, 600, 1200, 1800, 2400, 3600, 4800, 7200, 9600 and 19200. Your printer manual will tell you which rate to choose: if there is a choice, the general rule is to opt for the highest rate you can.
The next three parts of the command define the structure of the data - the number of data bits, the number of stop bits and the type of parity (used to check that the data is being transferred correctly). P stands for PARITY. Note: You can use either the full name or the first initial for any of these options.
The XON protocol and H (Handshake) options define the signalling system used for the transfer. Selecting the protocol option means that the printer will send codes to the computer to tell it when it is ready to receive more data. Selecting the handshake option means that a line of the cable is monitored to see when the printer is ready to receive further data.
The RS232 port is a fairly simple device and so handles input and output in a very simple fashion. As a result, you may experience problems using the XON protocol because this involves receiving information at the same time as sending it. So we recommend you to specify XON OFF and to use the Handshake option instead, just as we do for parallel printers (see Section 4.1).
Further details of the SETSIO utility are given in Chapter 5.
When you initialise a printer, you typically clear its buffer of any text that might be waiting to be printed and then set how the printer will operate. In particular, you might set:
These are all aspectes of printing that can be set by sending special Printer Control codes to the printer, details of which should be given in the printer's own user guide. So the problem comes down to how you can send these codes to the printer.
One way of sending these codes is by running a BASIC program containing a number of LPRINT commands: this is described in Part II, Section 3.5. What we describe here is an alternative method in which you set up the details of the codes in a special file, called a Printer Definition file, and then use the CP/M utility SETLST to send the contents of the file to the printer. This method is very useful if you always need to set up the printer in a particular way because SETLST command can very easily be included in your PROFILE.SUB file and executed as part of loading CP/M. Details of this method are given in Section 4.1.
IMPORTANT: Before you use either of these methods, you must direct the logical printer LST: to the RS232 port, by using the command:
DEVICE LST:=SIO
As a rule, CP/M Plus automatically times out sending information to a device in order to prevent the system 'locking up' completely because the information is being sent to a non-existent device. So, for example, if Control-P is typed accidentally when no printer is connected, CP/M will recognise after about 30 seconds that no printer is responding and produce a message like this:
SIO not ready - Retry, Ignore or Cancel?
You can then either switch the printer on-line and Retry - or type C for Cancel. (Note: If you do select the Cancel option, you should follow this up as soon as possible by using DEVICE (as described above in the section on 'Sending printer output to the Printer port') to link LST: with a suitable physical device. Typing C told CP/M to throw away any further output that you or your program tries to send to the LST: device - which might not be what you want!
Unfortunately, some printers take such a long time feeding a sheet of paper that CP/M times out before the operation has finished, requiring you to type R to continue. The better solution is to disable the timeout for the device by using the TIMEOUT command:
TIMEOUT device OFF
When you want timeout in operation again, you then simply type the command:
TIMEOUT device ON
WARNING: IF 'TIMEOUT OFF' IS SELECTED FOR A DEVICE THAT IS NOT FITTED, CP/M WILL LOCK UP.
You may well want to link your computer via a modem to electronic mail services like Telecom Gold or one of the many computing Bulletin Boards.
The RS232/MIDI Port on the back of the Spectrum +3 provides a Serial Interface which can be used from CP/M. However, while this interface is perfectly adequate for using with a Serial printer, it is not ideal for communications because it can only handle input and output in a very simple fashion. It does not work well with the simultaneous input and output that are part and parcel of using a modem.
If you want to use electronic mail, you need to attach a dedicated Serial Interface to the Expansion I/O socket on the back of the Spectrum and connect your modem to this. You also need to have suitable communications software to access the various electronic mail facilities. You may well find the interface and the communications software all provided in a single pack (the Spectre Comms Pack, for example, does this) or you may have to buy them separately. Consult your dealer for details.
As well as attaching your modem to your Spectrum and having communications software to run, you also have to ensure that data is transferred correctly along the line - very much as you do when you want to send output to a printer. The main difference is that CP/M doesn't normally access the Expansion port; for a start, it doesn't have a physical device name for it. So first you have to configure CP/M so that it can access this port and then you have to set up the details of the data transfer. Special software is supplied to do this, described below in 'Accessing the Expansion port' and in 'Setting up the Expansion port'.
The other feature of working with communications is that you need your computer to be constantly able to react to information being sent to it. Your modem needs to send information at any time and cannot be told to wait for computer to carry out some other task. The general task that takes too long is updating the screen. How you stop this from affecting your data transfer is described below in 'Communications and the screen'.
Again, it is a good idea to include the commands you need in your PROFILE.SUB file.
CP/M itself ignores the Expansion port, so special steps need to be taken to access it. These are outside 'normal' CP/M, and in fact have been set up specially for the Spectrum +3 by Locomotive Software.
Essentially what happens is that CP/M's list of physical devices is expanded to include the Expansion port. This is done through a special extension to CP/M stored in the file SERIAL.FID. If this file is on your CP/M Start-up disc, then this is loaded at the same time as CP/M and the Expansion port becomes available as the physical device SERIAL. If this file isn't on the disc or it is given another name, then the Expansion port is ignored.
SERIAL.FID is supplied on Side 2 of the master disc. So to use the Expansion port, you have to copy this file to Side 1 of your CP/M Start-up disc. This can be done readily enough by using PIP (as described in Section 3.3). Before you do this, however, do check that you have at least 1k free on Side 1 of your Start-up disc to store SERIAL.FID. You may have to erase one of the utilities currently one Side 1 to make room for it. (You can always make a copy of the original of this utility on your Master disc and store this on Side 2 of your Start-up disc in place of the SERIAL.FID you have moved.)
Once you have SERIAL.FID on Side 1 of your CP/M Start-up disc, you can re- load CP/M. Now you should see the message SERIAL vx.x installed added to the initial Start-up message: this tells you that CP/M has been successfully configured and SERIAL has been added to its list of physical devices.
You can then link the two logical devices used by your communications program (AUXIN and AUXOUT) to the SERIAL physical device, by using the following DEVICE command:
DEVICE AUX:=SERIAL
You now have access to the Expansion port and so to your modem. Before you use this, however, you need to define how the data is to be transferred. How to do this is described below.
The Expansion port needs to be set up so that it sends information to the modem in the correct form for the modem to handle and also so that it interprets any information it receives back from the modem correctly. The utility you use to do this is called STSERIAL, and it too has been specially written for CP/M on the Spectrum.
STSERIAL is essentially just like SETSIO. It allows you to set:
The details you set depend on your modem and the service you are linked to, but the following command line illustrates the sort of command you might need:
STSERIAL 300, BITS 8, STOP 1, P NONE, XON ON, H ON
The first figure is the baud rate - that is, the rate at which data is sent to the printer in bits per second. The allowed baud rates are 150, 300, 600, 1200, 1800, 2400, 3600, 4800, 7200, 9600 and 19200. Read your modem manual to discover which rate to choose.
The next three parts of the command define the structure of the data - the number of data bits, the number of stop bits and the type of parity (used to check that the data is being transferred correctly). P stands for PARITY. Note: You can use either the full name or the first initial for any of these options.
The XON protocol and H (Handshake) options define the signalling system used for the transfer. Selecting the protocol option means that the printer will send codes to the computer to tell it when it is ready to receive more data. Selecting the handshake option means that a line of the cable is monitored to see when the printer is ready to receive further data.
Further details of the STSERIAL utility are given in Chapter 5.
Scrolling text on the screen as new information is displayed takes a significant amount of processor time and therefore means your Spectrum could well be busy when your modem is trying to send it information. There isn't any way of telling the modem to wait: it just passes the information it receives on as fast as possible. Instead, the answer is to use the screen in the alternative 'Page' mode. In this screen mode, new information wraps round from the bottom of the screen to the top, and then proceeds to overwrite the existing display. This is a very much faster operation than scrolling the whole screen.
Page mode is turned on and off by sending Escape sequences to the screen. The sequences you use are detailed in Appendix III and are typically sent to the screen from a program such as BASIC. However, they can also be sent by pressing keys while the A> prompt is displayed - in exactly the same way as you can press keys to turn the Status line on and off (see Section 1.3). The keys to press are as follows:
Note: If you need both to turn Page mode on and to set the Screen size, then set the Screen size first. Setting the Screen size always turns Page mode off.
Further details of Page mode are given in the technical description of CP/M Plus on the Spectrum (Appendix VI.1).
The CP/M system supplied on the disc is set up to give you a 12k Memory Disc while you work with CP/M. This gives you an area of memory which can be used to hold copies of a few frequently used programs or files, which in turn means that you can use these without changing the disc in the drive. The supplied PROFILE.SUB, for example, uses it to store copies of PIP and SET24X80 - two utilities which we expect you to want to have to hand.
The Memory Disc is accessed as Drive C.
The size of the Memory Disc is very small (the Spectrum has insufficient memory for it to be any larger) and so you may not find it very useful. The memory used for the Memory Disc doesn't affect the amount of working area for your programs (the TPA) but it does reduce the size of the buffer available for file transfers. It therefore makes reading or writing to disc slightly slower.
If the type of work you do means that your programs are for ever reading or writing files on disc and you don't want to use the Memory Disc, simply erase or rename the file RAMDISC.FID on the CP/M Start-up disc. This file holds a special extension to CP/M which sets up the Memory disc at the time CP/M is loaded: without this file on your Start-up disc, no Memory disc is formed.
Note: RAMDISC.FID provides a very good model of how you extend CP/M to support additional block devices. Anyone intending to extend the CP/M on the Spectrum to support a hard disc, for example, could usefully start from a copy of RAMDISC.FID. Further details are given in the description of field installable devices (Appendix VI.5).
When you use a program or a data file that has been prepared by someone else you may find that some of the characters are displayed 'wrong'. For example, you might see #s where you expect to see £s.
The reason for this effect is that you are using a different national language version of CP/M to the one used when the program or data file was set up. The selection of characters made available on computers sold in different countries are subject to national variations. As a result, CP/M has different national language versions of the screen characters.
Immediately after you load CP/M, it is set up to use the US character set - because the CP/M programs you buy are likely to assume that you are using this character set. Full details of this character set are given in Appendix II. When using particular programs or data files you may have to ensure that you are using the national version of CP/M that was used when the program or data file was set up. Otherwise some of the characters will appear to be misinterpreted.
All the different characters CP/M displays are actually handled as codes. The codes CP/M uses are simply numbers in the range 0...255 (though for many reasons, these numbers are usually written as two-digit hexadecimal numbers - that is, numbers given to the base of 16 - preceded by a # to show that a hexadecimal number follows). A handful of these codes represent different characters, depending on which national language is selected. For example the code #5D (decimal 93) represents ] in the English version of CP/M but Ü in the German version. These language differences affect the character displayed in response to certain character codes in your data files.
All the different national language versions of CP/M are supported on the Spectrum +3 and a special utility has been incorporated into the CP/M system to allow the user to swap from one national language to another. This is the LANGUAGE utility. The instruction to adopt a particular national language is LANGUAGE n, where n is the number between 0 and 7 that corresponds to required language as follows:
0 | USA |
1 | France |
2 | Germany |
3 | UK |
4 | Denmark |
5 | Sweden |
6 | Italy |
7 | Spain |
On the Spectrum, the same range of characters can be displayed in all the different language versions: it is simply the codes used to represent certain characters that change.
The 'standard' set of codes and characters represented by these codes is the US character set. What happens in the other language versions is that certain codes in the first half of the character set (0...127) are associated with characters that are in the second half of the US character set and vice versa. In fact a straight swap is made between the code used for the special language character, and the character it substitutes. For example, in the US character set, the code for £ is #A3: when English is selected, £ replaces # as the character with code #23 - and # replaces £ as the character with code #A3.
The characters affected are shown in the table opposite. This shows the codes in the first half of the character set (0...127) that are displayed differently depending on which national language is selected and the characters they represent under the different languages. What you need to notice is where the character shown in the column for the national language you select is different from that shown in the US column: the codes used for both characters are affected by the change of language.
As well as changing how certain character codes in your data files will be displayed, changing
from one language to another also affects which characters are displayed on the screen when you
press particular keys. For example, under language 0 (US) pressing
+ D
causes a backslash (\) to be displayed, but under Language 1 (French) the
displayed character will be ç and under Language 7 (Spain) it will be Ñ.
The key combinations affected are the ones that generate the character codes which are associated with different characters depending on which national language is selected.
To find out the key combination to display the special language character in the language you are using, simply find the character in the appropriate language column of the table. The key combination you need is the one given in the same row of the table.
To discover the keystroking to use for the character it has displaced, find out from Appendix II.2 the key combination for the special language character when the US character set is selected: this is the key combination you need to use for the 'displaced' character.
Note: The keyboard continues to enter the same character codes. Changing language only affects the characters displayed on the screen as the result of your typing.
Hex | US | French | German | UK | Danish | Swedish | Italian | Spanish | Key combn. |
---|---|---|---|---|---|---|---|---|---|
#23 | # | # | # | £ | # | # | # | Pt | ![]() |
#40 | @ | à | § | @ | @ | É | @ | @ | ![]() |
#5B | [ | º | Ä | [ | Æ | Ä | º | ¡ | ![]() |
#5C | \ | ç | Ö | \ | Ø | Ö | \ | Ñ | ![]() |
#5D | ] | § | Ü | ] | Å | Å | é | ¿ | ![]() |
#5E | ^ | ^ | ^ | ^ | ^ | Ü | ^ | ^ | ![]() |
#60 | ` | ` | ` | ` | ` | é | ù | ` | ![]() |
#7B | { | é | ä | { | æ | ä | à | ¨ | ![]() |
#7C | | | ù | ö | | | ø | ö | ò | ñ | ![]() |
#7D | } | è | ü | } | å | å | è | } | ![]() |
#7E | ~ | ¨ | ß | ~ | ~ | ü | ì | ~ | ![]() |
When you load the CP/M operating system, the keyboard is automatically set up so that the key
combinations given in Appendix II.2 produce the characters listed in that section. In addition,
the 'function' keys (,
etc.) have been
set up to generate some of the CP/M Control codes. (Details of these keys and the Control codes
they generate are given in Appendix II.2.2.)
The range of characters and codes and the key combinations you use to produce them have been
selected to suit most of the CP/M applications programs that you will run on your Spectrum +3.
However, this selection omits many characters that you may need to be able to type if, say, you
want to prepare text in foreign languages and it won't necessarily suit every program that you
want to run. A number of programs are designed to be used with a keyboard that is set up so that
pressing a function key gives a particular action within the program. For example, WordStar
could be set up so that pressing
deletes a line of the text.
Alternatively, you might simply want to set up your keyboard so that pressing a function key gives you a complete CP/M command line - to save you the effort of typing this command. This can be very helpful when you want to make your applications programs easy to use by someone who may not understand CP/M.
You get these facilities by re-defining the codes that particular key combinations generate, before you run the applications program in which you want to use the new definitions.
The permitted key combinations are the key on its own,
+key,
+key
and
(or
+
)+key.
+key,
+key and
are known as
the Shift Keys.
To re-define your keyboard, you need a file containing details of the key combinations you want to re-define and the codes you want these keys to generate when you press them. This file is known as a Key Definition File and you can have a number of these on your discs - for example, one for when you want to use your spreadsheet program and another for when you want to play a particular computer game.
We describe how to set up a Key Definition File below.
Once you have the Key Definition File you require, you put all the changes it lists into practice by using a special CP/M utility called SETKEYS. This utility is stored on the CP/M Start-up disc. Running SETKEYS sets up the keys to have the meanings specified in the file - ready for running your chosen application program.
For example, the command:
SETKEYS KEYS.WP
will implement the key definitions in KEYS.WP (assuming that SETKEYS.COM is on the search path and KEYS.WP is on the default drive).
The changes implemented by running SETKEYS will stay in force until you take steps to change these key definitions again or you reset your computer. Resetting your computer automatically sets up the keyboard afresh in the standard way.
Before you run a different program, you will probably want either to return to using the standard CP/M keyboard or to use another set of key definitions.
To return to using the standard CP/M keyboard without resetting your computer, you run SETKEYS with a special Key Definition file on the CP/M Start-up disc called RESET.KEY. Simply insert the CP/M Start-up disc in Drive A and type the command:
A:SETKEYS RESET.KEY
To use another set of key definitions, you use another SETKEYS command as you might expect - but first, you need to restore the keyboard to the standard CP/M set of definitions as your Key Definition file will have been set up assuming that the standard keyboard will be in use immediately before the new definitions are implemented by SETKEYS. So, in this case, you should run SETKEYS with the RESET.KEY file as described above, before you use it with the new Key Definition file to implement the new definitions.
17* | 18* | 15 | 16 | 17 | 18 | 19 | 24 | 23 | 22 | 21 | 20 | 35* |
20* | 21* | 10 | 11 | 12 | 13 | 14 | 29 | 28 | 27 | 26 | 25 |
0 + 36 | 15* | 5 | 6 | 7 | 8 | 9 | 34 | 33 | 32 | 31 | 30 |
0 | 16* | 1 | 2 | 3 | 4 | 39 | 38 | 37 | 37+ | 0 |
36 | 26+ | 25+ | 19* | 22* | 35 | 23* | 24* | 38+ | 36 |
A Key Definition File is simply a text file that contains a list of the key combinations you want to redefine and the codes you want these key combinations to generate. Where necessary, the file also contains details of the command that you want the code to correspond to.
The lines of the Key Definition file that define the code that you want a particular key combination to produce, all have the form:
key-number shift-state "code" [optional-comment]
The key-number specifies the character or function key that you will want to use in the key combination. These key numbers are shown in the diagram above. From this diagram you will see, for example, that when you want to specify the 1 key, you use the key number 15.
The shift-state specifies which of the 'Shift' keys
,
and
are included
in the key combination. These keys are represented by a single letter - C for
, S for
and E for
(which is
equivalent to
+
), along with
N for Normal or Nothing (ie. unshifted).
Warning: Pressing many of the special function keys is exactly equivalent
to pressing a letter or a digit key and either
or
. To specify
these keys, you need to give both the key number and the letter representing this built-in
Shift state. This is shown on the diagram above by putting * or +
after the key number.
The code can be specified in a number of different ways:
The optional comment is any text that you care to include on the same line to remind you what the line does.
To make this clearer, we shall now look at three specific examples.
The N key has the key-number 38. Combining this key with
means that
the shift-state you want is E. The character you want has the value
249 or #F9. So the line to have in the Key Definition File would be:
38 E "^'249'" Ext.mode N = L.case N tildeor:
38 E "^'#F9'" Ext.mode N = L.case N tildeExt.mode N = L.case N tilde is simply the commend we have included so that we can readily work out what this line of the file does if we look at it again some time later, eg. next week.
The
key has the key-number 18. Combining this key with
means that
the shift-state you want is E. The Form Feed character is the
Control code with the name FF, and so the line you want in the
Key Definition File would be:
18 E "^'FF'" [comment](The Form Feed also has the value 12 or #0C, so you could equally well make this line 18 E "^'12'" or 18 E "^'#0C'".
The first thing to consider is which Token you will use to represent this command line. Tokens are codes with values 128...158 (#80...#9E), but the tokens with values 128...139 have already been set up so unless you want to overwrite one of these, we would suggest using another token - say 140 (#8C).
Having decided on the token you are going to use, you need a line in the Key Definition File
that associates this token with the key combination you want to use. In this case the key
combination is key-number 21 in shift-state C - because the
is set up to always
act as if the
key is pressed - so the line you need is:
21 C "^'140'" [comment] (or, alternatively, 21 C "^'#8C'")
You also need a line in the file that tells CP/M how to interpret this token. This line has the form:
E token "string"where token is the value of the token you are setting and string is the string of characters and codes that you want the key to produce for you. Again, characters can be entered in this string as char or ^'value'; Control codes can be entered as ^'value', ^char or ^'name'.
These two lines can appear in any order in the Key Definition file.
In this example, we want to make pressing
(which we have already
associated with token 140) produce the command line BASIC
. What pressing
does is send the Control
code Control-M which is also known as CR, so the string we require is simply BASIC^M
or alternatively BASIC^'CR' - giving us the complete line:
E 140 "BASIC^M" or E 140 "BASIC^'CR'"
Note: The example here both associates a token with a key combination and defines the string of characters and codes associated with this token. If you want to associate one of the supplied tokens with a particular key combination, you will just need the line that specifies the key combination and the token. If you want to keep the existing token but change its meaning, you just want the line setting the expansion token to the required string.
Important: You can have a maximum of 120 characters and codes in these special strings - and the supplied set total about 30.
If you want to make the key definitions within a particular Key Definition file the standard as far as your machine is concerned, you can do this with the aid of the PROFILE.SUB file. All that is required is a line in that file that tells the system to run the SETKEYS utility, taking as its source your Key Definition file.
You will find more about the PROFILE.SUB file in Section 3.15 ('Shortening the command line').
Programs are usually designed to take additional information from the keyboard and to send program output to the monitor, unless told otherwise.
This section describes how you can use CP/M to
The command that tells CP/M that your program's input is to come from a file is:
GET CONSOLE INPUT FROM FILE filespec
This command, which should be typed immediately before the command that runs your program, tells CP/M to arrange that the program reads this file whenever it wants details that it would normally take from the keyboard. For example, the two commands
GET CONSOLE INPUT FROM FILE MYFILE.DAT MYPROG
mean that all the keyboard input required by the program MYPROG is to be taken from the file MYFILE.DAT.
The program continues to take its input from this data file until it runs out of information - or the program finishes. Normally, everything that is taken from the file is also displayed on the screen and when the program finishes, CP/M reverts to taking information from the keyboard regardless of whether all the data in the file has been used.
If you don't want the information to be displayed on the screen or if you want CP/M to carry on taking keyboard input from this file, you have to specify this through options added to the end of your GET command:
To use one of these options, you put it between square brackets at the end of the command line; to use both options, you put them both in the same pair of square brackets separated by a comma. For example:
Normally, when you specify the SYSTEM option, information and commands will be taken from this file until the file is exhausted. However, you can if you want include a command in the file which tells the system to take its input from the keyboard again even though information still remains in the file. This is the command:
GET CONSOLE INPUT FROM CONSOLE
The commands that tell CP/M that your program's output is to be sent to a file are:
PUT CONSOLE OUTPUT TO FILE filespec | (Screen output) | |
and | PUT PRINTER OUTPUT TO FILE filespec | (Printer output) |
These commands, which should be typed immediately before the command that runs your program, tell CP/M to arrange that the output from the program should be sent to the given files. For example, the commands
PUT CONSOLE OUTPUT TO FILE MYPROG.SCN PUT PRINTER OUTPUT TO FILE MYPROG.PTR MYPROGwould mean that all the screen output from the program MYPROG should be stored in the file MYPROG.SCN and that all the printer output from this program should be stored in the file MYPROG.PTR.
Normally, the printer output from the program is now sent just to the given file but the screen output continues to be displayed on the screen as well. Moreover, when the program finishes, CP/M reverts to sending printer output to the printer and screen output just to the screen.
If you don't want the information to be displayed on the screen or you still want the printer output to be printed, you have to specify this through options added to the end of your PUT commands:
These options are the exact equivalents of the ones you can use with the GET command above. As with the GET command, you put the option(s) you require between square brackets at the end of the command line - if necessary, separated by a comma. For example:
If you want CP/M to carry on storing output in these files after the program has finished, you can also specify this through an option - the SYSTEM option. For example:
However, if you use the SYSTEM option for either Screen or Printer output you also need another PUT command to tell CP/M when to stop storing this output - because otherwise it will carry on putting your output into a file until you switch off (or run out of space on the disc!).
The commands you need are:
PUT CONSOLE OUTPUT TO CONSOLEand
PUT PRINTER OUTPUT TO PRINTER
Output to the screen or to the printer originally includes a number of control codes that ensure that it is laid out correctly on the screen / the printer. Normally, these codes are all automatically removed before the output is stored but if you would like to retain them, you can opt to have them converted to printable characters by specifying the FILTER option in your PUT command. (You might want this to help you transfer your output to a typesetting system, say.)
As with the other options, you select the FILTER option by putting its name between square brackets at the end of the command line. So for example: