Table Of ContentBBC Microcomputer System
User Guide
Original edition written by John Coll, edited by David Allen.
Amendments and corrections to this edition by Acorn Computers Limited
Part no 0433 000
Issue 1
Date October 1984
WARNING: THE COMPUTER MUST BE EARTHED
Important: The wires in the mains lead to the computer are coloured in accordance with the
following code:
Green and yellow Earth
Blue Neutral
Brown Live
As the colours of the wires may not correspond with the coloured markings identifying the
terminals in your plug, proceed as follows:
The wire which is coloured green and yellow must be connected to the terminal in the plug which
is marked by the letter E, or by the safety earth symbol or coloured green, or green and yellow.
The wire which is coloured blue must be connected to the terminal which is marked with the
letter N, or coloured black.
The wire which is coloured brown must be connected to the terminal which is marked with the
letter L, or coloured red.
If the socket outlet available is not suitable for the plug supplied, the plug should be cut off and
the appropriate plug fitted and wired as previously noted. The moulded plug which was cut off
should be disposed of as it could be a potential shock hazard if it were to be plugged in with the
cut off end of the mains cord exposed. The moulded plug must be used with the fuse and fuse
carrier firmly in place. The fuse carrier is of the same basic colour* as the coloured insert in the
base of the plug. Different manufacturers’ plugs and fuse carriers are not interchangeable. In the
event of loss of the fuse carrier, the moulded plug MUST NOT be used. Either replace the
moulded plug with another conventional plug wired as previously described, or obtain a
replacement fuse carrier from an authorised BBC Microcomputer dealer. In the event of the fuse
blowing it should be replaced, after clearing any faults, with a 3 amp fuse that is ASTA approved
to BS1362.
*Not necessarily the same shade of that colour.
Exposure
Like all electronic equipment, the BBC Microcomputer should not be exposed to direct sunlight or
moisture for long periods.
Econet and The Tube are trademarks of Acorn Computers Limited
©The author and the British Broadcasting Corporation 1982
Neither the whole nor any part of the information contained in, or the product described in, this
manual may be adapted or reproduced in any material form except with the prior written
approval of Acorn Computers Limited (Acorn Computers).
The product described in this manual and products for use with it are subject to continuous
development and improvement. All information of a technical nature and particulars of the
product and its use (including the information and particulars in this manual) are given by Acorn
Computers in good faith. However, it is acknowledged that there may be errors or omissions in
this manual. A list of details of any amendments or revisions to this manual can be obtained upon
request from Acorn Computers Technical Enquiries. Acorn Computers welcome comments and
suggestions relating to the product and this manual.
All correspondence should be addressed to:
Technical Enquiries
Acorn Computers Limited
Newmarket Road
Cambridge CB5 8PD
All maintenance and service on the product must be carried out by Acorn Computers’ authorised
dealers. Acorn Computers can accept no liability whatsoever for any loss or damage whatsoever
caused by service or maintenance by unauthorised personnel. This manual is
intended only to assist the reader in the use of the product, and therefore Acorn Computers shall
not be liable for any loss or damage whatsoever arising from the use of any information or
particulars in, or any error or omission in, this manual, or any incorrect use of the product.
First published 1984
Published by the British Broadcasting Corporation
Typeset by Bateman Typesetters, Cambridge
Within this publication the term ‘BBC’ is used as an abbreviation for ‘British Broadcasting
Corporation’.
This book is part of the BBC Computer Literacy Project, prepared in consultation with the BBC
Continuing Education Advisory Council.
The editor of the project is David Allen
Note: If this manual is to be used in conjunction with a BBC Microcomputer which is fitted with
an Operating System with version number lower than 2.00, then the following points should be
borne in mind:
– Chapter 42 and all other references to the ‘shadow screen’ should be ignored.
– Chapter 49 should be ignored (unless the machine with which the manual is to be used is fitted
with BASIC II).
In all other respects this manual is functionally compatible with earlier versions of the BBC
Microcomputer.
Contents
Introduction 1
Equipment required 1
Text conventions used in this manual 1
What this user guide can and can’t do 2
1 Getting started 3
Experimenting 5
Connecting up the cassette recorder 7
Leads 7
Volume 8
Running the WELCOME programs 8
The keyboard 11
Cursor control keys 13
Giving the computer instructions – Part 1
2 Commands 15
3 An introduction to variables 18
4 A simple program 20
Using the screen editor 22
Deleting part of a program 24
Removing a program 25
5 Recording programs on cassette 26
Saving a program on cassette 26
Checking a recording 27
Loading a program from cassette 27
Cataloguing a tape 28
What the numbers mean 28
6 Sample programs 30
7 AUTO, DELETE, REM, RENUMBER 43
8 Introducing graphics 45
Modes, colours, graphics and windows 45
Graphics 46
Windows 47
Making a graphics window 47
Making a text window 48
Changing the colours of text and graphics 50
9 More on variables 52
Numbers and characters 52
String variables 53
How numbers and letters are stored in the computer’s memory 54
Real and integer variables 55
Summary 56
10 PRINT formatting and cursor control 57
Field widths in different screen modes 57
Altering the width of the field and the way in which numbers are printed 60
For the more technically minded 60
TAB(X) 62
TAB(X,Y) 62
Advanced print positioning 63
Cursor control 65
Cursor on/off 66
11 Input 67
12 GET, INKEY 70
Advanced features � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � 71
13 TIME, RND 73
Structure in BASIC
14 REPEAT...UNTIL, TRUE, FALSE 74
15 FOR...NEXT 77
A note on LISTO � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � 80
16 IF...THEN...ELSE. More on TRUE and FALSE 84
Multiple statement lines � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � 84
For the slightly more advanced � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � 85
More on TRUE and FALSE � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � 85
17 Procedures 87
Local variables in procedures � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � �90
18 Functions 94
19 GOSUB 96
GOTO � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � 99
20 ON GOTO, ON GOSUB 100
Giving the computer instructions – Part 2
21 Even more on variables 102
Arrays 102
22 READ, DATA, RESTORE 107
23 Integer handling 110
24 String handling 114
25 Programming the red user-defined keys 119
The BREAK key 120
Other keys 120
26 Operator priority 122
27 Error handling 125
28 Teletext control codes and MODE 7 128
To change the colour of the text 129
To make characters flash 129
To produce double-height characters 130
Graphics 132
Graphics codes 133
Making a large shape 133
Teletext graphics codes for the more adventurous 134
29 Advanced graphics 137
How to change the screen display modes 137
How to draw lines 138
How to draw a square in the centre of the screen 138
Changing the colour of the square 138
How to fill in with colour 138
How to change colours 139
How to plot a point on the screen 144
How to remove a point selectively 144
Animation 145
How to make a ball and move it on the screen 145
How to create your own ‘graphics’ characters 146
How to make a character (eg a man) 146
How to make him move 147
How to make a larger character 148
How to make the movement smoother 149
Making a complete lunar landing game 151
Running the program 154
30 Sound 155
The pitch envelope 158
The amplitude envelope 159
Note synchronisation and other effects 161
31 File handling 163
32 Speeding up programs and saving memory space168
Reference section
33 BASIC keywords alphabetical summary 170
34 VDU drivers 347
VDU code summary 348
Detailed description 349
35 Cassette files 360
Cassette motor control 360
Recording levels 360
Playback volume and tone 360
Keeping an index of programs 360
Saving a BASIC program 361
Saving a section of memory 362
Loading a BASIC program 362
Loading a machine code program 363
Loading and running a BASIC program 363
Loading and running a machine code program 364
Using a cassette file to provide keyboard input 364
Reading cassette data files 365
Testing for end of file 365
Storing data on tape 366
Recording single characters on tape 366
File names 366
Responses to errors 367
Changing responses to errors 368
Cassette tape format 369
36 Changing filing systems 370
37 How to merge two BASIC programs 371
38 Using printers 373
Connecting the printer to the computer 373
A parallel printer cable 374
Parallel printer connections 375
Telling the computer whether you are using a parallel or serial printer 376
Telling the computer to copy everything to the printer 377
Characters not sent to the printer 377
39 Indirection operators 378
40 HIMEM, LOMEM, TOP and PAGE 383
41 Operating system statements 385
42 The shadow screen 387
Other shadow mode-related commands 388
43 The operating system and how to make use of it389
What is the operating system? 389
The *FX commands 390
OSBYTE calls from BASIC 391
OSBYTE calls from assembly language 393
The *FX commands and OSBYTE calls 395
Functional summary (alphabetical) 396
Numerical summary 398
44 An introduction to assembly language 428
Machine code and the assembler 428
Uses of assembly language 429
The main features of 6502 assembly language 429
The 6512 registers 430
Program counter 430
Accumulator 430
X register 430
Y register 430
Program status register 431
Stack pointer 431
The assembler delimiters ‘[’ and ‘]’, and general assembly language syntax
rules 431
Addressing modes 432
Implicit addressing 432
Immediate addressing and zero page addressing 432
Absolute addressing 433
Indirect addressing 433
Indexed addressing 433
Relative addressing 435
Accumulator addressing 436
Placing machine code programs in memory 436
OPT, forward referencing and two-pass assembly 438
The EQUate facility 439
Machine code entry points 441
Description:Econet and The Tube are trademarks of Acorn Computers Limited an Operating System with version number lower than 2.00, then the following points 45. Modes, colours, graphics and windows. 45. Graphics. 46. Windows. 47.